* Building a host-isolated gcc without faking cross-compiling @ 2021-09-10 16:54 Anthony de Almeida Lopes 2021-09-10 17:46 ` Lance Fredrickson 0 siblings, 1 reply; 7+ messages in thread From: Anthony de Almeida Lopes @ 2021-09-10 16:54 UTC (permalink / raw) To: gcc-help I'd like to build gcc for a chroot on my current system. Linux From Scratch uses a method of faking a cross compiler by modifying the vendor field of the target string. For example, changing x86_64-pc-linux-gnu to x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding this. While GCC builds fine for my host natively and it builds fine with the LFS method, I have so far been unable to build a host isolated copy any other way. I understand the recommended order is to build binutils and gcc first, then build glibc with them and finally rebuild gcc against that glibc. # I built binutils like this ../configure \ --prefix=$DISTRO/root/bootstrap \ --with-sysroot=$DISTRO \ --disable-nls \ --disable-werror && make -j6 && make -j1 install # Then I tried to build gcc like this ../configure \ --prefix=$DISTRO/tools \ --with-glibc-version=2.11 \ --with-sysroot=$DISTRO \ --with-newlib \ --without-headers \ --enable-initfini-array \ --disable-nls \ --disable-shared \ --disable-multilib \ --disable-decimal-float \ --disable-threads \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++ && make -j6 && make -j1 install But this fails with a bunch of undefined references to the ZSTD namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume this means that ./configure has detected that my host system has libzstd but it's trying to look for them in the sysroot, where it obviously can't find them. This happens even if I use --disable-lto. Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1, gcc 11.1.0 Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0 So I'd like to know if I should continue like this, and if so how, or if there is a better (maybe canonical) way of building a host-isolated compiler? - Anthony ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-10 16:54 Building a host-isolated gcc without faking cross-compiling Anthony de Almeida Lopes @ 2021-09-10 17:46 ` Lance Fredrickson 2021-09-10 18:21 ` Anthony de Almeida Lopes 0 siblings, 1 reply; 7+ messages in thread From: Lance Fredrickson @ 2021-09-10 17:46 UTC (permalink / raw) To: gcc-help I think you probably want |--with-native-system-header-dir | |--with-native-system-header-dir=dirname| Specifies thatdirnameis the directory that contains native system header files, rather than/usr/include. This option is most useful if you are creating a compiler that should be isolated from the system as much as possible. It is most commonly used with the--with-sysrootoption and will cause GCC to searchdirnameinside the system root specified by that option. Lance On 9/10/2021 10:54 AM, Anthony de Almeida Lopes via Gcc-help wrote: > I'd like to build gcc for a chroot on my current system. Linux From > Scratch uses a method of faking a cross compiler by modifying the vendor > field of the target string. For example, changing x86_64-pc-linux-gnu to > x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding > this. While GCC builds fine for my host natively and it builds fine with > the LFS method, I have so far been unable to build a host isolated copy > any other way. > > I understand the recommended order is to build binutils and gcc first, > then build glibc with them and finally rebuild gcc against that glibc. > > # I built binutils like this > > ../configure \ > --prefix=$DISTRO/root/bootstrap \ > --with-sysroot=$DISTRO \ > --disable-nls \ > --disable-werror > > && make -j6 && make -j1 install > > # Then I tried to build gcc like this > > ../configure \ > --prefix=$DISTRO/tools \ > --with-glibc-version=2.11 \ > --with-sysroot=$DISTRO \ > --with-newlib \ > --without-headers \ > --enable-initfini-array \ > --disable-nls \ > --disable-shared \ > --disable-multilib \ > --disable-decimal-float \ > --disable-threads \ > --disable-libatomic \ > --disable-libgomp \ > --disable-libquadmath \ > --disable-libssp \ > --disable-libvtv \ > --disable-libstdcxx \ > --enable-languages=c,c++ > > && make -j6 && make -j1 install > > But this fails with a bunch of undefined references to the ZSTD > namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume > this means that ./configure has detected that my host system has libzstd > but it's trying to look for them in the sysroot, where it obviously > can't find them. This happens even if I use --disable-lto. > > Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1, > gcc 11.1.0 > Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0 > > So I'd like to know if I should continue like this, and if so how, or if > there is a better (maybe canonical) way of building a host-isolated > compiler? > > - Anthony > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-10 17:46 ` Lance Fredrickson @ 2021-09-10 18:21 ` Anthony de Almeida Lopes 2021-09-10 18:42 ` Lance Fredrickson 0 siblings, 1 reply; 7+ messages in thread From: Anthony de Almeida Lopes @ 2021-09-10 18:21 UTC (permalink / raw) To: gcc-help Thanks, I missed that, but it doesn't seem to help. I still get the undefined references to ZSTD API calls. g++ -std=c++11 -no-pie -g -O2 -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o cc1plus \ cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o i386-c.o glibc-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcody/libcody.a \ libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./gmp/.libs -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpfr/src/.libs -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl -L./../zlib -lz /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:135: undefined reference to `ZSTD_compressBound' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_compression_zstd': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:138: undefined reference to `ZSTD_compress' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:141: undefined reference to `ZSTD_isError' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: undefined reference to `ZSTD_maxCLevel' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_normalized_zstd_level': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: undefined reference to `ZSTD_maxCLevel' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_compression_zstd': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: undefined reference to `ZSTD_getErrorName' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_end_uncompression(lto_compression_stream*, lto_compression)lto-compress.o': : in function `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: undefined reference to `lto_end_compression(lto_compression_stream*)ZSTD_getFrameContentSize': ' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto-compress.o: in function `135lto_uncompression_zstd: undefined reference to `': ZSTD_compressBound/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' 168: undefined reference to `ZSTD_decompress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' : /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ldlto-compress.o: : in function `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto_compression_zstd170': : undefined reference to `ZSTD_isError/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' 138: undefined reference to `ZSTD_compress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' : /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: 171/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: undefined reference to `141ZSTD_getErrorName: undefined reference to `' ZSTD_isError' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: undefined reference to `ZSTD_maxCLevel' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_normalized_zstd_level': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: undefined reference to `ZSTD_maxCLevel' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_compression_zstd': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: undefined reference to `ZSTD_getErrorName' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_end_uncompression(lto_compression_stream*, lto_compression)': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: undefined reference to `ZSTD_getFrameContentSize' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: lto-compress.o: in function `lto_uncompression_zstd': /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:168: undefined reference to `ZSTD_decompress' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:170: undefined reference to `ZSTD_isError' /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:171: undefined reference to `ZSTD_getErrorName' collect2: error: ld returned 1 exit status make[3]: *** [../../gcc/c/Make-lang.in:87: cc1] Error 1 make[3]: *** Waiting for unfinished jobs.... collect2: error: ld returned 1 exit status make[3]: *** [../../gcc/cp/Make-lang.in:136: cc1plus] Error 1 On 9/10/21 7:46 PM, Lance Fredrickson via Gcc-help wrote: > I think you probably want |--with-native-system-header-dir > > | > |--with-native-system-header-dir=dirname| > > Specifies thatdirnameis the directory that contains native system > header files, rather than/usr/include. This option is most useful if > you are creating a compiler that should be isolated from the system > as much as possible. It is most commonly used with > the--with-sysrootoption and will cause GCC to searchdirnameinside > the system root specified by that option. > > Lance > > On 9/10/2021 10:54 AM, Anthony de Almeida Lopes via Gcc-help wrote: >> I'd like to build gcc for a chroot on my current system. Linux From >> Scratch uses a method of faking a cross compiler by modifying the vendor >> field of the target string. For example, changing x86_64-pc-linux-gnu to >> x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding >> this. While GCC builds fine for my host natively and it builds fine with >> the LFS method, I have so far been unable to build a host isolated copy >> any other way. >> >> I understand the recommended order is to build binutils and gcc first, >> then build glibc with them and finally rebuild gcc against that glibc. >> >> # I built binutils like this >> >> ../configure \ >> --prefix=$DISTRO/root/bootstrap \ >> --with-sysroot=$DISTRO \ >> --disable-nls \ >> --disable-werror >> >> && make -j6 && make -j1 install >> >> # Then I tried to build gcc like this >> >> ../configure \ >> --prefix=$DISTRO/tools \ >> --with-glibc-version=2.11 \ >> --with-sysroot=$DISTRO \ >> --with-newlib \ >> --without-headers \ >> --enable-initfini-array \ >> --disable-nls \ >> --disable-shared \ >> --disable-multilib \ >> --disable-decimal-float \ >> --disable-threads \ >> --disable-libatomic \ >> --disable-libgomp \ >> --disable-libquadmath \ >> --disable-libssp \ >> --disable-libvtv \ >> --disable-libstdcxx \ >> --enable-languages=c,c++ >> >> && make -j6 && make -j1 install >> >> But this fails with a bunch of undefined references to the ZSTD >> namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume >> this means that ./configure has detected that my host system has libzstd >> but it's trying to look for them in the sysroot, where it obviously >> can't find them. This happens even if I use --disable-lto. >> >> Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1, >> gcc 11.1.0 >> Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0 >> >> So I'd like to know if I should continue like this, and if so how, or if >> there is a better (maybe canonical) way of building a host-isolated >> compiler? >> >> - Anthony >> >> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-10 18:21 ` Anthony de Almeida Lopes @ 2021-09-10 18:42 ` Lance Fredrickson 2021-09-11 4:55 ` Anthony de Almeida Lopes 0 siblings, 1 reply; 7+ messages in thread From: Lance Fredrickson @ 2021-09-10 18:42 UTC (permalink / raw) To: gcc-help Hmmm, well you can also try --without-zstd. There was a commit last year to ensure this flags is respected. commit 0fb0240a051df91d3c24385d1d3c17548b266544 Author: Martin Liska <mliska@suse.cz> Date: Wed Mar 25 11:01:43 2020 +0100 Fix handling of --with{,out}-zstd option. PR lto/94259 * configure.ac: Respect --without-zstd and report error when we can't find header file with --with-zstd. * configure: Regenerate. Lance On 9/10/2021 12:21 PM, Anthony de Almeida Lopes via Gcc-help wrote: > Thanks, I missed that, but it doesn't seem to help. I still get the > undefined references to ZSTD API calls. > > g++ -std=c++11 -no-pie -g -O2 -DIN_GCC -fno-exceptions -fno-rtti > -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings > -Wcast-qual -Wno-error=format-diag -Wno-format > -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long > -Wno-variadic-macros -Wno-overlength-strings -fno-common > -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o cc1plus \ > cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o > cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o > cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o > cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o > cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o > cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o > cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o > cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o > cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o > c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o > c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o > c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o > c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o > c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o > c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o > c-family/c-spellcheck.o i386-c.o glibc-c.o cc1plus-checksum.o > libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a > ../libdecnumber/libdecnumber.a ../libcody/libcody.a \ > libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a > ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a > -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./gmp/.libs > -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpfr/src/.libs > -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpc/src/.libs > -lmpc -lmpfr -lgmp -rdynamic -ldl -L./../zlib -lz > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:135: > undefined reference to `ZSTD_compressBound' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_compression_zstd': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:138: > undefined reference to `ZSTD_compress' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:141: > undefined reference to `ZSTD_isError' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: > undefined reference to `ZSTD_maxCLevel' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_normalized_zstd_level': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: > undefined reference to `ZSTD_maxCLevel' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_compression_zstd': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: > undefined reference to `ZSTD_getErrorName' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function > `lto_end_uncompression(lto_compression_stream*, > lto_compression)lto-compress.o': > : in function > `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: > undefined reference to > `lto_end_compression(lto_compression_stream*)ZSTD_getFrameContentSize': > ' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto-compress.o: > in function `135lto_uncompression_zstd: undefined reference to `': > ZSTD_compressBound/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' > 168: undefined reference to > `ZSTD_decompress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' > : > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ldlto-compress.o: > : in function > `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto_compression_zstd170': > : undefined reference to > `ZSTD_isError/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' > 138: undefined reference to > `ZSTD_compress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' > : > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: > 171/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: > undefined reference to `141ZSTD_getErrorName: undefined reference to `' > ZSTD_isError' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: > undefined reference to `ZSTD_maxCLevel' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_normalized_zstd_level': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: > undefined reference to `ZSTD_maxCLevel' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_compression_zstd': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: > undefined reference to `ZSTD_getErrorName' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function > `lto_end_uncompression(lto_compression_stream*, lto_compression)': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: > undefined reference to `ZSTD_getFrameContentSize' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > lto-compress.o: in function `lto_uncompression_zstd': > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:168: > undefined reference to `ZSTD_decompress' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:170: > undefined reference to `ZSTD_isError' > /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: > /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:171: > undefined reference to `ZSTD_getErrorName' > collect2: error: ld returned 1 exit status > make[3]: *** [../../gcc/c/Make-lang.in:87: cc1] Error 1 > make[3]: *** Waiting for unfinished jobs.... > collect2: error: ld returned 1 exit status > make[3]: *** [../../gcc/cp/Make-lang.in:136: cc1plus] Error 1 > > On 9/10/21 7:46 PM, Lance Fredrickson via Gcc-help wrote: >> I think you probably want |--with-native-system-header-dir >> >> | >> |--with-native-system-header-dir=dirname| >> >> Specifies thatdirnameis the directory that contains native system >> header files, rather than/usr/include. This option is most useful if >> you are creating a compiler that should be isolated from the system >> as much as possible. It is most commonly used with >> the--with-sysrootoption and will cause GCC to searchdirnameinside >> the system root specified by that option. >> >> Lance >> >> On 9/10/2021 10:54 AM, Anthony de Almeida Lopes via Gcc-help wrote: >>> I'd like to build gcc for a chroot on my current system. Linux From >>> Scratch uses a method of faking a cross compiler by modifying the vendor >>> field of the target string. For example, changing x86_64-pc-linux-gnu to >>> x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding >>> this. While GCC builds fine for my host natively and it builds fine with >>> the LFS method, I have so far been unable to build a host isolated copy >>> any other way. >>> >>> I understand the recommended order is to build binutils and gcc first, >>> then build glibc with them and finally rebuild gcc against that glibc. >>> >>> # I built binutils like this >>> >>> ../configure \ >>> --prefix=$DISTRO/root/bootstrap \ >>> --with-sysroot=$DISTRO \ >>> --disable-nls \ >>> --disable-werror >>> >>> && make -j6 && make -j1 install >>> >>> # Then I tried to build gcc like this >>> >>> ../configure \ >>> --prefix=$DISTRO/tools \ >>> --with-glibc-version=2.11 \ >>> --with-sysroot=$DISTRO \ >>> --with-newlib \ >>> --without-headers \ >>> --enable-initfini-array \ >>> --disable-nls \ >>> --disable-shared \ >>> --disable-multilib \ >>> --disable-decimal-float \ >>> --disable-threads \ >>> --disable-libatomic \ >>> --disable-libgomp \ >>> --disable-libquadmath \ >>> --disable-libssp \ >>> --disable-libvtv \ >>> --disable-libstdcxx \ >>> --enable-languages=c,c++ >>> >>> && make -j6 && make -j1 install >>> >>> But this fails with a bunch of undefined references to the ZSTD >>> namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume >>> this means that ./configure has detected that my host system has libzstd >>> but it's trying to look for them in the sysroot, where it obviously >>> can't find them. This happens even if I use --disable-lto. >>> >>> Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1, >>> gcc 11.1.0 >>> Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0 >>> >>> So I'd like to know if I should continue like this, and if so how, or if >>> there is a better (maybe canonical) way of building a host-isolated >>> compiler? >>> >>> - Anthony >>> >>> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-10 18:42 ` Lance Fredrickson @ 2021-09-11 4:55 ` Anthony de Almeida Lopes 2021-09-11 8:32 ` Xi Ruoyao 0 siblings, 1 reply; 7+ messages in thread From: Anthony de Almeida Lopes @ 2021-09-11 4:55 UTC (permalink / raw) To: gcc-help Alright, progress. I'm still researching the next problems that I ran into but I thought I'd post an update. First, I ran into GCC_NO_EXECUTABLES while the build was in configure-stage2-zlib and in anticipating what Lance might say to that, I checked and there doesn't seem to be a --without-zlib although I did test that just in case and it did nothing. The best explanation for what GCC_NO_EXECUTABLES is that I found so far is in a post to the list about a similar problem: https://gcc.gnu.org/legacy-ml/gcc/2008-03/msg00515.html I went ahead and built it anyway with --disable-bootstrap. glibc compiled but not too surprisingly running ldd or /usr/lib/libc.so.6 with LD_LIBRARY_PATH to $DISTRO/usr/lib just segfaults, so it seems like it wasn't really a sane build of gcc after all. Ignoring that problem, configuring libstdc++-v3 after having glibc fails which is kind of obvious since the host glibc differs in version from the target version. You know, the typical "version `GLIBC_2.34' not found" errors. This seems like a proper motivating reason for using the fake cross-compiling trick but I'm determined to figure out if there's a way around that. ../configure \ --prefix=$DISTRO/root/bootstrap \ --with-glibc-version=2.11 \ --with-sysroot=$DISTRO \ --with-native-system-header-dir=$DISTRO/usr/include \ --without-zstd \ --with-newlib \ --without-headers \ --enable-initfini-array \ --disable-nls \ --disable-shared \ --disable-multilib \ --disable-decimal-float \ --disable-threads \ --disable-libatomic \ --disable-libgomp \ --disable-libquadmath \ --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ --enable-languages=c,c++ .... checking whether the /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./prev-gcc/xgcc -B/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./prev-gcc/ -B/home/guerrilla/Projects/Boots/distro/root/bootstrap/x86_64-pc-linux-gnu/bin/ -B/home/guerrilla/Projects/Boots/distro/root/bootstrap/x86_64-pc-linux-gnu/bin/ -B/home/guerrilla/Projects/Boots/distro/root/bootstrap/x86_64-pc-linux-gnu/lib/ -isystem /home/guerrilla/Projects/Boots/distro/root/bootstrap/x86_64-pc-linux-gnu/include -isystem /home/guerrilla/Projects/Boots/distro/root/bootstrap/x86_64-pc-linux-gnu/sys-include -fno-checking linker (ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. make[2]: *** [Makefile:16252: configure-stage2-zlib] Error 1 yes checking for an ANSI C-conforming const... yes checking for inline... inline checking whether byte ordering is bigendian... no checking for a BSD-compatible install... /usr/bin/install -c checking for CET support... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES. make[2]: *** [Makefile:14566: configure-stage2-libiberty] Error 1 make[2]: Leaving directory '/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build' make[1]: *** [Makefile:23471: stage2-bubble] Error 2 make[1]: Leaving directory '/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build' make: *** [Makefile:954: all] Error 2 On 9/10/21 8:42 PM, Lance Fredrickson via Gcc-help wrote: > Hmmm, well you can also try --without-zstd. There was a commit last > year to ensure this flags is respected. > > commit 0fb0240a051df91d3c24385d1d3c17548b266544 > Author: Martin Liska <mliska@suse.cz> > Date: Wed Mar 25 11:01:43 2020 +0100 > > Fix handling of --with{,out}-zstd option. > > PR lto/94259 > * configure.ac: Respect --without-zstd and report > error when we can't find header file with --with-zstd. > * configure: Regenerate. > > Lance > > On 9/10/2021 12:21 PM, Anthony de Almeida Lopes via Gcc-help wrote: >> Thanks, I missed that, but it doesn't seem to help. I still get the >> undefined references to ZSTD API calls. >> >> g++ -std=c++11 -no-pie -g -O2 -DIN_GCC -fno-exceptions -fno-rtti >> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings >> -Wcast-qual -Wno-error=format-diag -Wno-format >> -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long >> -Wno-variadic-macros -Wno-overlength-strings -fno-common >> -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o cc1plus \ >> cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o >> cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o >> cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o >> cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o >> cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o >> cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o >> cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o >> cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o >> cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o >> c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o >> c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o >> c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o >> c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o >> c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o >> c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o >> c-family/c-spellcheck.o i386-c.o glibc-c.o cc1plus-checksum.o >> libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a >> ../libdecnumber/libdecnumber.a ../libcody/libcody.a \ >> libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a >> ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a >> -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./gmp/.libs >> -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpfr/src/.libs >> -L/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/./mpc/src/.libs >> -lmpc -lmpfr -lgmp -rdynamic -ldl -L./../zlib -lz >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:135: >> undefined reference to `ZSTD_compressBound' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_compression_zstd': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:138: >> undefined reference to `ZSTD_compress' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:141: >> undefined reference to `ZSTD_isError' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: >> undefined reference to `ZSTD_maxCLevel' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_normalized_zstd_level': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: >> undefined reference to `ZSTD_maxCLevel' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_compression_zstd': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: >> undefined reference to `ZSTD_getErrorName' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function >> `lto_end_uncompression(lto_compression_stream*, >> lto_compression)lto-compress.o': >> : in function >> `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: >> undefined reference to >> `lto_end_compression(lto_compression_stream*)ZSTD_getFrameContentSize': >> ' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto-compress.o: >> in function `135lto_uncompression_zstd: undefined reference to `': >> ZSTD_compressBound/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' >> 168: undefined reference to >> `ZSTD_decompress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' >> : >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ldlto-compress.o: >> : in function >> `/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:lto_compression_zstd170': >> : undefined reference to >> `ZSTD_isError/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:' >> 138: undefined reference to >> `ZSTD_compress/home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld' >> : >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: >> 171/home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:: >> undefined reference to `141ZSTD_getErrorName: undefined reference to `' >> ZSTD_isError' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_end_compression(lto_compression_stream*)': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:120: >> undefined reference to `ZSTD_maxCLevel' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_normalized_zstd_level': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:121: >> undefined reference to `ZSTD_maxCLevel' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_compression_zstd': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:142: >> undefined reference to `ZSTD_getErrorName' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function >> `lto_end_uncompression(lto_compression_stream*, lto_compression)': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:161: >> undefined reference to `ZSTD_getFrameContentSize' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> lto-compress.o: in function `lto_uncompression_zstd': >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:168: >> undefined reference to `ZSTD_decompress' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:170: >> undefined reference to `ZSTD_isError' >> /home/guerrilla/Projects/Boots/distro/root/bootstrap/bin/ld: >> /home/guerrilla/Projects/Boots/src/gcc-11.2.0/build/gcc/../../gcc/lto-compress.c:171: >> undefined reference to `ZSTD_getErrorName' >> collect2: error: ld returned 1 exit status >> make[3]: *** [../../gcc/c/Make-lang.in:87: cc1] Error 1 >> make[3]: *** Waiting for unfinished jobs.... >> collect2: error: ld returned 1 exit status >> make[3]: *** [../../gcc/cp/Make-lang.in:136: cc1plus] Error 1 >> >> On 9/10/21 7:46 PM, Lance Fredrickson via Gcc-help wrote: >>> I think you probably want |--with-native-system-header-dir >>> >>> | >>> |--with-native-system-header-dir=dirname| >>> >>> Specifies thatdirnameis the directory that contains native system >>> header files, rather than/usr/include. This option is most useful if >>> you are creating a compiler that should be isolated from the system >>> as much as possible. It is most commonly used with >>> the--with-sysrootoption and will cause GCC to searchdirnameinside >>> the system root specified by that option. >>> >>> Lance >>> >>> On 9/10/2021 10:54 AM, Anthony de Almeida Lopes via Gcc-help wrote: >>>> I'd like to build gcc for a chroot on my current system. Linux From >>>> Scratch uses a method of faking a cross compiler by modifying the vendor >>>> field of the target string. For example, changing x86_64-pc-linux-gnu to >>>> x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding >>>> this. While GCC builds fine for my host natively and it builds fine with >>>> the LFS method, I have so far been unable to build a host isolated copy >>>> any other way. >>>> >>>> I understand the recommended order is to build binutils and gcc first, >>>> then build glibc with them and finally rebuild gcc against that glibc. >>>> >>>> # I built binutils like this >>>> >>>> ../configure \ >>>> --prefix=$DISTRO/root/bootstrap \ >>>> --with-sysroot=$DISTRO \ >>>> --disable-nls \ >>>> --disable-werror >>>> >>>> && make -j6 && make -j1 install >>>> >>>> # Then I tried to build gcc like this >>>> >>>> ../configure \ >>>> --prefix=$DISTRO/tools \ >>>> --with-glibc-version=2.11 \ >>>> --with-sysroot=$DISTRO \ >>>> --with-newlib \ >>>> --without-headers \ >>>> --enable-initfini-array \ >>>> --disable-nls \ >>>> --disable-shared \ >>>> --disable-multilib \ >>>> --disable-decimal-float \ >>>> --disable-threads \ >>>> --disable-libatomic \ >>>> --disable-libgomp \ >>>> --disable-libquadmath \ >>>> --disable-libssp \ >>>> --disable-libvtv \ >>>> --disable-libstdcxx \ >>>> --enable-languages=c,c++ >>>> >>>> && make -j6 && make -j1 install >>>> >>>> But this fails with a bunch of undefined references to the ZSTD >>>> namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume >>>> this means that ./configure has detected that my host system has libzstd >>>> but it's trying to look for them in the sysroot, where it obviously >>>> can't find them. This happens even if I use --disable-lto. >>>> >>>> Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1, >>>> gcc 11.1.0 >>>> Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0 >>>> >>>> So I'd like to know if I should continue like this, and if so how, or if >>>> there is a better (maybe canonical) way of building a host-isolated >>>> compiler? >>>> >>>> - Anthony >>>> >>>> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-11 4:55 ` Anthony de Almeida Lopes @ 2021-09-11 8:32 ` Xi Ruoyao 2021-09-13 14:06 ` Anthony de Almeida Lopes 0 siblings, 1 reply; 7+ messages in thread From: Xi Ruoyao @ 2021-09-11 8:32 UTC (permalink / raw) To: Anthony de Almeida Lopes, gcc-help On Sat, 2021-09-11 at 04:55 +0000, Anthony de Almeida Lopes via Gcc-help wrote: > Alright, progress. I'm still researching the next problems that I ran > into but I thought I'd post an update. First, I ran into > GCC_NO_EXECUTABLES while the build was in configure-stage2-zlib and in > anticipating what Lance might say to that, I checked and there doesn't > seem to be a --without-zlib although I did test that just in case and > it > did nothing. The best explanation for what GCC_NO_EXECUTABLES is that > I > found so far is in a post to the list about a similar problem: > > https://gcc.gnu.org/legacy-ml/gcc/2008-03/msg00515.html > > I went ahead and built it anyway with --disable-bootstrap. glibc > compiled but not too surprisingly running ldd or /usr/lib/libc.so.6 > with > LD_LIBRARY_PATH to $DISTRO/usr/lib just segfaults, so it seems like it > wasn't really a sane build of gcc after all. > > Ignoring that problem, configuring libstdc++-v3 after having glibc > fails > which is kind of obvious since the host glibc differs in version from > the target version. You know, the typical "version `GLIBC_2.34' not > found" errors. This seems like a proper motivating reason for using > the > fake cross-compiling trick but I'm determined to figure out if there's > a > way around that. As a LFS editor (and I also have several commits in GCC) I'd say there is no rational way for this, expect cross-compilation. Maybe you can use a dozen of switches to accomplish the object, but at last it will be almost equivelent to run a cross-compilation. -- Xi Ruoyao <xry111@mengyan1223.wang> School of Aerospace Science and Technology, Xidian University ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Building a host-isolated gcc without faking cross-compiling 2021-09-11 8:32 ` Xi Ruoyao @ 2021-09-13 14:06 ` Anthony de Almeida Lopes 0 siblings, 0 replies; 7+ messages in thread From: Anthony de Almeida Lopes @ 2021-09-13 14:06 UTC (permalink / raw) To: Xi Ruoyao, gcc-help Alright, fair enough, I surrender. I did end up solving the GCC_NO_EXECUTABLE in a better way by just including zlib in the source tree. I found the solution in this[1] bug report from libdragon. Then the reason things were crashing was my own fault: I incorrectly assumed setting LD_LIBRARY_PATH would set the dynamic linker but it doesn't do that. Running programs directly with the dynamic linker (like `usr/lib/ld-linux-x86-64.so.2 usr/bin/ls`) works fine. 1. https://github.com/DragonMinded/libdragon/issues/22 - Anthony On 9/11/21 10:32 AM, Xi Ruoyao wrote: > On Sat, 2021-09-11 at 04:55 +0000, Anthony de Almeida Lopes via Gcc-help > wrote: >> Alright, progress. I'm still researching the next problems that I ran >> into but I thought I'd post an update. First, I ran into >> GCC_NO_EXECUTABLES while the build was in configure-stage2-zlib and in >> anticipating what Lance might say to that, I checked and there doesn't >> seem to be a --without-zlib although I did test that just in case and >> it >> did nothing. The best explanation for what GCC_NO_EXECUTABLES is that >> I >> found so far is in a post to the list about a similar problem: >> >> https://gcc.gnu.org/legacy-ml/gcc/2008-03/msg00515.html >> >> I went ahead and built it anyway with --disable-bootstrap. glibc >> compiled but not too surprisingly running ldd or /usr/lib/libc.so.6 >> with >> LD_LIBRARY_PATH to $DISTRO/usr/lib just segfaults, so it seems like it >> wasn't really a sane build of gcc after all. >> >> Ignoring that problem, configuring libstdc++-v3 after having glibc >> fails >> which is kind of obvious since the host glibc differs in version from >> the target version. You know, the typical "version `GLIBC_2.34' not >> found" errors. This seems like a proper motivating reason for using >> the >> fake cross-compiling trick but I'm determined to figure out if there's >> a >> way around that. > As a LFS editor (and I also have several commits in GCC) I'd say there > is no rational way for this, expect cross-compilation. Maybe you can > use a dozen of switches to accomplish the object, but at last it will be > almost equivelent to run a cross-compilation. > -- > Xi Ruoyao <xry111@mengyan1223.wang> > School of Aerospace Science and Technology, Xidian University > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-13 14:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-10 16:54 Building a host-isolated gcc without faking cross-compiling Anthony de Almeida Lopes 2021-09-10 17:46 ` Lance Fredrickson 2021-09-10 18:21 ` Anthony de Almeida Lopes 2021-09-10 18:42 ` Lance Fredrickson 2021-09-11 4:55 ` Anthony de Almeida Lopes 2021-09-11 8:32 ` Xi Ruoyao 2021-09-13 14:06 ` Anthony de Almeida Lopes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).