Hi, On Thu, Jun 30, 2022 at 05:15:32PM +0200, Helmut Grohne wrote: > > > For libsanitizer, crypt.h is needed to determine the size of a struct, the > > > library itself is not needed. Moving it to the MA location makes it > > > unavailable for the non-multilib builds. > > Again, the lack of precision is not constructive. Linking to a failure > would help a lot here.
I now understand that the libsanitizer aspect is separate to the multilib aspect. Therefore, my proposed solution is a non-solution and adding multilib packages is a non-solution as well. It is way worse and completely messed up. A gcc build (cross compiler stage3 or native) requires a target architecture crypt.h. Trying to do without breaks libsanitizer (no multilib involved). Example from https://jenkins.debian.net/job/rebootstrap_ppc64_gcc12_nobiarch/5/consoleText | /bin/bash ../libtool --tag=CXX --mode=compile /tmp/buildd/gcc3/gcc-12-12.1.0/build/./gcc/xgcc -shared-libgcc -B/tmp/buildd/gcc3/gcc-12-12.1.0/build/./gcc -nostdinc++ -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/src -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/src/.libs -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/powerpc64-linux-gnu/bin/ -B/usr/powerpc64-linux-gnu/lib/ -isystem /usr/powerpc64-linux-gnu/include -isystem /usr/powerpc64-linux-gnu/sys-include -isystem /tmp/buildd/gcc3/gcc-12-12.1.0/build/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../src/libsanitizer/sanitizer_common -I.. -I ../../../../src/libsanitizer/include -I ../../../../src/libsanitizer -isystem ../../../../src/libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/powerpc64-linux-gnu -I../../../../src/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++14 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../src/libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../src/libsanitizer/../include -include ../../../../src/libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -D_GNU_SOURCE -MT sanitizer_platform_limits_posix.lo -MD -MP -MF .deps/sanitizer_platform_limits_posix.Tpo -c -o sanitizer_platform_limits_posix.lo ../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp | libtool: compile: /tmp/buildd/gcc3/gcc-12-12.1.0/build/./gcc/xgcc -shared-libgcc -B/tmp/buildd/gcc3/gcc-12-12.1.0/build/./gcc -nostdinc++ -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/src -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/src/.libs -L/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libstdc++-v3/libsupc++/.libs -B/usr/powerpc64-linux-gnu/bin/ -B/usr/powerpc64-linux-gnu/lib/ -isystem /usr/powerpc64-linux-gnu/include -isystem /usr/powerpc64-linux-gnu/sys-include -isystem /tmp/buildd/gcc3/gcc-12-12.1.0/build/sys-include -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I. -I../../../../src/libsanitizer/sanitizer_common -I.. -I ../../../../src/libsanitizer/include -I ../../../../src/libsanitizer -isystem ../../../../src/libsanitizer/include/system -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include -I../../libstdc++-v3/include/powerpc64-linux-gnu -I../../../../src/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++14 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I ../../../../src/libsanitizer/../libbacktrace -I ../libbacktrace -I ../../../../src/libsanitizer/../include -include ../../../../src/libsanitizer/libbacktrace/backtrace-rename.h -g -O2 -D_GNU_SOURCE -MT sanitizer_platform_limits_posix.lo -MD -MP -MF .deps/sanitizer_platform_limits_posix.Tpo -c ../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp -fPIC -DPIC -o .libs/sanitizer_platform_limits_posix.o | ../../../../src/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp:155:10: fatal error: crypt.h: No such file or directory | 155 | #include <crypt.h> | | ^~~~~~~~~ | compilation terminated. | make[6]: *** [Makefile:616: sanitizer_platform_limits_posix.lo] Error 1 | make[6]: Leaving directory '/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libsanitizer/sanitizer_common' | make[5]: *** [Makefile:533: all-recursive] Error 1 | make[5]: Leaving directory '/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libsanitizer' | make[4]: *** [Makefile:420: all] Error 2 | make[4]: Leaving directory '/tmp/buildd/gcc3/gcc-12-12.1.0/build/powerpc64-linux-gnu/libsanitizer' | make[3]: *** [Makefile:12936: all-target-libsanitizer] Error 2 | make[3]: Leaving directory '/tmp/buildd/gcc3/gcc-12-12.1.0/build' | make[2]: *** [Makefile:1049: all] Error 2 | make[2]: Leaving directory '/tmp/buildd/gcc3/gcc-12-12.1.0/build' | === TIME stamps/05-build-stamp === Given that crypt.h is architecture dependent, we'll have to build crypt.h with a stage1 compiler or no C compiler at all. This is going to be painful. I've checked that this is the only place in gcc-12 that uses crypt.h and that the only thing it uses is sizeof(struct crypt_data), which theoretically is architecture-dependent, but practically is not. This is why it has worked in the past. Note that this assumption was broken when we used musl's crypt.h instead of libxcrypt's. So in principle, we can stick to the workaround (multiarch only for libcrypt2), but it comes at a cost: * It encodes the assumption that sizeof(struct crypt_data) is architecture-independent into libcrypt-dev. * We will be unable to use any architecture that uses libcrypt2 as build architecture for cross bootstraps. In other words, we cannot bootstrap from musl. * We can only have architectures that get crypt.h from libxcrypt. In essence this is a cycle. gcc-12's libsanitizer requires crypt.h, which is built from libxcrypt, which requires a C compiler, which is built from gcc-12. It needs to be broken somehow - not least for native bootstraps. It's been like that all the time and we used to break is using the assumption that sizeof(struct crypt_data) is architecture-independent. The commit adding the crypt.h dependency is fairly recent: | commit 3ca75cd55030a53a858bdbe9aba6d87f6b1e90b8 | Author: Martin Liska <mli...@suse.cz> | Date: Tue Nov 5 14:54:57 2019 +0100 | | Libsanitizer: merge from trunk with merge.sh. | | 2019-11-05 Martin Liska <mli...@suse.cz> | | * all source files: Merge from upstream r375507. | | From-SVN: r277834 I failed to figure out the commit messages of those subversion revisions. Any idea how to fix this? The TL;DR seems to be that either gcc-12 needs to stop using crypt.h or we need a libxcrypt stage1 for building crypt.h or crypt.h needs to become architecture-independent. Short term, my workaround papers over the practical issues, but that's a no-brainer long-term. Helmut