mingw-w64-gcc 10.2.0 with sjlj fails to link: undefined reference to `_Unwind_SjLj_Register'
Ave Milia <avemilia-g/[email protected]> Thu, 17 Sep 2020 12:12:36 +0000
| Newsgroups | gmane.comp.gnu.mingw.user |
|---|---|
| Message-ID | <UQmDuOP54j7GSNV3nfP8O0I4nIhKEqPAeISdxj_DBprYARl3CZkA0wVK0FUjRi_h9I3zLUNkPWI5SmO5d0auwsA8gJMLmRI2oBq_3neHxik=@protonmail.com> |
Hello,
I am struggling to build mingw-w64-gcc on Manjaro Linux 20.1 with sjlj exceptions. This distribution uses very simple Arch Linux package rules by default [0], my modified version of the rules is here [1].
Why do I need sjlj? I am trying to cross-compile gnupg for Windows, which requires sjlj dll. The official Arch Linux package passes --disable-sjlj-exceptions to configure, so in my edit I do the opposite: pass --enable-sjlj-exceptions.
Since this didn't build, I looked at Debian rules [2] to see which flags they use for configure, because it is reported that on Debian buster the sjlj dll is present. I added --enable-dependency-tracking to my pkgbuild, thinking the error might be related to missing dependencies. I also removed all languages except c,lto,c++ to reduce compilation times: --enable-languages=c,lto,c++
So, my final line is (excerpt from attached pkgbuild):
mkdir -p "$srcdir"/build-${_arch} && cd "$srcdir"/build-${_arch}
"$srcdir"/gcc/configure --prefix=/usr --libexecdir=/usr/lib \
--target=${_arch} \
--with-bugurl=https://bugs.archlinux.org/ \
--enable-languages=c,lto,c++ \
--enable-shared --enable-static \
--enable-threads=posix --enable-fully-dynamic-string \
--enable-libstdcxx-time=yes --enable-libstdcxx-filesystem-ts=yes \
--with-system-zlib --enable-cloog-backend=isl \
--enable-lto --enable-libgomp \
--disable-multilib --enable-checking=release \
--enable-sjlj-exceptions --with-dwarf3 --enable-dependency-tracking
make
This did not build either. Full build log is here [3]. The repeated occurrence of "undefined reference to `_Unwind_SjLj_Register'" starts on line 4950. Here is an excerpt from the log at that line:
libtool: link: /home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/./gcc/xgcc -shared-libgcc -B/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/./gcc -nostdinc++ -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/src -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/src/.libs -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/libsupc++/.libs -L/usr/i686-w64-mingw32/lib -L/usr/mingw/lib -isystem /usr/i686-w64-mingw32/include -isystem /usr/mingw/include -B/usr/i686-w64-mingw32/bin/ -B/usr/i686-w64-mingw32/lib/ -isystem /usr/i686-w64-mingw32/include -isystem /usr/i686-w64-mingw32/sys-include -shared -nostdlib /usr/i686-w64-mingw32/lib/dllcrt2.o /home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/./gcc/crtbegin.o .libs/compatibility.o .libs/compatibility-debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o .libs/compatibility-condvar.o -Wl,--whole-archive ../libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/libc++11convenience.a ../src/c++17/.libs/libc++17convenience.a -Wl,--no-whole-archive -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/libsupc++/.libs -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/src -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/i686-w64-mingw32/libstdc++-v3/src/.libs -L/usr/i686-w64-mingw32/lib -L/usr/mingw/lib -L/home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/./gcc -L/usr/i686-w64-mingw32/bin -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /home/ave/.local/soft/mingw-w64-gcc/src/build-i686-w64-mingw32/./gcc/crtend.o -Wl,-O1 -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver -o .libs/libstdc++-6.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libstdc++.dll.a
/usr/i686-w64-mingw32/bin/ld: ../src/c++11/.libs/libc++11convenience.a(cow-stdexcept.o): in function `ZNSt11logic_errorC2ERKS_':
/home/ave/.local/soft/mingw-w64-gcc/src/gcc/libstdc++-v3/src/c++11/cow-stdexcept.cc:63: undefined reference to `_Unwind_SjLj_Register'
Any ideas on how to fix the build?
[0]: <https://github.com/archlinux/svntogit-community/blob/267a55adf91802a33ae6d5ab94cb4b99a8b60b58/trunk/PKGBUILD>
[1]: <https://gist.githubusercontent.com/avemilia/f3cabe65386d95b996353019ac8600cf/raw/99783f73a697c17f9936c5eafea5adc201a0e14f/PKGBUILD>
[2]: <https://salsa.debian.org/mingw-w64-team/gcc-mingw-w64/-/blob/3bd7d45a02f0105b4c3d49371e6b36cf108f57ea/debian/rules>
[3]: <https://gist.githubusercontent.com/avemilia/f3cabe65386d95b996353019ac8600cf/raw/99783f73a697c17f9936c5eafea5adc201a0e14f/mingw-w64-gcc-10.2.0-1-x86_64-build.log.1>
_______________________________________________
MinGW-Users mailing list
[email protected]
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated.
_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe