riscv-collab / riscv-gnu-toolchain

GNU toolchain for RISC-V, including GCC
Other
3.27k stars 1.11k forks source link

Linux toolchain build failure #8

Closed arunthomas closed 9 years ago

arunthomas commented 9 years ago

I am having issues building the Linux riscv-isa-toolchain on Ubuntu 14.04. Here's the error I'm seeing during the glibc build:

gawk -f ../scripts/gen-as-const.awk ../sysdeps/riscv/nptl/tcb-offsets.sym \
    | gcc -m64 -S -o /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.hT3 -std=gnu99 -fgnu89-inline -fno-stack-protector -O2 -Wall -Winline -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes       -U_FORTIFY_SOURCE   -I../include -I/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/csu  -I/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux  -I../sysdeps/unix/sysv/linux/riscv/rv64  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/riscv  -I../sysdeps/unix/sysv/linux/generic  -I../sysdeps/riscv/nptl  -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/riscv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/riscv/rv64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/riscv/rv64/soft-fp  -I../sysdeps/riscv  -I../sysdeps/init_array  -I../sysdeps/wordsize-64  -I../sysdeps/riscv/fpu  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -isystem /home/arun/crash/zephyr/riscv-gnu-toolchain/linux-headers//include  -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h.dT -MT '/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h.d /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h'
In file included from ../sysdeps/unix/sysv/linux/riscv/sysdep.h:23:0,
                 from <stdin>:1:
../sysdeps/riscv/nptl/tls.h:44:16: error: invalid register name for ‘__thread_self’
 register void* __thread_self asm("tp");
                ^
palmer-dabbelt commented 9 years ago

I think you don't have the install prefix in your PATH? On Nov 25, 2014 2:17 PM, "Arun Thomas" notifications@github.com wrote:

I am having issues building the Linux riscv-isa-toolchain on Ubuntu 14.04. Here's the error I'm seeing during the glibc build:

gawk -f ../scripts/gen-as-const.awk ../sysdeps/riscv/nptl/tcb-offsets.sym \ | gcc -m64 -S -o /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.hT3 -std=gnu99 -fgnu89-inline -fno-stack-protector -O2 -Wall -Winline -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -U_FORTIFY_SOURCE -I../include -I/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/csu -I/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux -I../sysdeps/unix/sysv/linux/riscv/rv64 -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/unix/sysv/linux/riscv -I../sysdeps/unix/sysv/linux/generic -I../sysdeps/riscv/nptl -I../sysdeps/unix/sysv/linux -I../sysdeps/nptl -I../sysdeps/pthread -I../sysdeps/gnu -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/riscv -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/riscv/rv64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/riscv/rv64/soft-fp -I../sysdeps/riscv -I../sysdeps/init_array -I../sysdeps/wordsize-64 -I../sysdeps/riscv/fpu -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed -isystem /home/arun/crash/zephyr/riscv-gnu-toolchain/linux-headers//include -D_LIBC_REENTRANT -include ../include/libc-symbols.h -x c - \ -MD -MP -MF /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h.dT -MT '/home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h.d /home/arun/crash/zephyr/riscv-gnu-toolchain/build-glibc-linux/tcb-offsets.h' In file included from ../sysdeps/unix/sysv/linux/riscv/sysdep.h:23:0, from :1: ../sysdeps/riscv/nptl/tls.h:44:16: error: invalid register name for ‘__thread_self’ register void* __thread_self asm("tp"); ^

— Reply to this email directly or view it on GitHub https://github.com/ucb-bar/riscv-gnu-toolchain/issues/8.

arunthomas commented 9 years ago

Thanks for the response. /opt/riscv/bin is in my PATH.

I ran ./configure --prefix=/opt/riscv.

palmer-dabbelt commented 9 years ago

I have only gotten this error when glibc's autoconf detects you don't have "riscv64-unknown-linux-gnu-gcc" and tries to just use "gcc", which targets x86 and there for doesn't understand RISCV assembly.

You should be able to check your build log for libc and check if it's using your system GCC. If so then I'd recommend cleaning everything and rebuilding with that PATH set first.

If that's not it then I'm afraid I'm out of ideas... On Nov 25, 2014 2:28 PM, "Arun Thomas" notifications@github.com wrote:

Thanks for the response. /opt/riscv/bin is in my PATH.

I ran ./configure --prefix=/opt/riscv.

— Reply to this email directly or view it on GitHub https://github.com/ucb-bar/riscv-gnu-toolchain/issues/8#issuecomment-64456438 .

arunthomas commented 9 years ago

Based on the build output, it is falling back to the system gcc.

The strange thing is that the PATH is set correctly:

arun@yoshi:~$ which riscv64-unknown-linux-gnu-gcc
/opt/riscv/bin/riscv64-unknown-linux-gnu-gcc

I just did a clean build, and I got the same error.

ucbjrl commented 9 years ago

Try:

CC=riscv-gcc ./configure --prefix=/opt/riscv

On Tue, Nov 25, 2014 at 12:24 PM, Arun Thomas notifications@github.com wrote:

Based on the build output, it is falling back to the system gcc.

The strange thing is that the PATH is set correctly:

arun@yoshi:~$ which riscv64-unknown-linux-gnu-gcc /opt/riscv/bin/riscv64-unknown-linux-gnu-gcc

I just did a clean build, and I got the same error.

— Reply to this email directly or view it on GitHub https://github.com/ucb-bar/riscv-gnu-toolchain/issues/8#issuecomment-64464897 .

arunthomas commented 9 years ago

This was user error on my part. I was building with sudo, and the PATH wasn't getting set correctly as Palmer suggested. Sorry for the noise, and thanks for the help.