I’m currently attending a course about programming languages used for mathematics you I also inevitable got to know Fortran. Everything worked like a charm under Linux but now that I’ve moved to MacOSX as client system I also wanted to get it working under this OS.
Well, let’s say you have a library in Fortran named testlib.f and a main program written in C with the name main.c. Normally you would make a Makefile more or less like this:
main: main.o testlib.o g77 -o main main.o testlib.o main.o: main.c gcc -c main.c testlib.o: testlib.f g77 -c testlib.f
Looks OK and would probably work under Linux. But not so on Tiger. There you will get something like this as error:
/usr/bin/ld: Undefined symbols: _fprintf$LDBLStub _fscanf$LDBLStub _printf$LDBLStub collect2: ld returned 1 exit status make: *** [interpolation] Error 1
This is probably caused by different versions of the compiler used for compiling the Fortran library and the C main program…
$ gcc -v gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)
$ g77 -v gcc version 3.4.2
Indeed. Solving this is actually quite simple since gcc-3.3 (which is also bundled with Tiger) seems to be compatible with g77 of the gcc-3.4.2 package :-) So simply replace the gcc calls in the Makefile with gcc-3.3 calls, and it should work :)
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π