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 >> >>