Windows-on-ARM-Experiments / gcc-woarm64

Fork of gcc containing fixes for Windows on ARM64.
GNU General Public License v2.0
8 stars 1 forks source link

Unresolved "__gnu_cxx::zoneinfo_dir_override()" when linking libstdc++ as DLL. #24

Closed carlo-bramini closed 1 month ago

carlo-bramini commented 1 month ago

Hello, I updated the sources to the latest available. Next, I configured with these options under CYGWIN:

    --disable-multilib
    --disable-win32-registry
    --enable-languages=c,lto,c++
    --enable-fully-dynamic-string
    --enable-graphite
    --enable-libgomp
    --with-gnu-as --with-gnu-ld
    --with-system-zlib
    --enable-threads=win32
    --disable-nls
    --enable-shared
    --enable-static
    --enable-libstdcxx-filesystem-ts=yes
    --enable-libstdcxx-time=yes
    --enable-cloog-backend=isl
    --enable-version-specific-runtime-libs
    --enable-lto
    --enable-checking=release
    --disable-rpath
    --disable-werror
    --disable-symvers
    --disable-libstdcxx-pch
    --disable-libstdcxx-debug
    --disable-isl-version-check
    --disable-bootstrap
    --with-native-system-header-dir=/mingw/include
    --libexecdir=/usr/lib
    --enable-silent-rules

Here, I used --with-native-system-header-dir=/mingw/include according to the suggestion received into #17 and I can confirm that it allowed to bypass that issue. As you can see, there is not a --disable-shared option, so I expected a DLL to be built also for libstdc++. I had already done this experiment in the past and I got several errors about some unresolved external functions. However, I have seen that some commits have been made for solving them. In my last test, I can also confirm that errors on unresolved __gthr_win32_ and _Unwind_ functions are fixed. Unfortunately, it seems that there is still one unresolved reference in my build:

  GEN      libstdc++.la
libtool: link: rm -fr  .libs/libstdc++.dll.a
/usr/aarch64-w64-mingw32/bin/ld: ../src/c++20/.libs/libc++20convenience.a(tzdb.o):(.rdata$.refptr._ZN9__gnu_cxx21zoneinfo_dir_overrideEv[.refptr._ZN9__gnu_cxx21zoneinfo_dir_overrideEv]+0x0): undefined reference to `__gnu_cxx::zoneinfo_dir_override()'
collect2: error: ld returned 1 exit status

Perhaps, it was an already known problem, but since I have not found it into the list of the issues, I'm posting it here. If --disable-shared option is used, the whole build process completes successfully.

Blackhex commented 1 month ago

Hello. Thank you for reporting the issue. It's a known issue Windows-on-ARM-Experiments/mingw-woarm64-build#148 that [[gnu::weak]] is not implemented for the target (probably in binutils). You can build the toolchain with --enable-shared using the workaround patch mentioned in the issue.

Note that we are using https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/issues repo as the main one where is the complete list of the known issues.