#Using libdeflate as static library

51 messages · Page 1 of 1 (latest)

tall pendant
#

Hi, I'm trying to use libdeflate as a static library, so there's no need to redistribute dlls alongside the app.

I have a libdeflate/ directory in my project root, which contains deflate.lib and deflate.h. The program links and compiles, but I get a missing deflate.dll error at runtime.

How do I make it use the static library and not the non-existent dynamic one?

midnight nacelleBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

warped umbra
#

That library file is apparently for the dynamic version of the library, you need to get the static version.

tall pendant
#

I don't know where to find the static version. It's not on vcpkg and not on the releases page, and I for sure am not installing wsl to compile it

#

The static library (normally called libdeflate.a)
Great. Linux only.

warped umbra
tall pendant
#

What about windows? The author provides only the prebuilt dll for windows.

#

But linux gets the static library too.

#

Am I seriously expected to build it myself...

warped umbra
#

You are using ebiggers's right?

tall pendant
#

Yes

warped umbra
tall pendant
#

I tried that, and at first it complained about implicit casting, so I set them to compile as C in the vcxproj. Then some other random bullshit came up and I just gave up

warped umbra
#

Try showing it.

tall pendant
#

Getting a linker error, even though the code is being compiled

warped umbra
tall pendant
#

Thank you so much

#

Hmm, still a linker error

#

Not sure what's up, it seems correctly configured

#
      <AdditionalDependencies>deflate.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>../../libdeflate;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
warped umbra
tall pendant
#

It's Rider on Windows

#

Haha, it does look a bit like MacOS

warped umbra
#

OK. So you are using MSVC right, just to be sure.

tall pendant
#

Yep.

warped umbra
#

OK, then show those linker errors, paste as text so that I can paste into Google translate.

tall pendant
#

Hang on for a bit, I cleaned the solution and it's now rebuilding everything 😬

#

The errors are just
unresolved external symbol "_libdeflate_alloc_compressor"
unresolved external symbol "_libdeflate_gzip_compress"

#

Bit annoying how Rider uses the system language, but it's fine

warped umbra
#

You are using the file I sent right? The file name doesn't seem to be the same.

tall pendant
#

I renamed it to deflate.lib

#

Anyway, I'm looking for x86, not x64

#

Targetting Win32 still haha

warped umbra
#

That explains it.

tall pendant
#

May I ask how you're building this so quickly?

warped umbra
#

It just uses CMake.

tall pendant
#

Oh, I thought it used some linux-specific stuff. Well good to know I'm ignorant for no reason lol

warped umbra
tall pendant
#

Thank you

#
  unresolved external symbol "__except_handler4_common" in function "__except_handler4".

The other errors are gone, but now there's this obscure one. Is this some crt incompatibility or

#

Are you compiling targetting MSVC 2015?

warped umbra
#

No.

#

Maybe it's better that you learn to build the library by yourself then.

tall pendant
#

Alright

midnight nacelleBOT
#

@tall pendant Has your question been resolved? If so, type !solved :)

tall pendant
#

!solved

midnight nacelleBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

tall pendant
#

@warped umbra Sorry, I can't figure it out. How did you build x86? I only get the target for x64 in the dropdown in VS.

#

It generates this, I open it and then

warped umbra
#

Specify -A Win32 to CMake.

tall pendant
#

Ahh, thank you.