Compile Error using Freedom E SDK

Hi,
I am trying to build an example using Freedom E SDK. I am using KDE Neon 5.16
Building an Example
To compile a bare-metal RISC-V program:

make BSP=metal [PROGRAM=hello] TARGET=sifive-hifive1-revb software

I am getting a compile error while following above steps.

cd /home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/ &&
       CFLAGS=“-march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/install/include --specs=nano.specs -O0 -g”
       /home/kanika812/Desktop/freedom-e-sdk/freedom-metal/configure
       –host=riscv64-unknown-elf
       –prefix=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/install
       –libdir=/home/kanika812/Desktop/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/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.h
               –with-machine-inline=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-inline.h
       –with-platform-header=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-platform.h
       –with-machine-ldscript=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.default.lds
       –with-builtin-libgloss
/bin/sh: 2: /home/kanika812/Desktop/freedom-e-sdk/freedom-metal/configure: not found
scripts/libmetal.mk:19: recipe for target ‘/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile’ failed
make: *** [/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile] Error 127

Also I am not able to do submodule update.

git submodule update --init --recursive.

Here is the guide link [https://sifive.cdn.prismic.io/sifive%2F4f5a7851-1b52-463b-a293-f352036bc809_hifive1b-getting-started-guide_v1.1.pdf]. Please let me know if anybody has any ideas on how to resolve this.

You can’t build the sources if you haven’t fully checked them out yet, and you haven’t fully checked them out yet if you didn’t run the git submodule update command. What error do you get when you run git submodule update --init --recursive? Did you remember to cd into the freedom-e-sdk dir first?

Hi Jim,
Yes I cd into freedom-e-sdk. When I try to git submodule update, it does not return anything. No error.

Odd. The only case I can think of where git submodule does nothing is if you already ran it and it already worked. What do you see if you run “ls freedom-metal”? If you see an empty dir, then the submodule has not been updated yet. If you see files in there, then the configure file should be one of them. You should also try “git status” in case maybe the initial clone of freedom-e-sdk had a problem. And you should try “git branch” to see what branch you are on. You should be on the default v201908-branch branch.

Yes I think the submodule is updated. I have the configure file.
git status:

On branch v201908-branch
Your branch is up to date with ‘origin/v201908-branch’.

nothing to commit, working tree clean

Everything seems to be correct still getting the compile error.

cd /home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/ &&
CFLAGS=“-march=rv32imac -mabi=ilp32 -mcmodel=medlow -ffunction-sections -fdata-sections -I/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/install/include --specs=nano.specs -O0 -g”
/home/kanika812/Desktop/freedom-e-sdk/freedom-metal/configure
–host=riscv64-unknown-elf
–prefix=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/install
–libdir=/home/kanika812/Desktop/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/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.h
–with-machine-inline=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-inline.h
–with-platform-header=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal-platform.h
–with-machine-ldscript=/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/metal.default.lds
–with-builtin-libgloss
/bin/sh: 2: /home/kanika812/Desktop/freedom-e-sdk/freedom-metal/configure: not found
scripts/libmetal.mk:19: recipe for target ‘/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile’ failed
make: *** [/home/kanika812/Desktop/freedom-e-sdk/bsp/sifive-hifive1-revb/build/debug/Makefile] Error 127

The error is
/bin/sh: 2: /home/kanika812/Desktop/freedom-e-sdk/freedom-metal/configure: not found
if that file exists, then that suggests that /bin/sh is broken. Or maybe the configure script is corrected.
What does “ls -lt /bin/sh” say? What happens if you try to run that configure script by hand?

lrwxrwxrwx 1 root root 4 Jun  3 09:28 /bin/sh -> dash

When I try to run configure

/bin/sh^M: bad interpreter: No such file or directory

I meant “configure corrupted” not “configure corrected”. The error message suggests a windows/linux incompatibility. Windows uses ^M^J to end a line, linux uses ^J to end a line. If you have a windows version of the file that is using ^M^J as a line ending, and run that on a linux shell, you will get that error. I can reproduce by manually editing my copy of the file to look like a windows file. So now the question is how did you manage to get a windows file on a linux system?

There is a git config feature where you can specify line endings. If you have core.eol set to crlf in your ~/.gitconfig file that could cause this problem. Or maybe you are on a window system, and using the linux subsystem, or cygwin, or something?

1 Like