pulp-platform / pulp-riscv-gnu-toolchain

Other
68 stars 50 forks source link

error when $ make linux ( pulp-riscv-gnu-toolchain) #41

Closed nguyendaithien closed 7 months ago

nguyendaithien commented 9 months ago

checking for riscv32-unknown-linux-gnu-gcc... /home/cu_cai/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/./gcc/xgcc -B/home/cu_cai/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/./gcc/ -B/opt/riscv/riscv32-unknown-linux-gnu/bin/ -B/opt/riscv/riscv32-unknown-linux-gnu/lib/ -isystem /opt/riscv/riscv32-unknown-linux-gnu/include -isystem /opt/riscv/riscv32-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in /home/cu_cai/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/riscv32-unknown-linux-gnu/libgcc': configure: error: cannot compute suffix of object files: cannot compile Seeconfig.log' for more details. make[1]: [Makefile:11138: configure-target-libgcc] Error 1 make[1]: Leaving directory '/home/cu_cai/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1' make: [Makefile:156: stamps/build-gcc-linux-stage1] Error 2

srinisy-22 commented 9 months ago

I also faced the similar issue

Tjoms99 commented 7 months ago

I also have issues when $ make linux, but the error is slightly different.

/tmp/ccRfbztP.s: Assembler messages:
/tmp/ccRfbztP.s:4954: Error: unrecognized opcode `lwu a1,.LANCHOR0+2'
/tmp/ccRfbztP.s:5170: Error: unrecognized opcode `lwu a5,.LANCHOR0'
/tmp/ccRfbztP.s:5248: Error: unrecognized opcode `lwu a4,.LANCHOR0+2'
/tmp/ccRfbztP.s:5895: Error: unrecognized opcode `lwu a2,.LANCHOR0+2'
/tmp/ccRfbztP.s:5987: Error: unrecognized opcode `lwu a3,.LANCHOR0+2'
make[4]: *** [/home/tjoms/Documents/university/pulp-riscv-gnu-toolchain/riscv-gcc/libgcc/static-object.mk:17: unwind-dw2.o] Error 1
make[4]: Leaving directory '/home/tjoms/Documents/university/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/riscv64-unknown-linux-gnu/lib32/ilp32/libgcc'
make[3]: *** [Makefile:1198: multi-do] Error 1
make[3]: Leaving directory '/home/tjoms/Documents/university/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/riscv64-unknown-linux-gnu/libgcc'
make[2]: *** [Makefile:125: all-multi] Error 2
make[2]: Leaving directory '/home/tjoms/Documents/university/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1/riscv64-unknown-linux-gnu/libgcc'
make[1]: *** [Makefile:11207: all-target-libgcc] Error 2
make[1]: Leaving directory '/home/tjoms/Documents/university/pulp-riscv-gnu-toolchain/build-gcc-linux-stage1'
make: *** [Makefile:156: stamps/build-gcc-linux-stage1] Error 2

Here is the log

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by riscv-toolchain configure 1.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure --prefix=/opt/riscv --enable-multilib

## --------- ##
## Platform. ##
## --------- ##

hostname = Tjoms
uname -m = x86_64
uname -r = 5.15.0-88-generic
uname -s = Linux
uname -v = #98~20.04.1-Ubuntu SMP Mon Oct 9 16:43:45 UTC 2023

/usr/bin/uname -p = x86_64
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/riscv/bin
PATH: /home/tjoms/.local/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
PATH: /home/tjoms/.dotnet/tools
PATH: /usr/local/bin/nrfjprog /opt/nrf-command-line-tools/bin/nrfjprog
PATH: /home/tjoms/ncs/v2.2.0/zephyr
PATH: /home/tjoms/.local/lib/python3.8/site-packages/
PATH: /opt/EGGER/JLink/ 
PATH: /home/tjoms/intelFPGA/22.1std/questa_fse/bin

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1875: checking for gcc
configure:1891: found /usr/bin/gcc
configure:1902: result: gcc
configure:2131: checking for C compiler version
configure:2140: gcc --version >&5
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2151: $? = 0
configure:2140: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) 
configure:2151: $? = 0
configure:2140: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2151: $? = 1
configure:2140: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:2151: $? = 1
configure:2171: checking whether the C compiler works
configure:2193: gcc    conftest.c  >&5
configure:2197: $? = 0
configure:2245: result: yes
configure:2248: checking for C compiler default output file name
configure:2250: result: a.out
configure:2256: checking for suffix of executables
configure:2263: gcc -o conftest    conftest.c  >&5
configure:2267: $? = 0
configure:2289: result: 
configure:2311: checking whether we are cross compiling
configure:2319: gcc -o conftest    conftest.c  >&5
configure:2323: $? = 0
configure:2330: ./conftest
configure:2334: $? = 0
configure:2322: result: no
configure:2327: checking for suffix of object files
configure:2349: gcc -c   conftest.c >&5
configure:2353: $? = 0
configure:2374: result: o
configure:2378: checking whether we are using the GNU C compiler
configure:2397: gcc -c   conftest.c >&5
configure:2397: $? = 0
configure:2406: result: yes
configure:2415: checking whether gcc accepts -g
configure:2435: gcc -c -g  conftest.c >&5
configure:2435: $? = 0
configure:2476: result: yes
configure:2493: checking for gcc option to accept ISO C89
configure:2556: gcc  -c -g -O2  conftest.c >&5
configure:2556: $? = 0
configure:2569: result: none needed
configure:2589: checking for grep that handles long lines and -e
configure:2647: result: /usr/bin/grep
configure:2652: checking for fgrep
configure:2714: result: /usr/bin/grep -F
configure:2719: checking for grep that handles long lines and -e
configure:2777: result: /usr/bin/grep
configure:2785: checking for bash
configure:2816: result: /bin/bash
configure:2887: checking for __gmpz_init in -lgmp
configure:2912: gcc -o conftest -g -O2   conftest.c -lgmp   >&5
configure:2912: $? = 0
configure:2921: result: yes
configure:2934: checking for mpfr_init in -lmpfr
configure:2959: gcc -o conftest -g -O2   conftest.c -lmpfr  -lgmp  >&5
configure:2959: $? = 0
configure:2968: result: yes
configure:2981: checking for mpc_init2 in -lmpc
configure:3006: gcc -o conftest -g -O2   conftest.c -lmpc  -lmpfr -lgmp  >&5
configure:3006: $? = 0
configure:3015: result: yes
configure:3038: checking for curl
configure:3056: found /usr/bin/curl
configure:3069: result: /usr/bin/curl
configure:3079: checking for wget
configure:3097: found /usr/bin/wget
configure:3110: result: /usr/bin/wget
configure:3120: checking for ftp
configure:3138: found /usr/bin/ftp
configure:3151: result: /usr/bin/ftp
configure:3499: creating ./config.status

## ---------------------- ##
## Running config.status. ##
## ---------------------- ##

This file was extended by riscv-toolchain config.status 1.0, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = 
  CONFIG_HEADERS  = 
  CONFIG_LINKS    = 
  CONFIG_COMMANDS = 
  $ ./config.status 

on Tjoms

config.status:737: creating Makefile
config.status:737: creating scripts/wrapper/awk/awk
config.status:737: creating scripts/wrapper/sed/sed

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_lib_gmp___gmpz_init=yes
ac_cv_lib_mpc_mpc_init2=yes
ac_cv_lib_mpfr_mpfr_init=yes
ac_cv_objext=o
ac_cv_path_BASH=/bin/bash
ac_cv_path_CURL=/usr/bin/curl
ac_cv_path_FGREP='/usr/bin/grep -F'
ac_cv_path_FTP=/usr/bin/ftp
ac_cv_path_GAWK=/usr/bin/gawk
ac_cv_path_GREP=/usr/bin/grep
ac_cv_path_GSED=/usr/bin/sed
ac_cv_path_WGET=/usr/bin/wget
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

BASH='/bin/bash'
CC='gcc'
CFLAGS='-g -O2'
CPPFLAGS=''
CURL='/usr/bin/curl'
DEFS='-DPACKAGE_NAME=\"riscv-toolchain\" -DPACKAGE_TARNAME=\"riscv-toolchain\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"riscv-toolchain\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DHAVE_LIBGMP=1 -DHAVE_LIBMPFR=1 -DHAVE_LIBMPC=1'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
FETCHER='/usr/bin/curl -L -o - --ftp-pasv --retry 10'
FGREP='/usr/bin/grep -F'
FTP='/usr/bin/ftp'
GAWK='/usr/bin/gawk'
GREP='/usr/bin/grep'
GSED='/usr/bin/sed'
LDFLAGS=''
LIBOBJS=''
LIBS='-lmpc -lmpfr -lgmp '
LTLIBOBJS=''
NEED_GCC_EXTERNAL_LIBRARIES='false'
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='riscv-toolchain'
PACKAGE_STRING='riscv-toolchain 1.0'
PACKAGE_TARNAME='riscv-toolchain'
PACKAGE_URL=''
PACKAGE_VERSION='1.0'
PATH_SEPARATOR=':'
SHELL='/bin/bash'
WGET='/usr/bin/wget'
WITH_ABI='--with-abi=lp64d'
WITH_ARCH='--with-arch=rv64imafdc'
ac_ct_CC='gcc'
bindir='${exec_prefix}/bin'
build_alias=''
cmodel='-mcmodel=medlow'
configure_host=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
default_target='newlib'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
gcc_checking='--enable-checking=yes'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
multilib_flags='--enable-multilib'
multilib_names='rv32imcxpulpv2-ilp32 rv32imcxgap8-ilp32 rv32imcxgap9-ilp32 rv32imfcxpulpv2-ilp32 rv32imfcxpulpv2-ilp32f rv32imcxpulpslim-ilp32 rv32ic-ilp32-mreg16'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/opt/riscv'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
with_guile=''
with_system_zlib='--with-system-zlib'

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "riscv-toolchain"
#define PACKAGE_TARNAME "riscv-toolchain"
#define PACKAGE_VERSION "1.0"
#define PACKAGE_STRING "riscv-toolchain 1.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define HAVE_LIBGMP 1
#define HAVE_LIBMPFR 1
#define HAVE_LIBMPC 1

configure: exit 0
haresh-seenivasagan commented 7 months ago

i am also facing this issue

FrancescoConti commented 7 months ago

You must not make linux, as written in the README https://github.com/pulp-platform/pulp-riscv-gnu-toolchain#installation-pulp

haresh-seenivasagan commented 7 months ago

then how do we build the linux cross compiler @FrancescoConti ? I ran the below as mentioned in the documentation ./configure --prefix=/opt/riscv --with-arch=rv32g --with-abi=ilp32d make linux

FrancescoConti commented 7 months ago

The compiler will be anyways running on your Linux host. make linux is used to cross-compile for a RISC-V Linux device, and this modified PULP toolchain is not tested in this case. You see this from the fact that your toolchain is prefixed riscv32-unknown-linux- Instead, you should target the bare metal PULP cores and your toolchain will be targeting none or unknown target, not linux.

haresh-seenivasagan commented 3 months ago

Thanks for the reply @FrancescoConti . I want to be able to use IMFDXpulpv2 -mhard-float as GCC_MARCH flags and -O3 -m32 -g -fsingle-precision-constant -mfpdouble=float -Werror=double-promotion as TARGET_C_FLAGS for my pulpino cmake configuration.

what should be the flags that i should add to ./configure for the installation of this toolchain for a pulpino core

previously I was trying to use https://github.com/pulp-platform/ri5cy_gnu_toolchain instead but for some reason i cannot even add and subtract two floats using it , even though i compiled the toolchain with the FPU . here is the c code that i am trying to run on pulpino:

include

int main() { float a =4.2; float b = 3.1; float c; float d; c = a+b ; d = a-b ; printf("Toplam=%f",c); printf("Fark=%f",d ); return 0; }

due to the -Werror=double-promotion C Flag that i set i always get a error that float is being promoted to double. But even if i remove the flag the floating point variables are not printed. I have been stuck with this issue for a long time, would appreciate any help to deal with this