pulp-platform / pulp-riscv-gnu-toolchain

Other
68 stars 50 forks source link

"Linux multilib" fails to build, final link failed #3

Closed bluewww closed 6 years ago

bluewww commented 6 years ago

The machine runs centos 7, provided by the IIS at ETH, with preinstalled dependencies (so I didn't mess with that).

msc18f22@badile08:[/]: lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.4.1708 (Core) 
Release:        7.4.1708
Codename:       Core
msc18f22@badile08:[/]: uname -rms
Linux 3.10.0-693.17.1.el7.x86_64 x86_64

I build on /scratch to prevent any nfs related errors, such as cp -p complaining about ownership.

./configure --prefix=$HOME/.riscv --enable-multilib && make -j8 linux

fails with

/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(div.o): ABI is incompatible with that of the selected emulation:
  target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: failed to merge target specific data of file /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(div.o)
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: Attempt to do relocatable link with elf64-littleriscv input and elf32-littleriscv output
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(div.o): file class ELFCLASS64 incompatible with ELFCLASS32
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: final link failed: File in wrong format
collect2: error: ld returned 1 exit status
make[3]: *** [/scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32imcxpulpv2-ilp32/elf/librtld.map] Error 1
make[3]: *** Waiting for unfinished jobs....
riscv64-unknown-linux-gnu-gcc -march=rv32ic -mabi=ilp32   -nostdlib -nostartfiles -r -o /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/libc_pic.os \
 -Wl,-d -Wl,--whole-archive /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/libc_pic.a -o /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/libc_pic.os
riscv64-unknown-linux-gnu-gcc -march=rv32ic -mabi=ilp32   -nostdlib -nostartfiles -r -o /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/elf/librtld.map.o '-Wl,-(' /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/elf/dl-allobjs.os /scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/libc_pic.a -lgcc '-Wl,-)' -Wl,-Map,/scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/elf/librtld.mapT
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(muldi3.o): ABI is incompatible with that of the selected emulation:
  target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: failed to merge target specific data of file /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(muldi3.o)
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(div.o): ABI is incompatible with that of the selected emulation:
  target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: failed to merge target specific data of file /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(div.o)
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: Attempt to do relocatable link with elf64-littleriscv input and elf32-littleriscv output
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: /home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/libgcc.a(muldi3.o): file class ELFCLASS64 incompatible with ELFCLASS32
/home/msc18f22/.riscv/lib/gcc/riscv64-unknown-linux-gnu/7.1.1/../../../../riscv64-unknown-linux-gnu/bin/ld: final link failed: File in wrong format
collect2: error: ld returned 1 exit status
make[3]: *** [/scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16/elf/librtld.map] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/riscv-glibc/elf'
make[2]: *** [elf/subdir_lib] Error 2
make[2]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/riscv-glibc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32imcxpulpv2-ilp32'
make: *** [stamps/build-glibc-linux-rv32imcxpulpv2-ilp32] Error 2
make[3]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/riscv-glibc/elf'
make[2]: *** [elf/subdir_lib] Error 2
make[2]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/riscv-glibc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/scratch/tmp/pulp-riscv-gnu-toolchain/build-glibc-linux-rv32ic-ilp32-mreg16'
make: *** [stamps/build-glibc-linux-rv32ic-ilp32-mreg16] Error 2

I don't understand enough about the build and link process of this toolchain to understand the core issue of that error.

haugoug commented 6 years ago

If you are in ETH you don't need to build the toolchain you can directly follows this section: SDK build with dependencies download This will directly download the toolchain