Closed josharian closed 7 years ago
I wasn't able to reproduce this. Running brew install riscv-gcc
completes successfully (after quite a bit of time). Additionally, manually cloning riscv-gnu-toolchain and building there also works. I just upgraded to macOS Sierra, and I'll hopefully be able to push new pre-built bottles in a few days.
What happens when you try to manually build it?
I just tried again; still no dice.
If by manually build it, you mean follow along the original brew recipe steps, I get the same result. I haven't tried any other means of building it; did you have a particular method in mind?
Superficially it appears that, for whatever reason, the build system isn't detecting my c++ compiler.
I just upgraded to macOS Sierra
It's also possible that it's not just Sierra, but also the fact that I'm doing this on a totally clean OS install, so no gcc or old clang versions or libraries lying around anywhere.
By manually, I mean cloning riscv-gnu-toolchain directly and following its build instructions.
I agree with your hypothesis that it might be an issue of detecting your compiler. I would test it out on other code just to be sure. After upgrading, I had to run xcrun a few times to get all of the dev tools working.
If nothing else, hopefully the bottles will help.
The brew install made it through several other compilations before dying on this one; I'm pretty sure my compiler is generally working and detectable. Will try the direct clone+build and report back.
I get a different failure with the direct clone+build. I had to manually point to my brew-installed gmp, mpfr, and libmpc.
$ git clone --recurse-submodules git@github.com:riscv/riscv-gnu-toolchain.git
$ cd riscv-gnu-toolchain
$ export CPPFLAGS="-I/usr/local/opt/gmp/include -I/usr/local/opt/mpfr/include -I/usr/local/opt/libmpc/include"
$ export LDFLAGS="-L/usr/local/opt/gmp/lib -L/usr/local/opt/mpfr/lib -L/usr/local/opt/libmpc/lib"
$ ./configure --prefix=/Users/josh/blarg
$ make linux
//
// *lots* of output elided, available on request
//
riscv64-unknown-linux-gnu-gcc -m64 divmod_1.c -c -std=gnu11 -fgnu89-inline -O2 -Wall -Wundef -Wwrite-strings -fmerge-all-constants -frounding-math -g -Wstrict-prototypes -Wold-style-definition -ftls-model=initial-exec -I/usr/local/opt/gmp/include -I/usr/local/opt/mpfr/include -I/usr/local/opt/libmpc/include -I../include -I/Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/stdlib -I/Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64 -I../sysdeps/unix/sysv/linux/riscv/rv64 -I../sysdeps/unix/sysv/linux/riscv -I../sysdeps/riscv/nptl -I../sysdeps/unix/sysv/linux/generic -I../sysdeps/unix/sysv/linux/wordsize-64 -I../sysdeps/unix/sysv/linux/include -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 -I../sysdeps/posix -I../sysdeps/riscv/rv64 -I../sysdeps/riscv -I../sysdeps/init_array -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/ldbl-128 -I../sysdeps/riscv/soft-fp -I../sysdeps/wordsize-64 -I../sysdeps/riscv/fpu -I../sysdeps/ieee754 -I../sysdeps/generic -I.. -I../libio -I. -D_LIBC_REENTRANT -include /Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h -o /Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/stdlib/divmod_1.o -MD -MP -MF /Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/stdlib/divmod_1.o.dt -MT /Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/stdlib/divmod_1.o
In file included from divmod_1.c:27:0:
/usr/local/opt/gmp/include/gmp.h:326:33: error: expected declaration specifiers or '...' before '(' token
#define __GMP_CAST(type, expr) ((type) (expr))
^
/usr/local/opt/gmp/include/gmp.h:1499:21: note: in expansion of macro '__GMP_CAST'
mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
^~~~~~~~~~
divmod_1.c:43:1: note: in expansion of macro 'mpn_divmod_1'
mpn_divmod_1 (mp_ptr quot_ptr,
^~~~~~~~~~~~
make[3]: *** [/Users/josh/blarg/riscv-gnu-toolchain/build-glibc-linux64/stdlib/divmod_1.o] Error 1
make[2]: *** [stdlib/subdir_lib] Error 2
make[1]: *** [all] Error 2
make: *** [stamps/build-glibc-linux64] Error 2
For building gcc, I would recommend building the newlib version (just make instead of make linux). That is what the homebrew-riscv is building. Building the glibc (linux) version of riscv-gcc takes longer, and is awkward to do on OS X due to the need for a case-sensitive file system (workaround is making a case sensitive disk image for the build). If you run into the case issue, the build errors will mention files with suffix .os.
You shouldn't have to tell configure where to find gmp, mpfr, and libmpc, and that might be a hint about the issue you are experiencing. On my system, the dev tools version of clang (default, aliased as g++), has no problem finding the homebrew installed libraries.
If nothing else, I would try installing from brew again. I uploaded bottles for Sierra, so it should use those and not even try to build.
The bottles work. I'll close this, since all I really care about is being able to use the tools. Thanks for your help.
I'm sorry I couldn't fully resolve your issue. There have been a few issues like this where it has been difficult to remotely debug an issue with brew. Usually, getting it to work on Travis is a good sign, but currently that is failing due to timeouts.
Sorry I don't have the cycles to hunt this down further myself.