![]() |
Library Not Loaded
Hi, I'm a newcomer and sm getting the following message when I try to execute a gfortran executable file:
dyld: Library not loaded: /usr/local/lib/libgfortran.3.dylib I've tried a few things posted before but didn't apparently work. Can anyone give me a hand? |
Do you have gfortran installed on your system? Probably need a little more info.
Have you located the libgfortran.3.dylib? If so, you can set the environment variable DYLD_LIBRARY_PATH with the path to the library. Brett |
Yes Brett, if I drag the file to the terminal it gives me a path, but if I type ls where it should be, I dont get anything. Should I still set the environment variable DYLD_LIBRARY_PATH with this path? How do I do that? Many tks.
|
Quote:
|
I don't understand what you are doing. What file are you dragging to the terminal? The library or the executable?
What shell are you using in the Terminal? What version of gcc are you using? Is the executable that you have something that you compiled? Which OS version do you have? Is it an intel or ppc? On the version that I have, the actual library is in /usr/local/gcc-4.3.4/lib Using csh, I would do this: setenv DYLD_LIBRARY_PATH /usr/local/gcc-4.3.4/lib and it should find it. However, if you didn't compile the program, run otool -L to see where executable thinks that it should look for the library. Maybe run Code:
otool -L executableBrett |
Dear Brett, I typed the library file on the finder and then dragged it to the terminal. As I listed the files in the directory, the lib file did not show.
I don't know which shell I am using. How can I find this out? The version is gcc 4.0.1. Yes, the executable is a compiled file. The OS version is OS X v 10.6.7 Intel core 2 Duo. The library seems to be at /usr/local/lib/i386 another identical file is at /usr/local/lib I understand I have to redirect where it looks for the library file. How do I use csh, though? Sorry, quite a few questions... |
Quote:
echo $SHELL You will most likely see: Code:
% echo $SHELLTrevor |
That what I get when I Type echo $SHELL: /bin/bash
|
Thanks hayne.
|
What is the response from the otool command?
What is the response from gcc -v? Thanks, Brett |
Sorry Brett.
This is what I get from otool: /usr/local/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.10) /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/local/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0) |
gcc -v gave me:
Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5646~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5646) Tks |
I'm not at home, so I can't check right away (no macs at work anymore), but I thought that otool -L would give some form of output like this (which is off of a linux box)
Code:
libg2c.so.0 => /usr/lib64/libg2c.so.0 (0x0000002a9557f000)I can check it out this evening. Your gcc wasn't compiled with gfortran, where did you get the fortan libraries from? Did you install the libraries without the compiler. If you have the compiler, what does it say when you do: Code:
gfortran -vQuote:
What is the output from the terminal of Code:
ls -lh /usr/local/lib/libg*I think that in finder, you can also hit apple-g and type in /usr/local/lib to view it in the finder. Brett |
Dear Brett,
gfortran -v gave me: Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/Users/brunohannud/Downloads/usr/local/bin/../libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/lto-wrapper Target: x86_64-apple-darwin10.7.0 Configured with: ../gcc-4.6.0/configure --enable-languages=fortran Thread model: posix gcc version 4.6.0 (GCC) I created the executable by typing gfortran -o executablefile sourcefile.for (is this what you're asking?) After the ls command I get: lrwxr-xr-x 1 root wheel 79B 23 Jun 15:48 /usr/local/lib/libgfortran.2.dylib -> /Library/Frameworks/R.framework/Versions/2.10/Resources/lib/libgfortran.2.dylib I think I created this file yesterday while attempting to follow the recommendation on the web to another similar problem. |
What file did you create yesterday?
Can you compile a hello world program in fortran? I also have a little bit of concern that you are using an older version of gcc than of gfortran. Brett |
Brett, I downloaded gfortran from http://www.webmo.net/support/fortran_osx.html
I followed what "horn" suggested here to create the lib file yesterday; http://openmx.psyc.virginia.edu/thread/316 Here's what I get for my HelloWorld: /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD ; exit; Neo-3:~ brunohannud$ /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD ; exit; dyld: Library not loaded: /usr/local/lib/libgfortran.3.dylib Referenced from: /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD Reason: image not found Trace/BPT trap logout |
Quote:
but your program is apparently looking for /usr/local/lib/libgfortran.3.dylib |
Please don't take this as a criticism. I think that you need to step back for a moment and maybe explain what you are trying to do, provide some EXACT steps on what you have done and results. Many of your answers seem contradictory and partial to me. I apologize that I don't get it, perhaps we just don't think alike, but it really isn't clear to me. This will probably be a long post. I learned tcsh first, so all of my commands are relative to tcsh. If you use bash, I know a few basics, but not much. You can get a tcsh by typing tcsh at the command line if your default shell is bash or sh.
I am certainly not an expert at compilers or fortran. About 5 years ago I was given some tasks at work that led me to figure out how to compile and run some fortran programs using g77 on 10.4. At some point I needed to upgrade to gfortran and then to gfortran on Leopard. I no longer need to do this work, so I have not tried development on 10.6. Much of what I have to say are observations that I have noticed, and may or may not be best practices. All of my experience was with command line applications, so I don't really know about Cocoa or the other APIs. My first belief is that the compiler should be stand alone, that is, all of the compilers and components, such as libraries, include files, etc, should be contained in a single directory. This will allow you to have different versions of gcc. These should be installed in /usr/local. I personally prefer to define which version is used in my path, but you can put softlinks in /usr/local/bin. Once you have your compiler in /usr/local, make sure the compiler that you want to use is at the top of your path. You can test this with the command Code:
where gcc
Now it seems like #2 may or may not be done correctly, it is clear that #3 is not working. So let us work on getting fortran working. Here is a very simple Hello World program, name it hello.f Code:
program mainCode:
~/work/>gfortran hello.fHere is an example of an C executable with a missing library. Code:
~/libTest/src/>a.outWhere did the compiler install? In my case it installed the directory gfortran in /usr/local. Code:
total 0Code:
/usr/local/>I don't believe that this is needed, but just for completeness Code:
/usr/local/>find /usr/local/gfortran -name 'libgfort*'Perhaps you should try and duplicate this post and let us know how it goes. On a side note. I haven't really used dynamic libraries too much. It turns out otool -L reports the library paths that were used at compile time, but does not give any information about the status of the actual library. Code:
otool -l library fileLet us know how it works out. Brett |
Thanks Brett. I will work on this during today. I just realized (!!!) that the programs I want to run are written in F77L Fortran v5.01.
I'll try to start from the beggining and install a version of this compiler. I'll follow your instructions and let you know how it goes. |
Should I unistall everything? How do I go on doing that? Tks
|
Just discovered gfortran is compatible with the f77.
|
X Code reinstalled...
|
Created a /usr/local/bin path: "export PATH=$PATH:/usr/local/bin
|
locate gfortran gave me: /usr/local/lib/libgfortran.2.dylib
|
version gfortran 4.2.3 from here: http://r.research.att.com/tools/
|
Tried to run HelloWorld and this is what I got.
Neo-3:~ brunohannud$ /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD.FOR dyld: Library not loaded: /usr/local/lib/libgfortran.3.dylib Referenced from: /Users/brunohannud/Documents/Doutorado/ExecutaveisTurns/HELLOWORLD Reason: image not found Trace/BPT trap |
Neo-3:~ brunohannud$ cd /usr/local/lib
Neo-3:lib brunohannud$ ls ImageMagick-6.6.1 libgcc_s_ppc64.1.dylib libgfortran.dylib gcc libgcc_s_x86_64.1.dylib libgfortran.la libgcc_s.1.dylib libgfortran.2.0.0.dylib libpolar-3.1.4.dylib libgcc_s.10.4.dylib libgfortran.2.dylib ppc64 libgcc_s.10.5.dylib libgfortran.a x86_64 |
YES!! HEllo World Working!!!!!!!
|
Good. Do you need more help, or can you take it from here?
Brett |
Brett, Thank you immensely. Straight logic... magic from your side. I'll try to take it from here.
|
| All times are GMT -5. The time now is 10:38 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.