Problems with statical link of wxWidgets libs
Werner Smekal
smekal at iap.tuwien.ac.at
Tue May 6 05:04:49 PDT 2008
Hi Lars,
if you configure wxWidgets with "./configure --prefix=/mingw" you obtain
shared libraries (xxx.dll) and the libraries which interface to these
dlls (xxx.dll.a). The xxx.dll.a don't contain any wxWidgets code, just
an interface to the dll. They are actually not needed, since the MinGW
compiler is able to link directly do dlls created with the MinGW
compiler (this is what you found out already).
In order to obtain static libraries you need to configure wxWidgets like
this:
./configure --prefix=/mingw --disable-shared
The created libraries are then called xxx.a (without dll). You get more
info about configure options in wxMSW-2.8.7\docs\msw\install.txt
HTH,
Werner
Lars Uffmann wrote:
>
>
> 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
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria
email: smekal at iap.tuwien.ac.at
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office)
+43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499
More information about the wx-users
mailing list