-
Notifications
You must be signed in to change notification settings - Fork 295
gcc, binutils: link to Cellar instead of system libs #200
Conversation
Does this patch resolve your issue with GCC not finding |
This fixed the issue with the |
That's great! Can you report the result of
int main() { return 0; } |
Results of Testing gcc
==> /usr/local/linuxbrew/Cellar/gcc/4.9.2/bin/gcc-4.9 -o hello-c hello-c.c
==> /usr/local/linuxbrew/Cellar/gcc/4.9.2/bin/g++-4.9 -o hello-cc hello-cc.cc
==> /usr/local/linuxbrew/Cellar/gcc/4.9.2/bin/gfortran -c in.f90
==> /usr/local/linuxbrew/Cellar/gcc/4.9.2/bin/gfortran -o test in.o Results of Reading specs from /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/specs
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-native-system-header-dir=/usr/local/linuxbrew/include --with-build-time-tools=/usr/local/linuxbrew/Cellar/binutils/2.24/x86_64-unknown-linux-gnu/bin --with-boot-ldflags='-static-libstdc++ -static-libgcc -L/usr/local/linuxbrew/lib -Wl,--dynamic-linker=/usr/local/linuxbrew/opt/glibc/lib/ld-linux-x86-64.so.2 -Wl,-rpath,/usr/local/linuxbrew/lib' --prefix=/usr/local/linuxbrew/Cellar/gcc/4.9.2 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.9 --with-gmp=/usr/local/linuxbrew/opt/gmp --with-mpfr=/usr/local/linuxbrew/opt/mpfr --with-mpc=/usr/local/linuxbrew/opt/libmpc --with-cloog=/usr/local/linuxbrew/opt/cloog --with-isl=/usr/local/linuxbrew/opt/isl --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion='Homebrew gcc 4.9.2 --with-glibc' --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --disable-multilib
Thread model: posix
gcc version 4.9.2 (Homebrew gcc 4.9.2 --with-glibc)
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1 -quiet -v hello.c -quiet -dumpbase hello.c -mtune=generic -march=x86-64 -auxbase hello -version -o /usr/local/tmp/ccHNKIqH.s
GNU C (Homebrew gcc 4.9.2 --with-glibc) version 4.9.2 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory "/usr/local/linuxbrew/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include
/usr/local/include
/usr/local/linuxbrew/Cellar/gcc/4.9.2/include
/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include-fixed
End of search list.
GNU C (Homebrew gcc 4.9.2 --with-glibc) version 4.9.2 (x86_64-unknown-linux-gnu)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.2-p10, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 298d3c6a8cfe9994c02db8ddb6df3ac0
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
as -v --64 -o /usr/local/tmp/ccThhMC2.o /usr/local/tmp/ccHNKIqH.s
GNU assembler version 2.24 (x86_64-unknown-linux-gnu) using BFD version (GNU Binutils) 2.24
COMPILER_PATH=/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/
LIBRARY_PATH=/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 'hello' '-mtune=generic' '-march=x86-64'
/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/collect2 -plugin /usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/liblto_plugin.so -plugin-opt=/usr/local/linuxbrew/Cellar/gcc/4.9.2/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper -plugin-opt=-fresolution=/usr/local/tmp/ccNc5bQn.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -rpath /usr/local/linuxbrew/lib --dynamic-linker /usr/local/linuxbrew/opt/glibc/lib/ld-linux-x86-64.so.2 -o hello /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/crt1.o /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/crti.o /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/crtbegin.o -nostdlib -L/usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2 -L/usr/local/linuxbrew/lib /usr/local/tmp/ccThhMC2.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/crtend.o /usr/local/linuxbrew/Cellar/gcc/4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/crtn.o |
@jrevillard Does this patch fix your gfortran issue in #135? |
In your |
Mine does not
|
I made another change that I thought was unrelated but maybe you can try it and see if it changes anything. I added a configure flag |
I wasn't experiencing a gfortran issue but I think it's all working fine. |
Also, I wrote this after linking this by hand, so I haven't had the chance to actually reinstall |
I won't have time to look into this issue real soon. It would be great if you have time to test these ideas yourself, and if not, I'll get to it, but it may be a little while. This Christmas is busy busy. |
No problem I'll get on it. |
Hi, Good to see that it's progressing :-). Unfortunatly, for me gcc does not compile anymore (I think that this is like this since the usage of the bottles.
For information, I'm compiling on SL5 using the gcc44 compiler. I will try without the bottles to see if it works better. Best, |
@jbaum98 , @sjackman ... what can I say ... YOUHHHHHHHHOUUUUUUU ! :-) It works, my gfortran works with the standalone installation using the very last version of your gcc formula!
Thanks a million for your work guys! Best, |
I'm glad its working for you @jrevillard! Just curious, did you reinstall |
No simply because I did not notice it before merging your patch to my repo :-) |
No problem I was just curious whether or not it was necessary on other computers, and I guess it is not. |
Excellent news! Thanks for your solution @jbaum98 and for your help troubleshooting @jrevillard. I probably won't find time to merge this until the new year, but I look forward to getting this fixed once and for all. A working Fortran compiler will be a big improvement for scientific computing using a standalone installation of Linuxbrew. |
ef22f95
to
6043554
Compare
Thanks a lot to all of you! I had the same troubles with crti.o on an ubuntu 12.04 where I´m not root. This patch works perfectly! |
if OS.linux? | ||
@link = Pathname.new "#{prefix}/x86_64-unknown-linux-gnu/bin" | ||
@link.parent.mkpath | ||
@link.make_symlink "#{HOMEBREW_PREFIX}/lib" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of this chunk? Does GCC search "#{prefix}/x86_64-unknown-linux-gnu/bin"
for libraries? Seems odd to search bin
for libs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does seem a little strange, but what I figured out was that the libs need to be passed to xgcc
in -B
options, and this is one of the default locations. I couldn't figure out a way to control what was passed to xgcc
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's also relate to the GCC_EXEC_PREFIX
environment variable: https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#Environment-Variables
@jbaum98 to better answer your question about your modification of binutils, in fact, glibc does not compile anymore with your modification, reverting your change make it compile without any issue. Best, |
thanks for you work, this PR helped a lot. I installed a standalone linuxbrew on OpenSuse and so far managed to install |
So I managed to build GCC with this patch but attempting to build Homebrew packages using the new GCC results in the following error:
I simply edited |
Looks like #404 where it ignores HOMEBREW_CC. Using --cc=gcc4.9 should fix the problem |
This bug should be fixed upstream by Homebrew/legacy-homebrew@43c634f, which has been merged. |
Can issues discussed here be related to the problems I'm encountering in #530? I may also be encountering the |
@jrevillard I believe that 9318c13 should fix the I'm going to close this PR. Thanks for all your help in troubleshooting. If you still have current issues, please do comment or open a new issue to discuss them. |
Symlinks
linuxbrew/lib
to Cellar forgcc
, wheregcc
will automatically look because that is the prefix. Should fix the issue discussed recently in #107.