Compiling hello program for SiFive1 fails in configure step

Attempted command make PROGRAM=hello TARGET=sifive-hifive1-revb software but fails with the following output:

cd /home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/ && \
	CFLAGS="-march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/install/include --specs=nano.specs -O0 -g" \
	/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/freedom-metal/configure \
	--host=riscv64-unknown-elf \
	--prefix=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/install \
	--libdir=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/install/lib/debug \
	--disable-maintainer-mode \
	--with-preconfigured \
	--with-machine-name=sifive-hifive1-revb \
	--with-machine-header=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.h \
                --with-machine-inline=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-inline.h \
	--with-platform-header=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-platform.h \
	--with-machine-ldscript=/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.default.lds \
	--with-builtin-libgloss
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for riscv64-unknown-elf-strip... riscv64-unknown-elf-strip
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for riscv64-unknown-elf-gcc... riscv64-unknown-elf-gcc
checking whether the C compiler works... no
configure: error: in `/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug':
configure: error: C compiler cannot create executables
See `config.log' for more details
scripts/libmetal.mk:19: recipe for target '/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile' failed
make: *** [/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile] Error 77

What can I do to diagnose this issue? I am using the RISCV toolchain from the website and have done the RISCV_PATH export. I should also mention that I am running this command from the directory that I cloned the v2019-08-branch freedom-e-sdk repository into.

Hi,

You can examine the “config.log” to see if there is more detailed information on why it thinks the compiler cannot create executables? Feel free to post any relevant content here.

-Kevin

Here is an excerpt of the config log where the build begins to fail. One strange thing I notice is that Configured with is an old path I used to have the repository at and is not the directory where I have the repository now, which seems a bit suspicious.

configure:2879: $? = 0
configure:2868: riscv64-unknown-elf-gcc -v >&5
Using built-in specs.
COLLECT_GCC=riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/riscv64-unknown-elf/8.1.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: /home/steppenwolf/Development/Repositories/freedom-e-sdk/riscv-gnu-toolchain/riscv-gcc/configure --target=riscv64-unknown-elf --prefix=/usr/local --disable-shared --disable-threads --enable-languages=c,c++ --with-system-zlib --enable-tls --with-newlib --with-sysroot=/usr/local/riscv64-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --src=.././riscv-gcc --enable-checking=yes --disable-multilib --with-abi=lp64d --with-arch=rv64imafdc 'CFLAGS_FOR_TARGET=-Os  -mcmodel=medlow'
Thread model: single
gcc version 8.1.0 (GCC)
configure:2879: $? = 0
configure:2868: riscv64-unknown-elf-gcc -V >&5
riscv64-unknown-elf-gcc: error: unrecognized command line option '-V'
riscv64-unknown-elf-gcc: fatal error: no input files
compilation terminated.
configure:2879: $? = 1
configure:2868: riscv64-unknown-elf-gcc -qversion >&5
riscv64-unknown-elf-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
riscv64-unknown-elf-gcc: fatal error: no input files
compilation terminated.
configure:2879: $? = 1
configure:2899: checking whether the C compiler works
configure:2921: riscv64-unknown-elf-gcc -march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/install/include --specs=nano.specs -O0 -g   conftest.c  >&5
/usr/local/libexec/gcc/riscv64-unknown-elf/8.1.0/cc1: error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
configure:2925: $? = 1
configure:2963: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "freedom-metal"
| #define PACKAGE_TARNAME "freedom-metal"
| #define PACKAGE_VERSION "v0.1.2"
| #define PACKAGE_STRING "freedom-metal v0.1.2"
| #define PACKAGE_BUGREPORT "https://github.com/sifive/freedom-metal/issues"
| #define PACKAGE_URL "https://github.com/sifive/freedom-metal"
| #define PACKAGE "freedom-metal"
| #define VERSION "v0.1.2"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2968: error: in `/home/steppenwolf/Development/Boards/SiFive/repos/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug':
configure:2970: error: C compiler cannot create executables
See `config.log' for more details

I know you already stated that you have RISCV_PATH setup. You might just verify that RISCV_PATH is set correctly in the shell that is running this make. I’m not sure why it would be pointing at an old path. Did you do a make clean first?

I also see this error further down:

Can you run ‘ldd /usr/local/libexec/gcc/riscv64-unknown-elf/8.1.0/cc1’ and see if all the dependencies are installed and satisfied?

What distro are you running on?

-Kevin