3

I updated my Mac to OS X 10.9 GM, then I found that gfortran does not work. When building any program, it shows:

ld: library not found for -lcrt1.10.5.o collect2: ld return 1 

Does anyone know how I might solve this?

7
  • You can compile with ifort? Because as I see here you shouldn't be able to compile with ifort neither, but at least with it you have an answer. Commented Oct 9, 2013 at 0:42
  • I don't have ifort.It's not free, right? Commented Oct 9, 2013 at 1:11
  • ifort is free for non-commerical & non-academic use. Commented Oct 9, 2013 at 1:12
  • Did you update from 10.5 to 10.9? Commented Oct 9, 2013 at 1:13
  • no, from 10.8.5. Ifort for linux is free, but there's no free version for mac. Commented Oct 9, 2013 at 1:18

3 Answers 3

4

This problem is because OS X 10.9 has removed the /Developer directory completely where the library crt1.10.5.o used to locate. The libraries have been moved to the new Xcode directory (make sure that Xcode is also updated to the latest version 5.0.1+). I found that crt1.10.5.o is actually hidden deep in here /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S‌​DKs/MacOSX10.9.sdk/usr/lib. I believe there should be a way to redirect ld automatically, but I do not know how. So for now I am using the -L flag to compile.

gfortran ... -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S‌​DKs/MacOSX10.9.sdk/usr/lib/ 

This works for me as a temperary solution. I am also waiting for better solutions to come up.

Sign up to request clarification or add additional context in comments.

Comments

3

Gfortran has already been compiled for Mac OS X Mavericks 10.9 by http://hpc.sourceforge.net/

First, cd to the root of your Mavericks installation so the files extract recursively into the proper folders

cd / sudo wget http://prdownloads.sourceforge.net/hpc/gcc-4.9-bin.tar.gz tar -xvf gcc-4.9-bin.tar.gz gfortran --help 

Comments

0

I had similar problems (ld: library not found for -lcrt0.o) but I discovered that they went away when I stopped using the -static flag with the gfortran command. The -static-libgcc flag seems to be OK.

1 Comment

I don't see where in the original question he stated he is using the -static flag?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.