Compilation problems with MinGW

Hello everyone, I successfully compiled Boost with MinGW (GCC 4.4.0 - it came installed with the Qt SDK) with all the settings on, so it has generated both dynamic and static libraries, debug and release versions, multithreaded and non-multithreaded runtimes etc. I tried to compile a small program that uses the serialization library (http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/tutorial.html#si...) and tried to link it statically with these libraries (in different compilations): libboost_serialization-mgw34-1_40.lib libboost_serialization-mgw34-mt-1_40.lib libboost_serialization-mgw34-mt-s-1_40.lib libboost_serialization-mgw34-mt-s.lib libboost_serialization-mgw34-mt.lib libboost_serialization-mgw34-s-1_40.lib libboost_serialization-mgw34-s.lib libboost_serialization-mgw34.lib Each time I compiled, it would always give me linker errors like so: undefined reference to `__gxx_personality_sj0' undefined reference to `_Unwind_SjLj_Register' undefined reference to `_Unwind_SjLj_Unregister' undefined reference to `_Unwind_SjLj_Resume' These are repeated over and over again. The compiler command and flags that I use are g++ test.cpp -o test -Ipath/to/boost/include path/to/static/library However, if I compile it with an import library like boost_serialization-mgw34.lib I don't get such errors. Searching online seems to suggest I am missing a compiler flag, but I cannot determine which one I am missing. Perhaps my Google-Fu isn't strong enough, so if I did miss out something patently obvious that could have been found online I offer my due apologies. Thanks a lot anyway! Benjamin

On Sat, Mar 13, 2010 at 10:16 PM, Benjamin Lau
Hello everyone,
I successfully compiled Boost with MinGW (GCC 4.4.0 - it came installed with the Qt SDK) with all the settings on, so it has generated both dynamic and static libraries, debug and release versions, multithreaded and non-multithreaded runtimes etc. I tried to compile a small program that uses the serialization library (http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/tutorial.html#si...) and tried to link it statically with these libraries (in different compilations):
libboost_serialization-mgw34-1_40.lib libboost_serialization-mgw34-mt-1_40.lib libboost_serialization-mgw34-mt-s-1_40.lib libboost_serialization-mgw34-mt-s.lib libboost_serialization-mgw34-mt.lib libboost_serialization-mgw34-s-1_40.lib libboost_serialization-mgw34-s.lib libboost_serialization-mgw34.lib
Each time I compiled, it would always give me linker errors like so:
undefined reference to `__gxx_personality_sj0' undefined reference to `_Unwind_SjLj_Register' undefined reference to `_Unwind_SjLj_Unregister' undefined reference to `_Unwind_SjLj_Resume'
These are repeated over and over again. The compiler command and flags that I use are g++ test.cpp -o test -Ipath/to/boost/include path/to/static/library
However, if I compile it with an import library like boost_serialization-mgw34.lib I don't get such errors.
Searching online seems to suggest I am missing a compiler flag, but I cannot determine which one I am missing. Perhaps my Google-Fu isn't strong enough, so if I did miss out something patently obvious that could have been found online I offer my due apologies.
You need to enable exception handling. I have no clue what the GCC flag for that it, but that is what needs to be done (/Eh ?). Your runtime must also have exception handling support (assuming Qt did not chance anything in the normal runtime build for MingW's GCC, it should).

I checked my MinGW installation's configuration (via g++ -v) and it gave me the following: Using built-in specs. Target: mingw32 Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32 Thread model: win32 gcc version 4.4.0 (GCC) It seems that my build of the MinGW compiler does not support setjmp/longjmp exceptions. If that is the case, how does MinGW build the static Boost libraries to require setjmp and longjmp, if it doesn't even support it? Or is there a compiler flag I can pass to g++ when I call it that will allow setjmp and longjmp use? Benjamin
participants (2)
-
Benjamin Lau
-
OvermindDL1