When compiling STLPort-5.2.1 release with last mingw (gcc-4.5.0) I've got
linking errors:
c++ -Wall -Wsign-promo -Wcast-qual -fexceptions -mthreads -O2 -DWINVER=0x0501 -I../../stlport -enable-auto-import -shared -shared-libgcc -Wl,--out-implib=obj/gcc/so/libstlport.5.2.dll.a,--enable-auto-image-base -nodefaultlibs -o obj/gcc/so/libstlport.5.2.dll obj/gcc/so/dll_main.o obj/gcc/so/fstream.o obj/gcc/so/strstream.o obj/gcc/so/sstream.o obj/gcc/so/ios.o obj/gcc/so/stdio_streambuf.o obj/gcc/so/istream.o obj/gcc/so/ostream.o obj/gcc/so/iostream.o obj/gcc/so/codecvt.o obj/gcc/so/collate.o obj/gcc/so/ctype.o obj/gcc/so/monetary.o obj/gcc/so/num_get.o obj/gcc/so/num_put.o obj/gcc/so/num_get_float.o obj/gcc/so/num_put_float.o obj/gcc/so/numpunct.o obj/gcc/so/time_facets.o obj/gcc/so/messages.o obj/gcc/so/locale.o obj/gcc/so/locale_impl.o obj/gcc/so/locale_catalog.o obj/gcc/so/facets_byname.o obj/gcc/so/complex.o obj/gcc/so/complex_io.o obj/gcc/so/complex_trig.o obj/gcc/so/string.o obj/gcc/so/bitset.o obj/gcc/so/allocators.o obj/gcc/so/c_locale.o obj/gcc/so/cxa.o obj/gcc/so/stlport.res -lsupc++ -lgcc_s -lm -lmoldname -lmingw32 -lmingwex -lmsvcrt -lkernel32 Creating library file: obj/gcc/so/libstlport.5.2.dll.aobj/gcc/so/fstream.o:fstream.cpp:(.text+0x6a8): undefined reference to `__chkstk' obj/gcc/so/num_put_float.o:num_put_float.cpp:(.text+0x28): undefined reference to `__chkstk' obj/gcc/so/num_put_float.o:num_put_float.cpp:(.text+0x120d): undefined reference to `__chkstk' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0x4e): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0xd4): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_exception+0x3e): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_exception+0xc2): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_dependent_exception+0x49): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_dependent_exception+0xc4): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_dependent_exception+0x3a): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_dependent_exception+0xce): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$_GLOBAL__I___cxa_allocate_exception+0x1c): undefined reference to `__gthr_win32_mutex_init_function' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$_ZN12_GLOBAL__N_1L4initEv+0x17): undefined reference to `__gthr_win32_recursive_mutex_init_function' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$_ZN9__gnu_cxx17__recursive_mutex6unlockEv[__gnu_cxx::__recursive_mutex::unlock()]+0x17): undefined reference to `__gthr_win32_recursive_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$__cxa_guard_acquire+0x2a): undefined reference to `__gthr_win32_once' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$__cxa_guard_acquire+0x41): undefined reference to `__gthr_win32_recursive_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$__cxa_guard_acquire+0xe7): undefined reference to `__gthr_win32_recursive_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$__cxa_guard_abort+0x21): undefined reference to `__gthr_win32_recursive_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(guard.o):(.text$__cxa_guard_release+0x25): undefined reference to `__gthr_win32_recursive_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(cp-demangle.o):(.text+0xaef2): undefined reference to `__chkstk' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(cp-demangle.o):(.text+0xaf04): undefined reference to `__chkstk
To successfuly compile 2010-08-23 git source I have to apply patch to 3
files (./configure ./Makefiles/gmake/app/gcc.mak
./Makefiles/gmake/lib/gcc.mak):
*** configure Sat Sep 25 22:21:34 2010 --- ../stlport.nat/stlport/configure Sat Sep 25 22:31:28 2010 *************** *** 134,143 **** # Set in Makefiles/gmake/top.mak if [ -z "${compiler_family_set}" ]; then # write_option gcc COMPILER_NAME ! ln -sf ${base}/src/Makefiles/gcc.mak ${base}/src/Makefile ! ln -sf ${base}/test/cmp_unit/Makefiles/gcc.mak ${base}/test/cmp_unit/Makefile ! ln -sf ${base}/test/unit/Makefiles/gcc.mak ${base}/test/unit/Makefile ! ln -sf ${base}/test/eh/Makefiles/gcc.mak ${base}/test/eh/Makefile fi # Set in Makefiles/gmake/targetdirs.mak --- 134,143 ---- # Set in Makefiles/gmake/top.mak if [ -z "${compiler_family_set}" ]; then # write_option gcc COMPILER_NAME ! ln -sf Makefiles/gcc.mak ${base}/src/Makefile ! ln -sf Makefiles/gcc.mak ${base}/test/cmp_unit/Makefile ! ln -sf Makefiles/gcc.mak ${base}/test/unit/Makefile ! ln -sf Makefiles/gcc.mak ${base}/test/eh/Makefile fi # Set in Makefiles/gmake/targetdirs.mak *************** *** 251,260 **** gcc|icc|aCC|CC|bcc|dmc) target=`echo $option | sed -e 's/^[^=]*=//'` echo COMPILER_NAME := $target >> ${configmak} ! ln -sf ${base}/src/Makefiles/$target.mak ${base}/src/Makefile ! ln -sf ${base}/test/cmp_unit/Makefiles/$target.mak ${base}/test/cmp_unit/Makefile ! ln -sf ${base}/test/unit/Makefiles/$target.mak ${base}/test/unit/Makefile ! ln -sf ${base}/test/eh/Makefiles/$target.mak ${base}/test/eh/Makefile ;; *) echo "Not supported compilers family" --- 251,260 ---- gcc|icc|aCC|CC|bcc|dmc) target=`echo $option | sed -e 's/^[^=]*=//'` echo COMPILER_NAME := $target >> ${configmak} ! ln -sf Makefiles/$target.mak ${base}/src/Makefile ! ln -sf Makefiles/$target.mak ${base}/test/cmp_unit/Makefile ! ln -sf Makefiles/$target.mak ${base}/test/unit/Makefile ! ln -sf Makefiles/$target.mak ${base}/test/eh/Makefile ;; *) echo "Not supported compilers family" *** ./Makefiles/gmake/app/gcc.mak Sat Sep 25 22:25:41 2010 --- ../stlport.nat/stlport/Makefiles/gmake/app/gcc.mak Sat Sep 25 22:31:28 2010 *************** *** 230,238 **** # _USE_NOSTDLIB else ifndef USE_STATIC_LIBGCC ! release-shared : LDFLAGS += -shared -shared-libgcc ! dbg-shared : LDFLAGS += -shared -shared-libgcc ! stldbg-shared : LDFLAGS += -shared -shared-libgcc endif ifndef WITHOUT_STLPORT STDLIBS = ${STLPORT_LIB} --- 230,238 ---- # _USE_NOSTDLIB else ifndef USE_STATIC_LIBGCC ! release-shared : LDFLAGS += -shared-libgcc ! dbg-shared : LDFLAGS += -shared-libgcc ! stldbg-shared : LDFLAGS += -shared-libgcc endif ifndef WITHOUT_STLPORT STDLIBS = ${STLPORT_LIB} *** ./Makefiles/gmake/lib/gcc.mak Sat Sep 25 22:26:45 2010 --- ../stlport.nat/stlport/Makefiles/gmake/lib/gcc.mak Sat Sep 25 22:31:28 2010 *************** *** 283,291 **** ifeq ($(OSNAME),windows) ifndef USE_STATIC_LIBGCC ! dbg-shared: LDFLAGS += -shared -shared-libgcc ! stldbg-shared: LDFLAGS += -shared -shared-libgcc ! release-shared: LDFLAGS += -shared -shared-libgcc endif dbg-shared: LDFLAGS += -Wl,--out-implib=${LIB_NAME_OUT_DBG},--enable-auto-image-base stldbg-shared: LDFLAGS += -Wl,--out-implib=${LIB_NAME_OUT_STLDBG},--enable-auto-image-base --- 283,291 ---- ifeq ($(OSNAME),windows) ifndef USE_STATIC_LIBGCC ! dbg-shared: LDFLAGS += -shared-libgcc ! stldbg-shared: LDFLAGS += -shared-libgcc ! release-shared: LDFLAGS += -shared-libgcc endif dbg-shared: LDFLAGS += -Wl,--out-implib=${LIB_NAME_OUT_DBG},--enable-auto-image-base stldbg-shared: LDFLAGS += -Wl,--out-implib=${LIB_NAME_OUT_STLDBG},--enable-auto-image-base
Library was successfully build, but when I tried to compile my source code:
g++ -nodefaultlibs -mthreads -I"/path/to/stlport" -L"/path/to/.a/lib" -otest.exe test.cpp -lstlport.6.0.dll -lsupc++ -lgcc_s -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname -lcoldname -lkernel32
I have the same "undefined error" as with STLPort-5.2.1 release:
c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0x4e): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_exception+0xd4): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_exception+0x3e): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_exception+0xc2): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_dependent_exception+0x49): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_allocate_dependent_exception+0xc4): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_dependent_exception+0x3a): undefined reference to `__gthr_win32_mutex_lock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$__cxa_free_dependent_exception+0xce): undefined reference to `__gthr_win32_mutex_unlock' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(eh_alloc.o):(.text$_GLOBAL__I___cxa_allocate_exception+0x1c): undefined reference to `__gthr_win32_mutex_init_function' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(cp-demangle.o):(.text+0xaef2): undefined reference to `__chkstk' c:/system/devel/mingw/bin/../lib/gcc/mingw32/4.5.0/libsupc++.a(cp-demangle.o):(.text+0xaf04): undefined reference to `__chkstk'
How can I fix the problem with supc++?