![]() |
Library not loaded?
I am trying to install a program for my research and when i set the path and try and execute it i get this error
dyld: Library not loaded: /usr/local/lib/libgfortran.2.dylib Referenced from: /Users/Olson/Documents/Research/Modelfree/modelfree4_mac/Intel/modelfree4 Reason: image not found Trace/BPT trap ...I try and make that directory, it says permission denied. Thanks in advance. |
The directory: /usr/local/lib/ should exist already. It probably doesn't have the file: libgfortran.2.dylib in it. What are you trying to install?
|
Quote:
Quote:
sudo mkdir /usr/local sudo mkdir /usr/local/lib However, just making the directory is not going to solve the problem. How did you install this 'modelfree4'? It's referencing dynamic libraries that you apparently don't have installed, which makes me think that it was not installed properly. Trevor Trevor |
Can't be 100% sure, but that "libgfortran" sure looks like it might be part of the GNU Compiler Collection (GCC) Fortran run-time. I get this impression from the Google hits on libgfortran.
|
Quote:
|
That might be correct. It's the traditional Unix place of putting things that the user installs themselves, instead of being part of the distro's collection of apps.
Trevor |
Someone else set it up for me, but I have gcc4.2 installed on my system. It is installed in /usr/local/gcc4.2. In the lib directory, not /usr/local/lib, libgfortran.2.dylib is in there, but it is just a link to another library.
I am not sure if Xcode installs gfortran. Do you have gcc installed on your machine? Have you done a search for the library? You could try setting you DYLD_LIBRARY_PATH variable to point to it, if you can find the library, although that is a cludge. Also, I find otool -L helpfull in making sure that your executable sees all of the libraries that you think it should see. Good Luck, Brett |
try
Code:
locate libfortranCode:
/sw/lib/gcc4.2/lib/fortran.2.dylibSometimes, if you have the lib, but not in the location where some software is looking for it, you can make a symbolic link to it in the place where the software is looking for it. This usually works, unless the dylib itself is messed up. And as brettgrant99 said, try using otool -L on your executable, as well as your dylib. This will tell you where your executable looks for the dylib. Also, the dylib itself must have a working reference to itself in order for the linker to connect it to your executable at runtime, and running otool -L on the dylib will reveal if this is broken or not (that is, if you even have the dylib). You can post the result, and someone here should be able to interpret its meaning. |
when i try the locate libfortran nothing comes up. I also tried otool -L modelfree4 and this comes up...
otool: can't open file: modelfree4 (No such file or directory) not sure what to do or install thanks for the help |
Quote:
Code:
otool -L /Users/Olson/Documents/Research/Modelfree/modelfree4_mac/Intel/modelfree4 |
This is the printout of what hayne had suggested, not sure what it all means. Thanks hayne.
/Users/Olson/Documents/Research/Modelfree/modelfree4_mac/Intel/modelfree4: /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 192.15.0) /usr/local/lib/libgfortran.2.dylib (compatibility version 3.0.0, current version 3.0.0) /usr/local/lib/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.4) |
Your otool output:
/Users/Olson/Documents/Research/Modelfree/modelfree4_mac/Intel/modelfree4: /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib (compatibility version 1.0.0, current version 192.15.0) /usr/local/lib/libgfortran.2.dylib (compatibility version 3.0.0, current version 3.0.0) /usr/local/lib/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.4) This means it looks for libgfortran at the path: /usr/local/lib/libgfortran.2.dylib But you probably don't have libgfortran, since locate didn't find it. You could try installing gcc42 with fink, then put a symbolic link pointing to /sw/lib/gcc4.2/lib/libgfortran.2.dylib at usr/local/lib/libgfortran.2.dylib. That is, go to the fink website and download and install fink if you don't already have it. Once that is finished, go to terminal and type Code:
sudo fink install gcc42Code:
sudo ln -s /sw/lib/gcc4.2/lib/libgfortran.2.dylib /usr/local/lib/libgfortran.2.dylibEDIT: I just downloaded modelfree4 and tried it, got your error, then made the link I suggested above, and now modelfree4 starts and complains that there are no input files. I presume it must be working now, since I don't actually have any input files for it, and it gets far enough to complain about it :) EDIT 2: I found the test files that come with it, it's chugging away as I write. |
The fink website seems to be down, are there any other porting programs that are suitable? Also, what is gcc42 and where would i get it? Thanks for your help.
|
I found Fink 0.8.1 but now which gcc do i download, the fortran one or just regular gcc?
|
Looks like fink is down for a few days. You could try macports. Or you can wait for fink to come back up, or you can dig around a bit, maybe you will find it. You want gcc 4.2. If you get fink going, you can run the command I posted above to get gcc 4.2:
Code:
sudo fink install gcc42Code:
fink list gccgcc42-shlibs 4.2.2-1000 Shared libraries for gcc4 The first field is the name of the package. So: Code:
sudo fink install <name of package> |
When i run that command "sudo fink install gcc42" it says
Olson% sudo fink install gcc42 Information about 1732 packages read in 1 seconds. Failed: no package found for specification 'gcc42'! Olson% fink list gcc Information about 1732 packages read in 0 seconds. avr-gcc 3.3.2-1 GNU GCC for ATMEL AVR micro controllers broken-gcc 3.3-1 [virtual package representing a broken gcc compiler] gcc2 2.95.2-0 [virtual package representing the gcc 2.95.2 compiler] gcc2.95 2.95.2-0 [virtual package representing the gcc 2.95.2 compiler] gcc3.1 3.1-0 [virtual package representing the gcc 3.1 compiler] i gcc3.3 3.3-1819 [virtual package representing the gcc 3.3 compiler] i gcc4.0 4.0.1-5363 [virtual package representing the gcc 4.0.1 compiler] Does the gcc come with fink or my apple cd, becasue i cant find it anywhere on the net. Thanks again. |
fink doesn't come with anything, it's package manager. It can list for you the software available for you in the fink repositories, and it can download, build, and install a package if you ask it to. I think you don't have all the repositories enabled, and gcc42 is not in the one's you do have enabled. So it won't list it, or be able to install it.
Why don't you get fink commander, a gui for fink. Once you start it (if it asks you to get the most recent version of FinkCommander at this point, this is a bug, ignore the request), go to preferences, and select the 'fink' heading. Then check the boxes: 'Use unstable packages' 'Use unstable cryptography packages*' Click ok. Now, in the search field in FinkCommander you can type gcc, and you will see a list of matching entries. Select gcc42, then go to the menu item: Source->Install. You will be prompted for a few responses most likely, and it will install gcc4.2. This should include libgfortran. You can now make the link I previously mentioned, and modelfree4 should work. |
The thing is, is i dont think my mac has gcc42. I see what you are talking about entering gcc and the last entry on the list looks just like the line of my last post, which is the gcc4.0. Sorry for being problematic. I have everything down except for having the gcc4.2. Once i get that im sure i can do all the rest.
|
Nevermind..i updated using FinkCommander and i got gcc42. I am now installing it and will let you know how it goes. Thanks again
|
so i installed gcc42 and it said for the final line
Reading Package Lists... Building Dependency Tree... Failed: can't create package gcc42_4.2.1-1000_darwin-i386.deb not sure what that means but thought i wwouldt throw it out there. Also, after that had installed i tried the second command you had said and this was what it said Olson% sudo ln -s /sw/lib/gcc4.2/lib/libgfortran.2.dylib /usr/local/lib/libgfortran.2.dylib ln: /usr/local/lib/libgfortran.2.dylib: File exists so i tried modelfree4 and it said the same thing as before Olson% modelfree4 dyld: Library not loaded: /usr/local/lib/libgfortran.2.dylib Referenced from: /Users/Olson/Documents/Research/Modelfree/modelfree4_mac/Intel/modelfree4 Reason: image not found Trace/BPT trap should i delete sw and try to install fink and unpack gcc42 again? |
Quote:
Please show us the results of the following command: ls -l /usr/local/lib/libgfortran.2.dylib |
Here are the results for the that command:
Olson% ls -l /usr/local/lib/libgfortran.2.dylib lrwxr-xr-x 1 root wheel 38 Jan 12 15:17 /usr/local/lib/libgfortran.2.dylib -> /sw/lib/gcc4.2/lib/libgfortran.2.dylib |
I'm wondering, what version of os x do you have? If you have 10.5, did you install fink via bootstrap? If the fink install of gcc42 didn't finish cleanly, then you should assume that the install of gcc42 is broken. This should be the first thing you address, that is, you can't expect anything to work before step one is executed properly. Also, does /sw/lib/gcc4.2/lib/libgfortran.2.dylib exist? What does otool -L tell you about it if it does?
|
I reinstalled Fink. Used the Fink Commander to update my Fink and saw that gcc42 was installed. So i installed using FinkCommander and that did successfully this time. Did that second command which you had said and now it works. Thank you so much for your help.
|
Well same problem...new mac...I got a brand new imac and im trying to install the same modelfree program to this new mac with snow leopard. I was following the directions but i find that fink must be bootstrapped to work with leopard so i think i did it properly but not sure what i have to download to get this problem to work. I already have gcc4.2 that came with xcode. The error im getting this time is:
dyld: Library not loaded: /usr/local/lib/libgfortran.3.dylib Referenced from: /Users/Andrew/Documents/modelfree4_mac/Intel/./modelfree4 Reason: image not found Trace/BPT trap Thanks for your help. |
Type this:
ls -l /usr/local/lib/libgfortran.3.dylib What's the output? |
ls: /usr/local/lib/libgfortran.3.dylib: No such file or directory
|
i dont even have a usr/local folder
|
That tells a lot.
1) Dowload this 2) Do a time machine backup right now in case my instructions were wrong or confusing, or if you mess it up. 3) Unzip. It expands into a directory named usr. Inside is the usual /usr/local structure. Copy all that stuff into your /usr/local subdirectories on your mac HD. You can use rsync if you don't want to cut and paste into each sub dir. For that: Code:
cd <the dir named usr that the tar.gz made when you unzipped, not your system /usr>This is what I did when ROOT wouldn't compile on Snow Leopard. It got everything working again. I don't know if modelfree4 wants x86_64 or i386 binaries. The i386 are in usr/local/lib/i386. If your linker complains of /usr/local/lib/libgfortran.3.dylib being wrong architecture after you copy all this stuff into /usr/local, then you might need to move stuff around a bit or make some soft links until it works, but it should work in the end. Hopefully you don't have to go there. |
Oh, you don't have /usr/local? Well, then just copy the the usr/local from the tar ball right into /usr. You should be good to go after that.
|
I did that...copied the contents of that into a /usr/local directory and now when i run my program i get the error
dyld: Library not loaded: /usr/local/lib/libgfortran.3.dylib Referenced from: /Users/Andrew/Documents/modelfree4_mac/Intel/./modelfree4 Reason: no suitable image found. Did find: /usr/local/lib/libgfortran.3.dylib: mach-o, but wrong architecture /usr/local/lib/libgfortran.3.dylib: mach-o, but wrong architecture Trace/BPT trap [pcp018059pcs:~/Docu |
So you probably need the i38 binaries I mentioned.
You can use lipo to make a universal 64/32 binary from the x86_64 binary in /usr/local/lib, and the i386 (32 bit) binary in /usr/local/lib/i386. Here's how (read the manpage on lipo if you get confused, it's pretty straight forward as manpages go): Code:
cd /usr/localIf this new dual architecture lib works for you, you might want to go through and do it to all the libs that exist in both /usr/local/lib and /usr/local/lib/i386. That way, anything looking for fortran libs in /usr/local won't choke on the wrong architecture in the future. |
Worked like a charm....your awesome. To note though the spelling of your last command should by *.dylib and not *.dlyb
Thanks so much, saved me again. |
ls -l /usr/local/lib/libgfortran.3.dylib
If it's there, then Code:
file /usr/local/lib/libgfortran.3.dylibIf it's not there, then you probably have a typo or lost your file somewhere. Find it or make it again. I just downloaded modelfree4, made the dual binary how I just laid out, and ran modelfree4. It complained about mfin. So I think it works and is missing it's control file. what do you get? |
i got it to work, thanks again.
Would you mind explaining what happened, id like to know just so i can get better at trouble shooting? Why it didnt work? |
Why didn't it work? I don't know. Maybe you didn't get the name right when you copied or something. If that's not what you meant, then it first didn't work because os x doesn't put anything in /usr/local, or I guess doesn't even have /usr/local to begin with. That's for user stuff. So modelfree went looking for libgfortran.3.dylib there and it wasn't there. You can see a list of everything modelfree wants for it to run and where it will look by cd-ing into the dir where it lives and typing
Code:
otool -L modelfree4Code:
export DYLD_LIBRARY_PATH=/usr/local/lib:DYLD_LIBRARY_PATHAnother, less general solution if you have a lib but it's not living where an executable expects it, is to make a soft link to the lib, in the place where the executable is looking. So, for example, if you happened to have libgfortran.3.dylib living in /sw/lib, you could either put that path in DYLD_LIBRARY_PATH, or you could type Code:
ln -s /usr/local/lib/libgfortran.3.dylib /sw/libThe other reason it didn't work is because modelfree4 is compiled as a 32 bit executable (that's why the file command tells you it's i386 , the 80386 being the 32-bit predecessor of modern intel processors). The ilbgfortran.3.dylib in the gcc package you downloaded, or at least the one in /usr/local/lib, is compiled for intel 64-bit architecture (well, AMD64 really, you can read about this here, and also about the difference between 32 and 64 bit executables and libraries). So, to get over the bumpy bits of transitioning all the executables and libraries from old (32) to new (64) architecture, Apple uses dual-architecture libraries and executables. They already were doing this when they changed from PPC to x86, now they added x86_64 to the bucket. These things (dual architecture binaries) are nothing more than container files with more than one binary inside (one for each included architecture). The lipo tool makes the container file by putting the separate binaries in one bag, so to speak, which the linker knows how to deal with. I had a glass of wine, I hope that was coherent. |
Library not loaded
Hi ,
I am using 2 versions of AIX 1st is AIX 5.1 and other is AIX 5.3 . I have some library in AIX 5.3 that is mounted in AIX 5.1 I have compiled the library from AIX 5.1 and AIX 5.3 but in both the cases it is not get loaded. I got the following error in both the cases :- ATTENTION: 0031-408 2 tasks allocated by LoadLeveler, continuing... exec: 0509-036 Cannot load program ./hello because of the following errors: 0509-130 Symbol resolution failed for /opt/CMS-64/lib/ libhpcshm.so because: exec: 0509-036 Cannot load program ./hello because of the following errors: 0509-130 Symbol resolution failed for /opt/CMS-64/lib/ libhpcshm.so because: 0509-136 Symbol __fd_select number 41 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-136 Symbol __fd_select number 41 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-130 Symbol resolution failed for /opt/CMS-64/lib/ libmpi.so because: 0509-136 Symbol __fd_poll number 53 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-136 Symbol __fd_select number 54 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-130 Symbol resolution failed for /opt/CMS-64/lib/ libmpi.so because: 0509-136 Symbol __fd_poll number 53 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-136 Symbol __fd_select number 54 is not exported from dependent module /usr/lib/libc.ashr_64.o. 0509-150 Dependent module libmpi.so could not be loaded. 0509-150 Dependent module libmpi.so could not be loaded. 0509-026 System error: Cannot run a file that does not have a valid format. 0509-026 System error: Cannot run a file that does not have a valid format. 0509-192 Examine .loader section symbols with the dump -Tv command. 0509-192 Examine .loader section symbols with the dump -Tv command. Can anybody tell me whats the problem. LIBPATH is set properly. thanks in advance............ |
Same problem with new library needed, Ive tried those other suggestions but nothing has worked.
dyld: Library not loaded: /usr/local/lib/libg2c.0.dylib Referenced from: /usr/local/garant-2.2/src/./garant Reason: image not found Trace/BPT trap Do different compilers install different libraries. How does one know where to obtain these libraries? Thanks for your help again. |
| All times are GMT -5. The time now is 05:43 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.