-
Notifications
You must be signed in to change notification settings - Fork 296
brew does not specify that GCC must prefer custom libraries for building (example: mpfr) #9
Comments
I'd like to add that after solving the two issues I posted 2 hours ago, I successfully built gcc-4.8, nice! |
The only three solutions that come to mind are
This post seems relevant: |
I'd recommend the second in the short term and third in the long term. |
Actually the thing with the RPATH is for running executables and I already made a post about that (in which I mention using patchelf to set the rpath after compilation because the linker might not support setting rpath while linking in an earlier issue: ). See here: #7 This question pertains only to building, in which it is sufficient to just prepend to the LD_LIBRARY_PATH variable only for the building phase. I have this vague recollection that homebrew uses a "clean" environment for building so it would be sufficient to just inject the LD_LIBRARY_PATH with the HOMEBREW_LIB folder and Bob's your uncle, no need to mess with the standard library path. Changing LD_LIBRARY_PATH systemwide may be good for developers who use projects in-house and have full control over everything installed on the PC's, but for someone who needs their (other) stuff to run on normal debian/ubuntu/fedora/..., this is not such a great thing. |
It shouldn't be necessary to set LD_LIBRARY_PATH when building Homebrew packages unless you are you using compiler tools (i.e. binutils and GCC) built by Homebrew. Are you? |
No, as a matter of fact I was busy trying to build gcc-4.8 with the stock debian wheezy gcc-4.7. To build gcc-4.8 you need other libraries like (mpfr afaik) and those need yet others. Thankfully, homebrew builds all necessary dependencies. Unthankfully, it doesn't know (by default) where to look for the libraries it just built. Unless you start tampering with LD_LIBRARY_PATH or similar that is. Luckily for us in the build phase it's easy to just prepend to LD_LIBRARY_PATH for that run. Which is exactly what I did with my commandline which made the gcc-4.8 compile work: # mpfr is a requirement of gcc, building it separately
$ LD_LIBRARY_PATH=/my/homebrew/lib brew install mpfr
# alternatively (but messes up the loader path of the current shell session)
$ export LD_LIBRARY_PATH=/my/homebrew/lib:$PATH
$ brew install mpfr So to summarize: For running applications in a safe way that doesn't interfere with the standard OS loading path we still need an agreed upon solution. One that I like a lot is setting the RPATH on every executable produced by homebrew. It's a pretty clean solution. For building applications it's much easier, the LD_LIBRARY_PATH can be altered without fear of messing up the systemwide path, which is what I did to build gcc-4.8. What do you think? If we solve these things it will become far easier to just install and use homebrew for linux for quite a wide range of software, which I'm eager to see happen... |
For what it's worth, it seems that it's only necessary to set If you remove this line, it compiles fine without setting Cheers, |
That's... unexpected (to me). I really didn't think most of these things would work if they don't even know where
Great! |
Here's another article on RPATH: |
Nice, I'm starting to think more and more that the I'm also wondering how it might interact with scripts that try to package homebrew-built apps (https://github.com/tmm1/brew2deb) into packages (.deb, .rpm, ...). I'm guessing at the very least that |
Add some basic documentation. Closes #10. Add ruby 1.8.6 requirement For now, it seems that homebrew-core requires Ruby 1.8.6 Known limitations of Ruby 1.8.5: * RUBY_PATCHLEVEL is not defined * instance_variable_defined? is not defined * pathname.rb:223 - 'Digest::SHA2' => 'Digest::SHA256' is necessary Closes #12 Closes #15 Add instructions to set LD_LIBRARY_PATH in .bashrc Closes #9
Ideally the RPATH would be set at link time, but making this happen for all the different build environments could be challenging. It's probably easier to patch the executable after installation, as you suggest. On OS X, the executable can be modified like so:
|
Awesome! But is it necessary on OSX? I recall using homebrew on my macbook all the time and it works great. Or has the installer secretly changed something LD_LIBRARY_PATH like? It seems indeed more general to change the RPATH after the fact, but perhaps the LLVM linker also supports it, who knows. That would be at least the two big build environments. At any rate, for ELF binaries there appear to be these two (well, three...) options: A nice article about it: http://blog.tremily.us/posts/rpath/
I've had success with EDIT: a distinct disadvantage of |
Add some basic documentation. Closes #10. Add ruby 1.8.6 requirement For now, it seems that homebrew-core requires Ruby 1.8.6 Known limitations of Ruby 1.8.5: * RUBY_PATCHLEVEL is not defined * instance_variable_defined? is not defined * pathname.rb:223 - 'Digest::SHA2' => 'Digest::SHA256' is necessary Closes #12 Closes #15 Add instructions to set LD_LIBRARY_PATH in .bashrc Closes #9
Add some basic documentation. Closes #10. Add ruby 1.8.6 requirement For now, it seems that homebrew-core requires Ruby 1.8.6 Known limitations of Ruby 1.8.5: * RUBY_PATCHLEVEL is not defined * instance_variable_defined? is not defined * pathname.rb:223 - 'Digest::SHA2' => 'Digest::SHA256' is necessary Closes #12 Closes #15 Add instructions to set LD_LIBRARY_PATH in .bashrc Closes #9
Add some basic documentation. Closes #10. Add ruby 1.8.6 requirement For now, it seems that homebrew-core requires Ruby 1.8.6 Known limitations of Ruby 1.8.5: * RUBY_PATCHLEVEL is not defined * instance_variable_defined? is not defined * pathname.rb:223 - 'Digest::SHA2' => 'Digest::SHA256' is necessary Closes #12 Closes #15 Add instructions to set LD_LIBRARY_PATH in .bashrc Closes #9
Add some basic documentation. Closes Linuxbrew/legacy-linuxbrew#10. Add ruby 1.8.6 requirement For now, it seems that homebrew-core requires Ruby 1.8.6 Known limitations of Ruby 1.8.5: * RUBY_PATCHLEVEL is not defined * instance_variable_defined? is not defined * pathname.rb:223 - 'Digest::SHA2' => 'Digest::SHA256' is necessary Closes Linuxbrew/legacy-linuxbrew#12 Closes Linuxbrew/legacy-linuxbrew#15 Add instructions to set LD_LIBRARY_PATH in .bashrc Closes Linuxbrew/legacy-linuxbrew#9
I'm on debian wheezy
I have a libmpfr installed through apt-get, and develop a lot with standard debian dev packages, which is why I can't put /my/homebrew/lib in
LD_LIBRARY_PATH
. However this becomes problematic while building with homebrew, as it now prefers the system paths to the homebrew paths, therefore including the old libmpfr in my case. A stopgap solution that works for me is:Which compiles and tests just fine. I'm not sure what the best way is to go about fixing this, so I'm not suggesting anything yet.
I don't really think it would be a good solution to just put the homebrew libs folder at the front of the library search path system-wide, as it could wreak havoc on other development activities. This doesn't just go for debian, but pretty much any distro with a package manager, I believe.
Any comments?
The text was updated successfully, but these errors were encountered: