SuperNEMO-DBD / homebrew-cadfael

Instructions on using/installing the SuperNEMO Software are now at: https://github.com/SuperNEMO-DBD/brew
MIT License
2 stars 1 forks source link

curl 7.45 fails to install #5

Closed xgarrido closed 8 years ago

xgarrido commented 8 years ago

curl 7.45 fails to install (see https://gist.github.com/anonymous/83891c0a9d66cfd3e3e4 for brew log). I did on a fresh cadfael install and everything were working until curl

drbenmorgan commented 8 years ago

I'd suspect this is the cadfael install of binutils clashing with the system binutils. Try

$ brew install curl

to confirm the error outside cadfael, then assuming it's still there do

$ brew rm binutils
$ brew install curl

If that works it's definitely binutils. What system GCC and binutils is this machine on?

xgarrido commented 8 years ago
$ brew rm binutils
$ brew install curl

works.

gcc version is 5.3.0 and ld -v gives me GNU ld (GNU Binutils) 2.26.0.20160219. By the way, I also got a similar issue when installing ninja and removing binutils solves it.

drbenmorgan commented 8 years ago

For your use case, it's probably best to install "cadfael" sans gcc49, since you might as well use 5.3 if you have it :smile: (there are also, possibly, awkward binary issues in using a cadfael gcc49 with system gcc5 depending on if/when Arch switch to using the new gcc ABI). Could you check that a fresh brew clone in a clean environment uses the system gcc 5:

$ git clone https://github.com/SuperNEMO-DBD/cadfaelbrew.git
$ ./cadfaelbrew/bin/brew sh
$ brew env
... check that system gcc5 is used ...
$ brew install -v hello
... check that this uses gcc5 from the system ...

This is a failing of the cadfael Formula, as it assumes all Linucies have gcc < 4.9 and binutils < 2.25. I'll have a think about how best to fix this, but in the meantime, the fastest way around this would be to do install the bayeux formula to pick up all the dependencies, then uninstall bayeux (though it shouldn't hurt a development environment if it's there).

It's possible that not all of the Formulae will compile, but let's see how far things get.

I could also look at updating binutils, but that wouldn't solve the possible gcc4/5 ABI issue.

xgarrido commented 8 years ago

brew env does not work and doesn't even exist as brew command (Error: Unknown command: env). Do you just mean env ?

brew install -v hello shows me another problem : I also have clang 3.7.1 installed on my machine and it seems that brew try to favor it against gcc, am I wrong ? I can remove it from my machine in order to only use gcc or maybe I can overload CC and CXX variables to force the use of gcc.

After that, I had tried to do cadfaelinstallation without gcc49 dependency (as well as binutils) by commenting these lines https://github.com/SuperNEMO-DBD/homebrew-cadfael/blob/master/cadfael.rb#L16 otherwise installing bayeux implies the installation of cadfael and thus gcc49... By removing gcc49 dependency I also face a problem when installing boost and seems related to clang/gcc clash on my machine. So, how can I force brew to use gcc instead of clang ?

drbenmorgan commented 8 years ago

brew env does not work and doesn't even exist as brew command (Error: Unknown command: env). Do you just mean env ?

Sorry, this was my mistake, it should have been brew --env

brew install -v hello shows me another problem : I also have clang 3.7.1 installed on my machine and it seems that brew try to favor it against gcc, am I wrong ? I can remove it from my machine in order to only use gcc or maybe I can overload CC and CXX variables to force the use of gcc.

Homebrew's default compilers can be overridden with the HOMEBREW_CC and HOMEBREW_CXX environment variables. You could also try symlinking from HOMEBREW_PREFIX/bin/gcc-5.3 -> /usr/bin/gcc-5.3 (adjust for the correct name on your system).

One thing though, does clang appear before gcc in your PATH? I have a mixed clang/gcc setup with them in the same place in PATH and brew's always picked up gcc.

After that, I had tried to do cadfaelinstallation without gcc49 dependency (as well as binutils) by commenting these lines https://github.com/SuperNEMO-DBD/homebrew-cadfael/blob/master/cadfael.rb#L16 otherwise installing bayeux implies the installation of cadfael and thus gcc49... By removing gcc49 dependency I also face a problem when installing boost and seems related to clang/gcc clash on my machine. So, how can I force brew to use gcc instead of clang ?

On the last point, hopefully the above solves that issue. Note that installing bayeux does not require an install of cadfael - bayeux fully defines its dependencies so they will be pulled in as required. It does not depend on gcc or binutils. The cadfael formula is purely a "convenience" wrapper to install other formulae and has no purpose or functionality beyond that.

xgarrido commented 8 years ago

One thing though, does clang appear before gcc in your PATH? I have a mixed clang/gcc setup with them in the same place in PATH and brew's always picked up gcc.

I have both installed in /usr/bin so I don't know which one should be picked first.

Sorry, this was my mistake, it should have been brew --env

Here the output

CC: /usr/bin/gcc
CXX: /usr/bin/g++
OBJC: /usr/bin/gcc
OBJCXX: /usr/bin/g++
CFLAGS: -Os -w -pipe -march=core2
CXXFLAGS: -Os -w -pipe -march=core2
CPPFLAGS: -isystem/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/include
LDFLAGS: -L/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/lib -Wl,-rpath,/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/lib
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew
PKG_CONFIG_LIBDIR: 
PATH: /home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/bin:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/bin:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/bin:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/bin:/home/garrido/.bin:/home/garrido/Development/go/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/garrido/.fzf/bin:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/Library/Taps/supernemo-dbd/homebrew-cadfael/cmd:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/Library/ENV/scm:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/Library/Taps/supernemo-dbd/homebrew-cadfael/cmd:/home/garrido/Workdir/NEMO/supernemo/snware/brew/cadfaelbrew/Library/ENV/scm

So it looks like GNU compiler is the one picked by brew (so far I didn't set HOMEBREW_[CC|CXX] variables but when I install hello, I then get something like that

configure: WARNING: unrecognized options: --disable-debug
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... /usr/bin/clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to accept ISO C89... none needed
checking whether /usr/bin/clang understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of /usr/bin/clang... none
checking how to run the C preprocessor... /usr/bin/clang -E

....

checking for ld used by /usr/bin/clang... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes

As far as I understand the configuration uses clang. I got the same result with HOMEBREW_[CC|CXX] variables set.

xgarrido commented 8 years ago

I have now removed clang on my machine. brew --env still gives me GNU compiler as default CC compiler but when I try to install hello program, I then get this error message

Error: hello cannot be built with any available compilers.
To install this formula, you may need to:
  brew install gcc
drbenmorgan commented 8 years ago

Hmm, I suspect this is the same issue as reported in Linuxbrew/linuxbrew#517 and Linuxbrew/linuxbrew#452. Try the one of the solution in the latter which is to do, adapted for GCC 5

ln -s /usr/bin/gcc `brew --prefix`/bin/gcc-5
ln -s /usr/bin/g++ `brew --prefix`/bin/g++-5
which -a gcc-5 g++-5

This shouldn't require setting HOMEBREW_{CC,CXX} and should get hello building. If that does work, try reinstalling system clang and remove/reinstall hello to see if still prefers it.

xgarrido commented 8 years ago

ln -s /usr/bin/gcc brew --prefix/bin/gcc-5 ln -s /usr/bin/g++ brew --prefix/bin/g++-5 which -a gcc-5 g++-5

works. I'm installing bayeux to get all dependencies. I will report any errors in another issue for clarity.