Problems with statical link of wxWidgets libs

Lars Uffmann aral at nurfuerspam.de
Tue May 6 04:28:06 PDT 2008



Hi everyone!

I'm kinda trying to get to the root of the following problem and would 
appreciate if someone could help me to tell apart wxWidgets dynamic from 
static library builds:

I built wxWidgets on MinGW using
   ./configure --prefix=/mingw
   make
   make install

which had me ending up with the lib files in /mingw/lib:
libwx_base-2.8.dll.a

...

and
wxbase28_gcc_custom.dll
...

I can compile and link programs just fine as long as I want to use the 
DLLs: the program will just expect the DLLs anywhere in the folders 
contained in PATH variable (or local folder).

However, if I link the executable with g++ -static, I get the linker 
complaining:
   ld.exe: cannot find -lwx_base-2.8

So - since the .dll.a was confusing me anyways, I tried both renaming 
the libraries to .a (since they seem to be the static versions) and 
linking from the MSYS shell, supplying the libraries as -lwx_base-2.8.dll
Both solutions "work" - meaning the linker will not complain, and 
produce an executable. However, this executable will be the very same as 
if I never used the -static linker flag, and require the DLL-files to run.

Can anyone tell me why my mingw gnu c++ linker is not creating the 
statically linked executable? Maybe I have not build the correct 
wxWidgets libraries? The .dll.a files start with !<arch> - which seems 
to be the correct file type for static libaries, so I am quite at a loss 
here...

Thanks in advance!

   Lars


More information about the wx-users mailing list