Menu

#210 STLport 5.2.1 is failed to build with mingw gcc 4.4.0

unverified
open
2
2014-03-23
2009-07-03
lexis
No

Linking is failed with many unresolved external references to microsoft runtime libraries:

c++ -Wall -Wsign-promo -Wcast-qual -fexceptions -mthreads -O2 -DWINVER=0x0501 -I../../stlport -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.d
ll 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/st
dio_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/l
ocale_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.a
obj/gcc/so/fstream.o:fstream.cpp:(.text+0x800): undefined reference to `__chkstk'
obj/gcc/so/num_put_float.o:num_put_float.cpp:(.text+0x1a8): undefined reference to `__chkstk'
obj/gcc/so/num_put_float.o:num_put_float.cpp:(.text+0x13e5): undefined reference to `__chkstk'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_init_function':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:466: undefined reference to `__gthr_win32_mute
x_init_function'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_unlock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:497: undefined reference to `__gthr_win32_mute
x_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_lock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:479: undefined reference to `__gthr_win32_mute
x_lock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_unlock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:497: undefined reference to `__gthr_win32_mute
x_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_lock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:479: undefined reference to `__gthr_win32_mute
x_lock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_unlock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:497: undefined reference to `__gthr_win32_mute
x_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_lock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:479: undefined reference to `__gthr_win32_mute
x_lock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_unlock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:497: undefined reference to `__gthr_win32_mute
x_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_lock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:479: undefined reference to `__gthr_win32_mute
x_lock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(eh_alloc.o): In function `_gthread_mutex_unlock':
/mingw/src/gccbf/mingw32/libstdc++-v3/include/mingw32/bits/gthr-default.h:497: undefined reference to `__gthr_win32_mute
x_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$_ZN9__gnu_cxx17__recursive_mutex6unlockEv[__g
nu_cxx::__recursive_mutex::unlock()]+0x16): undefined reference to `__gthr_win32_recursive_mutex_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$_ZN12_GLOBAL__N_116get_static_mutexEv+0x20):
undefined reference to `__gthr_win32_once'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$_ZN12_GLOBAL__N_1L4initEv+0x24): undefined re
ference to `__gthr_win32_recursive_mutex_init_function'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$__cxa_guard_acquire+0x2d): undefined referenc
e to `__gthr_win32_recursive_mutex_lock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$__cxa_guard_release+0x25): undefined referenc
e to `__gthr_win32_recursive_mutex_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(guard.o):guard.cc:(.text$__cxa_guard_abort+0x25): undefined reference
to `__gthr_win32_recursive_mutex_unlock'
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/libsupc++.a(cp-demangle.o): In function `d_demangle_callback':
C:\MinGW\src\gccbf\mingw32\libstdc++-v3\libsupc++/cp-demangle.c:4520: undefined reference to `__chkstk'
C:\MinGW\src\gccbf\mingw32\libstdc++-v3\libsupc++/cp-demangle.c:4521: undefined reference to `__chkstk'
collect2: ld returned 1 exit status
mingw32-make: *** [obj/gcc/so/libstlport.5.2.dll] Error 1

Discussion

  • Petr Ovtchenkov

    Petr Ovtchenkov - 2009-07-03

    According to names it isn't 'microsoft'. You should investigate this issue (looks like it's mainly mingw or gcc + mingw problem, not STLport's).

    Expected answers:

    - where this symbols requested?
    - where this symbols really defined?

     
  • Petr Ovtchenkov

    Petr Ovtchenkov - 2009-07-03
    • priority: 5 --> 2
    • assigned_to: nobody --> complement
     
  • Andriy Syrovenko

    I've checked GCC's built-in specs and found that in MinGW GCC 4.4.0 linking against shared libgcc seems to be not enough, static library should be present as well. Since -nodefaultlibs compiler/linker flag is used, both libraries should be specified on the command line manually. Currently only shared library is specified (-lgcc_s), adding static library (-lgcc) fixes the problem. The patch is trivial.

    diff -U8 -rN STLport-5.2.1/build/Makefiles/gmake/app/gcc.mak STLport-5.2.1_fixed/build/Makefiles/gmake/app/gcc.mak
    --- STLport-5.2.1/build/Makefiles/gmake/app/gcc.mak 2008-12-10 11:56:51.000000000 +0200
    +++ STLport-5.2.1_fixed/build/Makefiles/gmake/app/gcc.mak 2009-07-30 18:37:29.000000000 +0300
    @@ -183,17 +183,17 @@
    endif

    ifeq ($(OSNAME),cygming)
    LDFLAGS += -nodefaultlibs
    ifndef USE_STATIC_LIBGCC
    ifeq ($(shell ${CXX} ${CXXFLAGS} -print-file-name=libgcc_s.a),libgcc_s.a)
    _LGCC_S := -lgcc
    else
    -_LGCC_S := -lgcc_s
    +_LGCC_S := -lgcc_s -lgcc
    endif
    else
    _LGCC_S := -lgcc
    endif
    ifeq ($(OSREALNAME),mingw)
    STDLIBS = ${STLPORT_LIB} -lsupc++ ${_LGCC_S} -lmingw32 -lmingwex -lmsvcrt -lm -lmoldname -lcoldname -lkernel32
    else
    LDFLAGS += -Wl,-enable-auto-import
    diff -U8 -rN STLport-5.2.1/build/Makefiles/gmake/lib/gcc.mak STLport-5.2.1_fixed/build/Makefiles/gmake/lib/gcc.mak
    --- STLport-5.2.1/build/Makefiles/gmake/lib/gcc.mak 2008-12-10 11:56:51.000000000 +0200
    +++ STLport-5.2.1_fixed/build/Makefiles/gmake/lib/gcc.mak 2009-07-30 18:37:19.000000000 +0300
    @@ -211,17 +211,17 @@
    ifneq ($(OSNAME),cygming)
    NOSTDLIB := -nostdlib
    else
    NOSTDLIB := -nodefaultlibs
    ifndef USE_STATIC_LIBGCC
    ifeq ($(shell ${CXX} ${CXXFLAGS} -print-file-name=libgcc_s.a),libgcc_s.a)
    _LGCC_S := -lgcc
    else
    -_LGCC_S := -lgcc_s
    +_LGCC_S := -lgcc_s -lgcc
    endif
    else
    _LGCC_S := -lgcc
    endif
    ifeq ($(OSREALNAME),mingw)
    STDLIBS = -lsupc++ ${_LGCC_S} -lm -lmoldname -lmingw32 -lmingwex -lmsvcrt -lkernel32
    else
    LIBSUPC++ := $(shell ${CXX} ${CXXFLAGS} -print-file-name=libsupc++.a)

     
  • Andriy Syrovenko

    Well, the inlined patch seems to be quite unreadable... Does anybody know how to attach a file to this ticket?

     

Log in to post a comment.