On Mon, 18 Feb 2019 at 05:37, Dennis Clarke <dclarke@xxxxxxxxxxxxx> wrote: > > On 2/17/19 10:03 PM, Jonathan Wakely wrote: > > On Sun, 17 Feb 2019 at 06:47, Dennis Clarke <dclarke@xxxxxxxxxxxxx> wrote: > >> I even built libgmp and libmpfr and libmpc with that cross compiler > >> tool set and dropped the results into the target RISC-V boxen > >> rootfs /usr/local/lib area : > > > > ... why? > > Let's set that aside as a moot point wherein we all know that they > should be in the tree. Easy to put them back in : > > vesta_$ cd ../gcc-8.2.0 > vesta_$ bzip2 -dc ../../src/gmp-6.1.2.tar.bz2 | tar -xf - > vesta_$ gzip -dc ../../src/mpfr-4.0.2.tar.gz | tar -xf - > vesta_$ gzip -dc ../../src/mpc-1.1.0.tar.gz | tar -xf - > vesta_$ ln -s ./gmp-6.1.2 ./gmp > vesta_$ ln -s ./mpfr-4.0.2 ./mpfr > vesta_$ ln -s ./mpc-1.1.0 ./mpc > vesta_$ Yes, this is what I'd expect to work. And don't use --with-gmp, --with-mpc, --with-mpfr and LD_LIBRARY_PATH at all. > However if I do setup LD_LIBRARY_PATH to point into the target sysroot Wait, what? Why would you do that? The GCC you're building is a cross compiler, it doesn't run on the target, so it can't use target libraries. > then everything fails real real fast with : > > vesta_$ > LD_LIBRARY_PATH=/riscv64/rootfs/usr/local/lib:/riscv64/rootfs/usr/lib:/riscv64/rootfs/lib:/usr/local/lib > vesta_$ export LD_LIBRARY_PATH > vesta_$ > > then try configure and ka-boom : > > ld-elf.so.1: /riscv64/rootfs/lib/libc.so.7: unsupported machine > > So that isn't helping. Of course not. If you have them in-tree then you don't need to use LD_LIBRARY_PATH to find them at all, CERTAINLY not to find the ones built for the target architecture. As I said, the host binaries use them. > If I try to point to only the libs in the target /usr/local/lib then : > > vesta_$ LD_LIBRARY_PATH=/riscv64/rootfs/usr/local/lib > vesta_$ export LD_LIBRARY_PATH > vesta_$ CFLAGS=\--sysroot=/riscv64/rootfs\ \-L/riscv64/rootfs/lib\ > \-L/riscv64/rootfs/usr/local/lib\ \ \-O0\ > \-fno-builtin\ \-march=rv64imafdc\ \-mabi=lp64d\ > \-mpreferred-stack-boundary=4\ \ > \-mstrict-align\ \-mexplicit-relocs\ \-g \ > > CXXFLAGS=\--sysroot=/riscv64/rootfs\ \-L/riscv64/rootfs/lib\ > \-L/riscv64/rootfs/usr/local/lib\ \ > \-O0\ \-fno-builtin\ \-march=rv64imafdc\ \-mabi=lp64d\ > \-mpreferred-stack-boundary=4\ \ > \-mstrict-align\ \-mexplicit-relocs\ \-g \ > > ../gcc-8.2.0/configure \ > > --build=x86_64-unknown-freebsd12.0 \ > > --host=riscv64-unknown-freebsd12.0 \ Now you're setting --host as well, maybe stop changing multiple things at once. That makes it impossible to debug each step. Do you really want to build a native riscv64 compiler to run on the target, or are you trying to build a cross-compiler to run on x86_64 and build binaries for riscv64? > --target=riscv64-unknown-freebsd12.0 \ > > --with-sysroot=/riscv64/rootfs \ > > --prefix=/usr/local/gcc8 --without-headers \ > > --with-build-time-tools=/opt/tools/bin \ > > --with-as=/opt/tools/bin/riscv64-unknown-freebsd12.0-as \ > > --with-ld=/opt/tools/bin/riscv64-unknown-freebsd12.0-ld \ > > --disable-multilib --enable-threads=posix \ > --enable-tls > --disable-bootstrap --enable-languages=c,c++ \ > --disable-libquadmath > --disable-libgomp --disable-libvtv \ > --enable-checking=all > --disable-nls \ > --enable-decimal-float=no > --with-diagnostics-color=never \ > --disable-lto --without-newlib > --disable-werror \ > --disable-libatomic --disable-lib 2>&1 | > tee ../gcc-8.2.0_rv64imafdc.005.config.log > checking build system type... x86_64-unknown-freebsd12.0 > checking host system type... riscv64-unknown-freebsd12.0 > checking target system type... riscv64-unknown-freebsd12.0 > checking for a BSD-compatible install... /usr/bin/install -c > checking whether ln works... yes > checking whether ln -s works... yes > checking for a sed that does not truncate output... /usr/local/bin/gsed > checking for gawk... /usr/local/bin/gawk > checking for libitm support... no > checking for libsanitizer support... no > checking for libmpx support... no > checking for libhsail-rt support... no > checking for riscv64-unknown-freebsd12.0-gcc... > /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc > checking for C compiler default output file name... > configure: error: in > `/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.005': > configure: error: C compiler cannot create executables > See `config.log' for more details. > vesta_$ > > > configure:4304: checking for C compiler default output file name > configure:4326: /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc > --sysroot=/riscv64/rootfs -L/riscv64/rootfs/lib -L/riscv64/rootfs/usr > /local/lib -O0 -fno-builtin -march=rv64imafdc -mabi=lp64d > -mpreferred-stack-boundary=4 -mstrict-align -mexplicit-relocs -g conftes > t.c >&5 > ld-elf.so.1: /riscv64/rootfs/usr/local/lib/libmpc.so.3: unsupported machine > configure:4330: $? = 1 > configure:4367: result: > configure: failed program was:> | /* confdefs.h */ > | #define PACKAGE_NAME "" > | #define PACKAGE_TARNAME "" > | #define PACKAGE_VERSION "" > | #define PACKAGE_STRING "" > | #define PACKAGE_BUGREPORT "" > | #define PACKAGE_URL "" > | /* end confdefs.h. */ > | > | int > | main () > | { > | > | ; > | return 0; > | } > configure:4373: error: in > `/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.005': > configure:4377: error: C compiler cannot create executables > > So LD_LIBRARY_PATH isn't helping because those libs exist and I really > don't need them when I have the sources in the tree .. Right. Obviously. Why even waste time trying to tell it to use the wrong libs? > so as root move > them aside : > > vesta# mv /riscv64/rootfs/usr/local /riscv64/rootfs/usr/_local_ > > vesta_$ > vesta_$ CFLAGS=\--sysroot=/riscv64/rootfs\ \-L/riscv64/rootfs/lib\ > \-L/riscv64/rootfs/usr/local/lib\ \ \-O0\ > \-fno-builtin\ \-march=rv64imafdc\ \-mabi=lp64d\ > \-mpreferred-stack-boundary=4\ \ > \-mstrict-align\ \-mexplicit-relocs\ \-g \ > > CXXFLAGS=\--sysroot=/riscv64/rootfs\ \-L/riscv64/rootfs/lib\ > \-L/riscv64/rootfs/usr/local/lib\ \ > \-O0\ \-fno-builtin\ \-march=rv64imafdc\ \-mabi=lp64d\ > \-mpreferred-stack-boundary=4\ \ > \-mstrict-align\ \-mexplicit-relocs\ \-g \ > > ../gcc-8.2.0/configure \ > > --build=x86_64-unknown-freebsd12.0 \ > > --host=riscv64-unknown-freebsd12.0 \ Are you sure you want to set --host here? > --target=riscv64-unknown-freebsd12.0 \ > > --with-sysroot=/riscv64/rootfs \ > > --prefix=/usr/local/gcc8 --without-headers \ > > --with-build-time-tools=/opt/tools/bin \ > > --with-as=/opt/tools/bin/riscv64-unknown-freebsd12.0-as \ > > --with-ld=/opt/tools/bin/riscv64-unknown-freebsd12.0-ld \ > > --disable-multilib --enable-threads=posix \ > --enable-tls > --disable-bootstrap --enable-languages=c,c++ \ > --disable-libquadmath > --disable-libgomp --disable-libvtv \ > --enable-checking=all > --disable-nls \ > --enable-decimal-float=no > --with-diagnostics-color=never \ > --disable-lto --without-newlib > --disable-werror \ > --disable-libatomic --disable-lib 2>&1 | > tee ../gcc-8.2.0_rv64imafdc.005.config.log > checking build system type... x86_64-unknown-freebsd12.0 > checking host system type... riscv64-unknown-freebsd12.0 > checking target system type... riscv64-unknown-freebsd12.0 > checking for a BSD-compatible install... /usr/bin/install -c > checking whether ln works... yes > checking whether ln -s works... yes > checking for a sed that does not truncate output... /usr/local/bin/gsed > checking for gawk... /usr/local/bin/gawk > checking for libitm support... no > checking for libsanitizer support... no > checking for libmpx support... no > checking for libhsail-rt support... no > checking for riscv64-unknown-freebsd12.0-gcc... > /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc > checking for C compiler default output file name... a.out > checking whether the C compiler works... yes > checking whether we are cross compiling... yes > checking for suffix of executables... > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc accepts > -g... yes > checking for /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc option to > accept ISO C89... none needed > checking whether we are using the GNU C++ compiler... yes > checking whether /opt/tools/bin/riscv64-unknown-freebsd12.0-g++ accepts > -g... yes > checking whether g++ accepts -static-libstdc++ -static-libgcc... yes > checking for riscv64-unknown-freebsd12.0-gnatbind... no > checking for gnatbind... no > checking for riscv64-unknown-freebsd12.0-gnatmake... no > checking for gnatmake... no > checking whether compiler driver understands Ada... no > checking how to compare bootstrapped objects... cmp $$f1 $$f2 16 16 > checking for objdir... .libs > checking for isl 0.15 or later... no > required isl version is 0.15 or later > *** This configuration is not supported in the following subdirectories: > target-libquadmath target-libitm target-libsanitizer target-libmpx > gnattools gotools target-libada target-libhsail-rt target-libgfortran > target-libbacktrace target-libgo target-libffi target-libobjc > target-libgomp target-liboffloadmic target-libatomic target-libvtv > (Any other directories should still work fine.) > checking for default BUILD_CONFIG... > checking for --enable-vtable-verify... no > checking for bison... bison -y > checking for bison... /usr/local/bin/bison > checking for gm4... /usr/local/bin/gm4 > checking for flex... flex > checking for flex... flex > checking for makeinfo... makeinfo > checking for expect... no > checking for runtest... no > checking for ar... (cached) /opt/tools/bin/riscv64-unknown-freebsd12.0-ar > checking for riscv64-unknown-freebsd12.0-ar... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-ar > checking for as... (cached) /opt/tools/bin/riscv64-unknown-freebsd12.0-as > checking for riscv64-unknown-freebsd12.0-as... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-as > checking for riscv64-unknown-freebsd12.0-dlltool... no > checking for ld... (cached) /opt/tools/bin/riscv64-unknown-freebsd12.0-ld > checking for riscv64-unknown-freebsd12.0-ld... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-ld > checking for riscv64-unknown-freebsd12.0-lipo... no > checking for nm... (cached) /opt/tools/bin/riscv64-unknown-freebsd12.0-nm -p > checking for riscv64-unknown-freebsd12.0-nm... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-nm -p > checking for ranlib... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-ranlib > checking for riscv64-unknown-freebsd12.0-ranlib... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-ranlib > checking for strip... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-strip > checking for riscv64-unknown-freebsd12.0-strip... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-strip > checking for riscv64-unknown-freebsd12.0-windres... no > checking for riscv64-unknown-freebsd12.0-windmc... no > checking for objcopy... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-objcopy > checking for riscv64-unknown-freebsd12.0-objcopy... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-objcopy > checking for objdump... (cached) /usr/bin/objdump > checking for riscv64-unknown-freebsd12.0-objdump... (cached) > /usr/bin/objdump > checking for readelf... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-readelf > checking for riscv64-unknown-freebsd12.0-readelf... (cached) > /opt/tools/bin/riscv64-unknown-freebsd12.0-readelf > checking for cc in /opt/tools/bin... no > checking for gcc in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-cc... no > checking for riscv64-unknown-freebsd12.0-gcc... > riscv64-unknown-freebsd12.0-gcc > checking for c++ in /opt/tools/bin... no > checking for g++ in /opt/tools/bin... no > checking for cxx in /opt/tools/bin... no > checking for gxx in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-c++... > riscv64-unknown-freebsd12.0-c++ > checking for gcc in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-gcc... > riscv64-unknown-freebsd12.0-gcc > checking for gfortran in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-gfortran... no > checking for gccgo in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-gccgo... no > checking for ar in /opt/tools/bin... no > checking for ar in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-ar... > riscv64-unknown-freebsd12.0-ar > checking for as in /opt/tools/bin... no > checking for as in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-as... > riscv64-unknown-freebsd12.0-as > checking for dlltool in /opt/tools/bin... no > checking for dlltool in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-dlltool... no > checking for ld in /opt/tools/bin... no > checking for ld in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-ld... > riscv64-unknown-freebsd12.0-ld > checking for lipo in /opt/tools/bin... no > checking for lipo in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-lipo... no > checking for nm in /opt/tools/bin... no > checking for nm in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-nm... > riscv64-unknown-freebsd12.0-nm > checking for objcopy in /opt/tools/bin... no > checking for objcopy in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-objcopy... > riscv64-unknown-freebsd12.0-objcopy > checking for objdump in /opt/tools/bin... no > checking for objdump in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-objdump... > riscv64-unknown-freebsd12.0-objdump > checking for ranlib in /opt/tools/bin... no > checking for ranlib in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-ranlib... > riscv64-unknown-freebsd12.0-ranlib > checking for readelf in /opt/tools/bin... no > checking for readelf in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-readelf... > riscv64-unknown-freebsd12.0-readelf > checking for strip in /opt/tools/bin... no > checking for strip in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-strip... > riscv64-unknown-freebsd12.0-strip > checking for windres in /opt/tools/bin... no > checking for windres in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-windres... no > checking for windmc in /opt/tools/bin... no > checking for windmc in /opt/tools/bin... no > checking for riscv64-unknown-freebsd12.0-windmc... no > checking where to find the target ar... pre-installed > checking where to find the target as... pre-installed > checking where to find the target cc... pre-installed > checking where to find the target c++... pre-installed > checking where to find the target c++ for libstdc++... pre-installed > checking where to find the target dlltool... pre-installed > checking where to find the target gcc... pre-installed > checking where to find the target gfortran... pre-installed > checking where to find the target gccgo... pre-installed > checking where to find the target ld... pre-installed > checking where to find the target lipo... pre-installed > checking where to find the target nm... pre-installed > checking where to find the target objcopy... pre-installed > checking where to find the target objdump... pre-installed > checking where to find the target ranlib... pre-installed > checking where to find the target readelf... pre-installed > checking where to find the target strip... pre-installed > checking where to find the target windres... pre-installed > checking where to find the target windmc... pre-installed > checking whether to enable maintainer-specific portions of Makefiles... no > configure: creating ./config.status > config.status: creating Makefile > vesta_$ > > So running gmake I see good things happen for a while until ka-boom : > mkdir ./gmp > Configuring in ./gmp > configure: creating cache ./config.cache > checking build system type... x86_64-unknown-freebsd12.0 > checking host system type... none-unknown-freebsd12.0 This is the problem. "none" > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... yes > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc accepts > -g... yes > checking for /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc option to > accept ISO C89... none needed > checking whether /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc > understands -c and -o together... yes > checking for /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc option to > accept ISO C99... none needed > checking for /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc option to > accept ISO Standard C... (cached) none needed > checking how to run the C preprocessor... > /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc -E > checking build system compiler gcc... no > configure: error: Specified CC_FOR_BUILD doesn't seem to work > gmake[1]: *** [Makefile:4682: configure-gmp] Error 1 > gmake[1]: Leaving directory > '/usr/home/dclarke/rv64g_local/build/gcc-8.2.0_rv64imafdc.005' > gmake: *** [Makefile:906: all] Error 2 > vesta_$ > > However I have already built libgmp before with this > riscv64-unknown-freebsd12.0-gcc and I *know* it works. But you built it with a cross-compiler, this is a different setup. > > So now I see a complaint about CC_FOR_BUILD ?? > > What ? > > The CC for the build should be CC which is : > > vesta_$ > vesta_$ echo $CC > /opt/tools/bin/riscv64-unknown-freebsd12.0-gcc > vesta_$ > > So this all looks like what I was running into yesterday. I think this > is a better path to follow but tough to say what is needed. > > Dennis > > > > > > > > > > > > >