Xcode - dyld: Library not loaded error - xcode

I'm new to MAC and Xcode since I'm a Windows user and I'm really lost. I finally managed to port my game from Windows to MAC and it works in simulator and all but when I launch the executable I get the next error.
dyld: Library not loaded: /opt/local/lib/libSOIL.dylib
Referenced from: /Users/myUser/Documents/Cotc/CourierOfTheCrypts/DerivedData/CourierOfTheCrypts/Build/Products/Release/CourierOfTheCrypts
Reason: image not found
Trace/BPT trap: 5
logout
I've read a lot of topics about the error but I still don't have a clue about it and how to solve it. All the libraries are copied to the executable folder.
If you need more information please let me know, every bit of help is more than welcome!
EDIT: It turns out /opt/... folder does't exist at all...

The solution to my problem is, to execute the following script for each library:
install_name_tool -id #executable_path/libSOIL.dylib "$CONFIGURATION_BUILD_DIR/libSOIL.dylib"
You enter the script in TARGET settings -> RunScript

Related

AWS SDK Usage using XCode

I am a new user of AWS-SDK for C++. I have a question regarding using it through Xcode. I was able to successfully build the AWS-SDK-CPP source and install them. I have 2 folders in my install path: an include directory and a lib directory filled with .dylib files.
I tried to create a "hello world" test function in Xcode and link it using the files in my install/lib. I am able to build successfully but I am getting the following linker error:
dyld: Library not loaded: libaws-cpp-sdk-core.dylib
Referenced from: /home/myself/Products/Debug/Test_AWS
Reason: image not found
I do have the dylibs (file size is > 0). Can someone please tell me how to fix this?
Any help is greatly appreciated!
Sincerely,
Balaji V. Iyer.
Have you specified the install path to linker?

Gazebo on OSX 10.11 fails to start. Library "libOgreTerrain" missing

I followed the tutorial from the official guide in order to install Gazebo 6, on OSX 10.11.
But, when I try to run gazebo, I get the following error.
It doesn't find the libOgrePaging library.
$ gazebo
dyld: Library not loaded: #executable_path/../Components/libOgrePaging.1.7.4.dylib
Referenced from: /usr/local/lib/libOgreTerrain.1.7.4.dylib
Reason: image not found
Trace/BPT trap: 5
Is there a workaround for this problem?
Can I install manually this library?
Thank you very much for your time,
Kostas.
After some quest, I solve this issue by doing the following. In my case, I have two libs missing (libBulletDynamics.2.86.dylib and libOgrePaging.1.7.4.dylib), both installed but not linked.
To look for where are they:
find /usr/local/Cellar -name "libOgrePaging.1.7.4.dylib"
Add the containing lib to the end of ~/.bash_profile:
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/Cellar/bullet/2.86.1_1/lib:/usr/local/Cellar/ogre/1.7.4_2/lib:$DYLD_FALLBACK_LIBRARY_PATH
And source it
source ~/.bash_profile
Reference:
Is it OK to use DYLD_LIBRARY_PATH on Mac OS X? And, what's the dynamic library search algorithm with it?
dyld: Library not loaded ... Reason: Image not loaded
This is probably not the correct solution, but it seems to work for me so far.
Go to /usr/local/Cellar/gazebo6/6.60_2(or whatever version it is)/ and make a folder called Components.
After that, go to /usr/local/Cellar/ogre/1.7.4/lib and copy all of the contents into the components folder, and then gazebo should launch.

OSX terminal app, fails to load dylib file

I have created a dylib file. Successfully added it to one Terminal(Console based app through Xcode). When I run the app through Xcode they dylib is loaded and all the methods inside it works.
The issue is when I run the Consols App (Unix Executable) it fails to find the dylib and throws the following error.
DS-Anoopkumar-v:~ anoopvaidya$ /Users/anoopvaidya/Library/Developer/Xcode/DerivedData/Worker-dfytfqadwmzqmvesrzqeartqcggx/Build/Products/Debug/Worker; exit; dyld: Library not loaded: #executable_path/../libDownloader.dyli
Referenced from: /Users/anoopvaidya/Library/Developer/Xcode/DerivedData/Worker-dfytfqadwmzqmvesrzqeartqcggx/Build/Products/Debug/Worker
Reason: image not found Trace/BPT trap: 5 logout
[Process completed]
Please tell me what I am missing here, any help will be highly appreciated.
In Build Setting's "Dynamic Library Install Name" I replaced "#executable_path/.../Framework/libILDownloader.dylib" with "#executable_path/libILDownloader.dylib" and it worked.
Thanks to this answer How to use dylib in Mac OS X (C++), that helped me to understand

OBD-II Simulator on OS-X

Has somebody installed OBD-II simulator on mac? I tried downloading it from this site - http://icculus.org/obdgpslogger/obdsim.html for OS-X.
After installation and opening ObdGPSLogger, I can see GPS logger window and different parameter gauges. However, after selecting Logfile, and device there is nothing happening.
In the Raw output, below is the error displayed under StdErr:
Dyld: Library not loaded: /Users/chunky/gpsd//lib/libgps.18.dylib
Referenced from: /Applications/OBD GPS Logger.app/Contents/Resources/bin/obdgpslogger
Reason: image not found
Let me know if you guys know the cause
I had the same issue here, but I got it working on a Mac downloading the obdgpslogger-0.16.tar.gz version (in the Tarball section) from this link.
You need to navigate to the downloaded folder and then run the commands:
mkdir build
cd build
cmake ..
make
make install # optional

"Instruments cannot be opened because of a problem" (xcode4)

I'm trying to profile an app using Instruments, but every time I try to run I get a generic error message saying "Instruments cannot be opened because of a problem". The exact same thing happens if I try to start Instruments manually outside of XCode.
If I try starting Instruments from the command-line, I get the following error details:
dyld: lazy symbol binding failed: Symbol not found:
_CSSymbolicatorCreateWithMachKernel Referenced from:
/Developer/Applications/Instruments.app/Contents/MacOS/../../../../Library/PrivateFrameworks//InstrumentsPlugIn.framework/Versions/A/InstrumentsPlugIn
Expected in:
/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication
dyld: Symbol not found: _CSSymbolicatorCreateWithMachKernel
Referenced from:
/Developer/Applications/Instruments.app/Contents/MacOS/../../../../Library/PrivateFrameworks//InstrumentsPlugIn.framework/Versions/A/InstrumentsPlugIn
Expected in:
/System/Library/PrivateFrameworks/CoreSymbolication.framework/Versions/A/CoreSymbolication
I just installed all of the available software updates, and it made no difference. Any suggestions on how to fix this?
Okay, I found a workaround that is a bit simpler than reinstalling all of XCode. Basically I got another developer with a working copy of XCode/Instruments to send me a copy of their /System/Library/PrivateFrameworks/CoreSymbolication.framework file/folder.
Then I moved my local copy of CoreSymbolication.framework out of the way and dropped their version in.
After that everything works correctly. And it's quite a bit faster than uninstalling and reinstalling XCode.

Resources