Project

General

Profile

Problem trying to static link a windows App with published 4.10.4 SDK

Added by Henrique Marks about 2 months ago

Hello all,

I have downloaded the 4.10.4 SDK for Win32 VS2019.

I have an application that uses that, and it is building correctly. And I am trying to statically link that App against wt.lib (and wthttp.lib). The build process seems to be correct, setting the right PATH to headers and Linking Paths.

But when trying to run the generated executable, it complains about missing dlls, for wt, wthttp, and then for openssl and some others.

I could see that, IF I copy wt.dll and others in the same folder as the generated executable, then it runs fine. But I was expecting this would not be needed, as I tried to use static linking.

Is there any problem with wt.lib, wthttp.lib in the published SDKs to be used for statically linking them in executables ?


Replies (5)

RE: Problem trying to static link a windows App with published 4.10.4 SDK - Added by Henrique Marks about 2 months ago

I have some additional information:

using objdump, i could see wt.lib outputs some strange information:

objdump -a wt.lib

output:

wt.dll: file format pei-i386
--------- 0/0 72 wt.dll

I did an objdump in an old version of wt, built locally, and that one shows a proper output of a static library.

I am starting to suspect the published static libraries are not static... is that the case ?

It would be nice to have static libraries, already linked against the dependencies.

Thanks !

RE: Problem trying to static link a windows App with published 4.10.4 SDK - Added by Matthias Van Ceulebroeck about 2 months ago

Hello Henrique,

thank you for this report. The Windows binaries have over the years been a headache at certain points. The actual resulting build should not have been change in this way though.
May I ask which older releases you have tried, and did still exhibit the correct output?

Best,
Matthias

RE: Problem trying to static link a windows App with published 4.10.4 SDK - Added by Henrique Marks about 2 months ago

Hello Matthias,

I am updating from a VERY old version, 3.2.3, to the newest, 4.10.4. I have NOT tested many versions, but for sure that version binaries seems "strange".

I want to intake the dependencies as binaries. In my case, as a static library, so no need for install and later load dlls from some strange places...

For Linux, I generated wt 4.10.4 in a Debian Bookworm docker container. Without enabling some options (because I haven't tried) it works perfectly, no problems whatsoever. Congrats!

For windows, I detected that using the "libs" (wt.lib) and generating executables and tests, I HAVE to install and load dlls (provided with Wt).

I think to reproduce the problem in windows just take one example, build using the provided headers and libs from the 4.10.4 SDK, and try to execute it, without providing the dll. Should work, if the static library is correct. Of course, the same can be made on Linux, but I think static libraries are not used on Linux since "the year 2000", or earlier... :-)

The very old version 3.2.3 has been internally built. I will build also version 4.10.4, but for me it is kind of waste of time, UNLESS we have very specific flags and other dependencies, which is not the case. But I will do it in the meantime.

For Linux, the build is simple: docker to isolate, install binary dependencies with the package manager, and build and install wt. Simple.
for Windows, no package manager that works, so PROBABLY I will finally give Conan a try, to bring the dependencies (boost and others) as binaries, and then build wt (using Conan "around" CMake). I think that would be the best solution for windows...

That's it, if you have more information about my suggestion on building an example using the SDK, and IF it works or not, I would like to know.

Thanks !

RE: Problem trying to static link a windows App with published 4.10.4 SDK - Added by Wim Dumon about 1 month ago

Hey Henrique,

We stopped shipping binary static libraries quite a long time ago. The .lib files that are shipped now, are indeed import libraries only, which are required to link to the .dll files.

Using static libraries is still possible with Wt, if you build Wt yourself. When running the CMake GUI, you'll see the options to enable static libraries. We stopped shipping them because managing the dependencies (the correct list of libraries to include when you're linking to the static library) can be quite a hassle, and we should make a lot of choices for you (do we link static or dynamic to boost, openssl, pango, vc runtime libs, ...?) that you probably want under your own control when your aim is to build a static binary.

Best regards,
Wim.

RE: Problem trying to static link a windows App with published 4.10.4 SDK - Added by Henrique Marks about 1 month ago

Ok, thanks for the information. I am building Wt by myself as you indicated.

Thanks a lot !

    (1-5/5)