gcc 4.6 on mac, how do I get it to work?

放肆的年华 提交于 2020-01-05 11:07:10

问题


I am having problems getting gcc 4.6 to run on Mac 10.8.5.

My experience with such matters is very limited and I have been searching around and trying different things to get this to work, but to no avail. I am sorry if the answer to this problem is really simple (I actually hope that it is!)

This is my problem:

I need to run a bit of software to do an analysis, called Bayescan. This bit of software requires a library found as part of gcc4.6 to run on a MacOSX. They say so on their distribution pages (http://cmpg.unibe.ch/software/BayeScan/download.html)

I have now installed gcc4.6 using homebrew*.

However, this does not solve my problem. As I still get the following error message when I try to run the software:

dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib

Google tells me that libgomp.1.dylib is part of gcc46.

When I type: gcc --version, I get:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin12.5.0

This leaves me to believe that when my computer is looking for gcc, it looks for the old version which lacks the required library. Or gcc4.6 is not installed correctly.

So I have two questions:

1) Is my assumption/conclusion correct?

2) How do get my computer to point to gcc4.6?

Thank you in advance for any help that you can provide. This issue is driving me a little crazy.

Is there a good resource for learning how to build environments and organise dependencies, as it is a problem that I often encounter?

(*I was advised to use homebrew but I think its a bit of a waste of time for me as my computing knowledge is not sufficient for it to be a useful tool for me as the documentation is pretty limited).


回答1:


You need to point your software to use the right GCC. The gcc46 installation probably put the compiler binary at /usr/local/opt/gcc46/bin/gcc-4.6 or perhaps at /usr/local/bin/gcc-4.6, depending on installation options, so use whatever option is available to make it use that compiler.




回答2:


Thank you for your answers.

I managed to find out the problem and have the software running. I did two things:

1) As suggested, alter my $PATH so that it pointed at the correct gcc compiler, which was a matter of finding where homebrew had placed the link usr/local/lib/ so I pushed that to the front of $PATH

2) Also, I had to locate where homebrew had installed the library libgomp.1.dylib, and I then made a link to that within usr/local/lib

Thanks again!



来源:https://stackoverflow.com/questions/21287150/gcc-4-6-on-mac-how-do-i-get-it-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!