libgfortran
Hi all: I have followed the responses to Marcel's problem under another topic. His problem looks like mine. I've used Fortran77/95/etc on many other platforms but this is my first encounter with a Unix-based system and gfortran. I'm compiling a 2-line test program:
write(6, '(A)') "hello"
end
The gfortran output is:
charles-crawfords-macbook-2:src charlescrawford$ gfortran -o test test.f
/usr/bin/ld: warning unknown -macosx_version_min parameter value: 10.5.8 ignored (using 10.4)
/usr/bin/ld: can't locate file for: -lcrt1.10.5.o
collect2: ld returned 1 exit status
charles-crawfords-macbook-2:src charlescrawford$
The two warning/error comments make me think I have version problems. As far as I can tell there is no file whose name matches "*crt1*" anywhere in /usr. The gfortran I have comes from a downloaded file "gfortran-4.3-jan08.mpkg.zip". It is not the first gfortran I have installed,but I think I have uninstalled previous version ones. I am running OS X v. 10.5.8.
In looking through other forums I see "libgfortran" may be, true to its name, the runtime library for gfortran. I cannot find a file by that name. Do I need it? Where would I find it?
Thanks in advance for any help
Chuck



libgfortran
Where did you download the file "gfortran-4.3-jan08.mpkg.zip" from?
You are right, libgfortran is gfortran's runtime library. I can't tell you where to find it, that depends on where your installer has put the file. If the fortran compiler from the above package works for other users, then you most likely are experiencing some interference with left-over files from your previous installation.
I'd first check whether the gfortran binary you are using matches the one that should be installed by the package, i.e. does "which gfortran" show the same path as the one that is shown in your mpkg's Archive.bom file?
In case you don't know what I'm talking about here: .mpkg's and .pkg's are just directories, you can simply change to the directory in the Terminal and inspect the files there. The .mpkg should simply be a collection of .pkg directories, and in each .pkg directory, you should find a file called Archive.bom (most of the time, it is in a subdirectory called "Contents"). Archive.bom contains a list of the files that are going to be installed by the package. You can list its contents using "lsbom Archive.bom"
You could also try to find where the installer is supposed to put libgfortran by inspecting the archive files.
Another idea: what does "otool -L `which gfortran`" say? (these are backquotes). It should give you the libraries your gfortran is linked against.
Btw: does gfortran produce a binary, or does it just guve the error message and then stop?
libgfortran
Thanks for the help. I tried your last idea with some modifications and got:
charles-crawfords-macbook-2:bin charlescrawford$ otool -L gfortran
gfortran:
/usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9)
I assume the libSystem.B.dylib may be one of my problems since the current version doesn't match the compatibility version. I got a simlar response from "otool -L gcc".
But there may be more.
In answer to one of your questions, no, gfortran does not produce any output file. So if libSystem.B.dylib is dynamically linked, that's not my current problem.
Your help with the Archive.bom files has given me more places to look for incompatibilities. Is the Archives.bom file for the currently installed version saved anywhere as part of the installation process? What is involved in completely uninstalling a version? For my attempts to uninstall, I have been using a form of "sudu remove /usr/..." mentioned on one MacResearch wiki. Being a newbie, I don't have anything installed in /usr that I can't easily reinstallso I can afford to be reckless. All the other stuff is elsewhere on my MAC HD.
Thanks again for your help.
Chuck
ibgfortran
Sorry for the delay, I've been out for a week...
Yes, the Archive.bom file is saved as part of the installation process. The location depends a bit on your OS version and the kind of packages:
* On Leopard, these files used to go into /Library/Receipts. A receipt is simply the .pkg file without the "payload", i.e. it does not contain the actual data, but it still contains Archive.bom, among some other files.
* There are also "new style" packages, where the list of installed files goes into /Library/Receipts/boms/packagename.bom
* On Snow Leopard, these "new-style" receipts seem to go to /private/var/db/receipts
There is also a utility called "pkgutil" (see "man pkgutil") which I believe is the "Apple way" to deal with package receipts, wherever they might be stored on your disk. With pkgutil you can search for packages, list the files that have been installed by a package, and also identify to which package a file on your disk belongs. It can, however, not uninstall packages. [Yes, you did read correctly: "The world's most advanced OS" does not have an uninstall command.]
There used to be a program called "Desinstaller", which could uninstall packages when given a receipts, but I'm not sure whether it works with the "new-style" receipts. I usually want to know which files get deleted from my hard drive anyway, so I usually delete them by hand.
But coming back to your problem: Did you check whether the "gfortran" you are executing is the one that is supposed to be installed by your package file? I.e.: What does "which gfortran" say, and is this the same path as the one in your Archive.bom?
If you don't find an easy fix to your problem, it might be the most efficient way to just uninstall everything that got installed by a packages somehow related to gfortran, and then install a gfortran package that has been reported to work by other users.