|
From: Brian D. <br...@de...> - 2007-12-05 18:46:30
|
Benno Senoner wrote: > compiling linuxsampler on linux generated dynamic libs as default > and everything is ok. > on mingw it generates only the static libs but gives no errors or > warnings other than the warning: > libtool: link: warning: undefined symbols not allowed in > i686-pc-mingw32 shared libraries There are several things that you need to realize here. First, ELF and PE work quite differently, specifically ELF has the ability to link a library or program with undefined symbols that are lazily resolved at program runtime by the runtime dynamic linker ld.so. You can't do this on PE systems, which require that all symbols be resolvable at link time. Completely separate from those architectural design differences, libtool also has a -no-undefined flag with a somewhat overloaded meaning. On platforms like PE where undefined symbols cause a link failure, libtool requires that you specify -no-undefined if you want to build a shared library. Doing this tells libtool "yes, this library was designed to work this way, so it's okay to try to create a shared library." Otherwise it won't even try. You can normally just add this flag to foo_la_LDFLAGS and things will work fine -- assuming of course that the package itself was not designed to rely on this ELF ability to do lazy binding. In that case you'll have more work to do. > is this warning the cause of libtool chosing to link statically ? > if I retun configure with --enable-shared --disable-static > I get linking errors. That sounds like an invalid configuration, because without -no-undefined you give libtool no choice but to create static libs, but you've also disabled them. > basically it executes the same commands as above, creating > liblinuxsampler.a instead of liblinuxsampler.dll > > and when trying to linking the exe I get lots of undefined references, > see here the linking command and a few lines of errors: > > -------------------- > /bin/sh ../libtool --mode=link g++ -Wreturn-type -ffast-math -O3 > -msse -march=pentium4 -mfpmath=sse -ffast-math -fomit-frame-pointer > -funroll-loops -msse -o linuxsampler.exe linuxsampler.o > ../src/liblinuxsampler.la > g++ -Wreturn-type -ffast-math -O3 -msse -march=pentium4 -mfpmath=sse > -ffast-math -fomit-frame-pointer -funroll-loops -msse -o > linuxsampler.exe linuxsampler.o ../src/.libs/liblinuxsampler.a > -lws2_32 -lole32 -LC:/msys/1.0/local/lib /usr/local/lib/libgig.dll.a > -lrpcrt4 -lwinmm -L/usr/local/lib -L/usr/local/lib > linuxsampler.o:linuxsampler.cpp:(.text+0x688): undefined reference to > `LinuxSampler::Sampler::Sampler()' > linuxsampler.o:linuxsampler.cpp:(.text+0x1303): undefined reference to > `LinuxSampler::Sampler::GetSamplerChannels()' > linuxsampler.o:linuxsampler.cpp:(.text+0x1335): undefined reference to > `LinuxSampler::SamplerChannel::GetEngineChannel()' These link errors could be due to a number of reasons, all of which generally fall into the same category of "ELF and PE are different." Nothing appears overtly wrong in the above, so you'll have to dig a little deeper. Find out where the mentioned symbols are defined and then see if they are present in the resultant objects and libraries. Brian |