lhmouse / mcfgthread

Cornerstone of the MOST efficient std::thread on Windows for mingw-w64
https://gcc-mcf.lhmouse.com/
Other
269 stars 28 forks source link

link error for i686-w64-mingw32 target #12

Closed xantares closed 8 years ago

xantares commented 8 years ago

Hi,

On archlinux the package builds fine for x86_64-w64-mingw32 target but not for i686: undefined reference to__gcc_personality_sj0`

Seems this is should be part of the standard library: $ grep -nr __gcc_personality_sj0 /usr/i686-w64-mingw32/lib/ Binary file /usr/i686-w64-mingw32/lib/libgcc_s.a matches

Any clue ?

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
aclocal: warning: couldn't open directory 'm4': No such file or directory
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.
configure.ac:6: installing './compile'
configure.ac:9: installing './install-sh'
configure.ac:9: installing './missing'
Makefile.am: installing './depcomp'
autoreconf: Leaving directory `.'
~/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32 ~/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9
configure: WARNING: you should use --build, --host, --target
configure: WARNING: unrecognized options: --enable-shared, --enable-static
checking for i686-w64-mingw32-gcc... i686-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether i686-w64-mingw32-gcc accepts -g... yes
checking for i686-w64-mingw32-gcc option to accept ISO C89... none needed
checking whether i686-w64-mingw32-gcc understands -c and -o together... yes
checking for i686-w64-mingw32-ranlib... i686-w64-mingw32-ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for i686-w64-mingw32-strip... i686-w64-mingw32-strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of i686-w64-mingw32-gcc... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
configure: WARNING: unrecognized options: --enable-shared, --enable-static
make  all-am
make[1]: Entering directory '/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32'
depbase=`echo src/env/avl_tree.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/avl_tree.o -MD -MP -MF $depbase.Tpo -c -o src/env/avl_tree.o ../src/env/avl_tree.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/bail.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/bail.o -MD -MP -MF $depbase.Tpo -c -o src/env/bail.o ../src/env/bail.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/clocks.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/clocks.o -MD -MP -MF $depbase.Tpo -c -o src/env/clocks.o ../src/env/clocks.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/condition_variable.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/condition_variable.o -MD -MP -MF $depbase.Tpo -c -o src/env/condition_variable.o ../src/env/condition_variable.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/gthread.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/gthread.o -MD -MP -MF $depbase.Tpo -c -o src/env/gthread.o ../src/env/gthread.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/c11thread.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/c11thread.o -MD -MP -MF $depbase.Tpo -c -o src/env/c11thread.o ../src/env/c11thread.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/heap.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/heap.o -MD -MP -MF $depbase.Tpo -c -o src/env/heap.o ../src/env/heap.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/mutex.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/mutex.o -MD -MP -MF $depbase.Tpo -c -o src/env/mutex.o ../src/env/mutex.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/once_flag.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/once_flag.o -MD -MP -MF $depbase.Tpo -c -o src/env/once_flag.o ../src/env/once_flag.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/thread.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/thread.o -MD -MP -MF $depbase.Tpo -c -o src/env/thread.o ../src/env/thread.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/thread_env.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/thread_env.o -MD -MP -MF $depbase.Tpo -c -o src/env/thread_env.o ../src/env/thread_env.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/_seh_top.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/_seh_top.o -MD -MP -MF $depbase.Tpo -c -o src/env/_seh_top.o ../src/env/_seh_top.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/env/_nt_timeout.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/env/_nt_timeout.o -MD -MP -MF $depbase.Tpo -c -o src/env/_nt_timeout.o ../src/env/_nt_timeout.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/ext/assert.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/ext/assert.o -MD -MP -MF $depbase.Tpo -c -o src/ext/assert.o ../src/ext/assert.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/ext/itow.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/ext/itow.o -MD -MP -MF $depbase.Tpo -c -o src/ext/itow.o ../src/ext/itow.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/ext/wcpcpy.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/ext/wcpcpy.o -MD -MP -MF $depbase.Tpo -c -o src/ext/wcpcpy.o ../src/ext/wcpcpy.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo src/dll_startup.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
i686-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -std=c11 -Wall -Wextra -pedantic -pedantic-errors -Wstrict-prototypes -Wconversion -Wsign-conversion -Wsuggest-attribute=noreturn -Wundef -Wshadow -Wwrite-strings -pipe -mfpmath=both -march=nocona -mno-stack-arg-probe -mno-accumulate-outgoing-args -mpush-args -masm=intel   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -MT src/dll_startup.o -MD -MP -MF $depbase.Tpo -c -o src/dll_startup.o ../src/dll_startup.c &&\
mv -f $depbase.Tpo $depbase.Po
i686-w64-mingw32-gcc  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4  -shared -static -nostdlib -Wl,-e@__MCFCRT_DllStartup,-subsystem,windows,--disable-runtime-pseudo-reloc,--disable-auto-import -Wl,--disable-stdcall-fixup,--enable-auto-image-base,--export-all-symbols,--out-implib,libmcfgthread.dll.a  -o mcfgthread-7.dll src/env/avl_tree.o src/env/bail.o src/env/clocks.o src/env/condition_variable.o src/env/gthread.o src/env/c11thread.o src/env/heap.o src/env/mutex.o src/env/once_flag.o src/env/thread.o src/env/thread_env.o src/env/_seh_top.o src/env/_nt_timeout.o src/ext/assert.o src/ext/itow.o src/ext/wcpcpy.o src/dll_startup.o -lkernel32 -lntdll 
src/env/gthread.o: In function `GthreadProc':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/gthread.c:109: undefined reference to `__gcc_personality_sj0'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/gthread.c:109: undefined reference to `_Unwind_SjLj_Register'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/gthread.c:150: undefined reference to `_Unwind_SjLj_Unregister'
src/env/gthread.o: In function `_MCFCRT_SehTopUninstaller_x86':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/_seh_top.h:30: undefined reference to `_Unwind_SjLj_Resume'
src/env/c11thread.o: In function `C11threadProc':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/c11thread.c:107: undefined reference to `__gcc_personality_sj0'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/c11thread.c:107: undefined reference to `_Unwind_SjLj_Register'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/c11thread.c:146: undefined reference to `_Unwind_SjLj_Unregister'
src/env/c11thread.o: In function `_MCFCRT_SehTopUninstaller_x86':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/_seh_top.h:30: undefined reference to `_Unwind_SjLj_Resume'
src/dll_startup.o: In function `@__MCFCRT_DllStartup':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/dll_startup.c:16: undefined reference to `__gcc_personality_sj0'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/dll_startup.c:16: undefined reference to `_Unwind_SjLj_Register'
src/dll_startup.o: In function `_MCFCRT_SehTopUninstaller_x86':
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/_seh_top.h:30: undefined reference to `_Unwind_SjLj_Unregister'
/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32/../src/env/_seh_top.h:30: undefined reference to `_Unwind_SjLj_Resume'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:579: mcfgthread-7.dll] Error 1
make[1]: Leaving directory '/home/xantares/projects/aur-scripts/mingw-w64-mcfgthread/src/mcfgthread-alpha-0.9/build-i686-w64-mingw32'
make: *** [Makefile:399: all] Error 2
lhmouse commented 8 years ago

Please remove -fexceptions.

xantares commented 8 years ago

thanks

lhmouse commented 8 years ago

Out of curiosity, why did you add it? Besides it isn't the first time that I have suggested people not use -fexceptions because it brings nothing (I am not exaggerating) but bugs.

xantares commented 8 years ago

it's enabled in the default flags of the mingw-configure script on archlinux which is in turn taken from fedora: https://fedoraproject.org/wiki/Packaging:MinGW?rd=Packaging/MinGW -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4 I don't know the rationale for enabling all these.

lhmouse commented 8 years ago

That is a nonsense flag. C code is usually not exception safe. Writing exception safe C code would require knowledge of stack unwinding which most C developers are unaware of, and as a result you only get bugs. C++ developers should not assume foreign code is exception safe no matter what language it is written in. Hence -fexceptions is valueless.

I would suggest you write to their maintainers to remove It from their pages. It is misleading.