Unresolved External Symbol when using statically compiled .lib

Comments, questions, bug reports, etc.
Post Reply
wimlover
Posts: 2
Joined: Fri Mar 24, 2023 8:58 pm

Unresolved External Symbol when using statically compiled .lib

Post by wimlover »

Hey,

I'd like my executable to package in wimlib rather than having external dependencies such as the libwim dll. To do this, I statically compiled the project and then added the library to my cmake file.

I have been adding various Windows .lib files to try to satisfy the library's dependencies but they seem to be never-ending. Have you got any recommendations as to how I can build wimlib to include all these extra library dependencies?

Thanks!
synchronicity
Site Admin
Posts: 472
Joined: Sun Aug 02, 2015 10:31 pm

Re: Unresolved External Symbol when using statically compiled .lib

Post by synchronicity »

Have you tried wimlib v1.14.0-BETA2? It eliminates the dependencies on libxml2 and winpthreads.

See https://wimlib.net/downloads/index.html
wimlover
Posts: 2
Joined: Fri Mar 24, 2023 8:58 pm

Re: Unresolved External Symbol when using statically compiled .lib

Post by wimlover »

Sorry, I may have been unclear. I can compile my test program to use wimlib just fine, using libwim.lib as a library in my cmakelists.txt file. However, the exe then requires the libwim-15.dll to be present in PATH.

So I have removed this line: https://github.com/ebiggers/wimlib/blob ... ld.sh#L205 and added libwim.a to my CMakeLists.txt libraries. This creates a Visual Studio solution but will not compile.

It requires ntdll.lib, then a few more, and then I got very lost. Is it possible to compile all of these external .lib dependencies in with wimlib, to begin with, so visual studio will not have to try and link these?

I have been reading some of the previous forum posts (eg viewtopic.php?p=630&hilit=static#p630) and can see people have had similar problems in the past but wondered if you might have a fix for my situation.

Sorry I'm very new to the compiler magic!
synchronicity
Site Admin
Posts: 472
Joined: Sun Aug 02, 2015 10:31 pm

Re: Unresolved External Symbol when using statically compiled .lib

Post by synchronicity »

Right, I forgot: the libwim.lib in the binary releases is an import library, not a real static library. You'll need to change the build script to build a static library instead.

BTW, have you checked whether wimlib's LGPL license is compatible with static linking into your program?
Post Reply