Reputation: 13682
When trying to run an executable I've been sent in Mac OS X, I get the following error
dyld: Library not loaded: libboost_atomic.dylib
Referenced from: /Users/"Directory my executable is in"
Reason: image not found
Trace/BPT trap:5
I have installed the boost libraries and they are located in /opt/local/lib
. I think the problem has something to do with the executable only looking in the directory it is in as when I paste the 'libboost_atomic.dylib' in there, it doesn't mind about it anymore. Unfortunately then it complains it can't find the next boost library.
Is there an easy way to fix this?
Upvotes: 412
Views: 514357
Reputation: 13734
In my case there was Target A, Target B and pod. Target A embedding target B. Target B has in podfile lib Alamofire
.
If Target A not having Alamofire in Podfile, there was an error.
To fix it, I had to add pod Alamofire
into Target A and Target B the both. Despite Target A not using Alamofire.
Upvotes: 0
Reputation: 121
install_name_tool -add_rpath new_path executable
install_name_tool -delete_rpath old_path executable
Upvotes: 0
Reputation: 371
Removing older php version is fixed my problem, like:
brew remove [email protected]
Upvotes: 0
Reputation: 2636
This was my reason of the issue:
dyld: Library not loaded: /System/Library/Frameworks/AVFAudio.framework/AVFAudio Referenced from: /private/var/containers/Bundle/Application/B6724E76-E704-46A2-8637-F43277018CE2/MyFrameworkUsageSample.app/Frameworks/MyFramework.framework/MyFramework Reason: image not found dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
I was creating own framework MyFramework - where the Apple Framework was used. And build the xcframework with latest deployment target - iOS 16. While in the TestApp required to run on iOS 13+. And The Test Devices were using iOS 15.
Thus the TestApp with MyFramework was launching on Simulator (iOS16) successfully. But not on the Devices.
Resolution: In MyFramework - change the deployment target to needed iOS. And re-generate your framework. Or if you are using the 3d-party framework - ask the provider to support you minimal deployment target.
So missed to change the min deployment target in the xcframework before building - and Apple logs were as usual super helpful)))
Upvotes: 0
Reputation: 1311
Quick Fix
pod install
pod install
again.It worked for me and is easy to do so sharing it.
Upvotes: 1
Reputation: 1
FIXED: This approach cleared this up for me with ease ...
My particular CLI tool that triggered the same issue (i.e., netdiscover), was looking for:
/usr/local/opt/libnet/lib/libnet.1.dylib
When I searched that path for, libnet.1.dylib, ls returned a file, but a newer version: libnet.9.dylib
Following the approach presented in this article, How to Fix ‘Dyld: Library not Loaded’ Error on MacOS, I was able to fix the issue by simply creating a symlink pointer to the file that the tool was looking for (i.e., libnet.1.dylib), to that of the new file version listed on my system (i.e., libnet.9.dylib), ...
ln -s /usr/local/opt/libnet/lib/libnet.9.dylib /usr/local/opt/libnet/lib/libnet.1.dylib
... now when I run the tool, it finds the dependancies it needs without complaint!, : )
--AA
Reference:
Upvotes: 0
Reputation: 122449
Find all the boost libraries (where exefile
is the name of your executable):
$ otool -L exefile
exefile:
@executable_path/libboost_something.dylib (compatibility version 0.7.0, current version 0.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
and for each libboost_xxx.dylib
, do:
$ install_name_tool -change @executable_path/libboost_something.dylib /opt/local/lib/libboost_something.dylib exefile
and finally verify using otool
again:
$ otool -L exefile
exefile:
/opt/local/lib/libboost_something.dylib (compatibility version 0.7.0, current version 0.7.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
Manpages: otool
install_name_tool
EDIT A while back I wrote a python script (copy_dylibs.py
) to work out all this stuff automatically when building an app. It will package up all libraries from /usr/local
or /opt/local
into the app bundle and fix references to those libraries to use @rpath
. This means you can easily install third-party library using Homebrew and package them just as easily.
I have now made this script public on github.
Upvotes: 225
Reputation: 77
I forgot to add use_frameworks! in my podfile. I added it back and it worked.
Upvotes: -1
Reputation: 38267
As said in https://gist.github.com/berkedel/d1fc6d13651c16002f64653096d1fded, you could try
brew uninstall --ignore-dependencies node icu4c
brew install node
brew link --overwrite node
Upvotes: 2
Reputation: 449
Upvotes: 0
Reputation: 34401
It is an dynamic linker error which links binary in load or runtime
Upvotes: 0
Reputation: 4022
Making the Frameworks in the Build Phases Optional worked for me.
In Xcode -> Target -> Build Phases -> Link Binary with Libraries -> Make sure the newly added frameworks if any are marked as Optional
Upvotes: 7
Reputation: 11
In my case it was node that was out of date, you need to upgrade it after goin up to BigSur - brew upgrade node
Upvotes: 1
Reputation: 11653
I got this error after using asdf to switch my python version. When you activate the virtualenv it gets confused.
Instead recreate the virtualenv like so
$ rm -rf venv
$ python -m venv venv
This time when you activate the virtualenv it will find the correct python.
Upvotes: 0
Reputation: 1460
In our case, it's an iOS app, built on Xcode 11.5, using cocoapods (and cocoapods-binary if you will).
We were seeing this crash:
dyld: Library not loaded: @rpath/PINOperation.framework/PINOperation
Referenced from: /private/var/containers/Bundle/Application/4C5F5E4C-8B71-4351-A0AB-C20333544569/Tellus.app/Frameworks/PINRemoteImage.framework/PINRemoteImage
Reason: image not found
Turns out that I had to delete the pods cache and re-run pod install, so Xcode would point this diff:
Upvotes: 2
Reputation: 1477
this should fix the issue
brew update
brew upgrade
brew cleanup
Upvotes: 43
Reputation: 4020
To resolve the error below on my Macbook Catalina 10.15.4:
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/bin/mongoexport
Reason: image not found
Abort trap: 6
I ran the command below and got round the problem above:
brew switch openssl 1.0.2s
Upvotes: 10
Reputation: 175
Best one is answered above first check what is the output of
otool -L
And then do the following if incorrect
set_target_properties(
MyTarget
PROPERTIES
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS
"@executable_path/Frameworks @loader_path/Frameworks"
)
And
set_target_properties(
MyTarget
PROPERTIES
XCODE_ATTRIBUTE_DYLIB_INSTALL_NAME_BASE
"@rpath"
Upvotes: 0
Reputation: 453
If you are using Conda environment in the terminal, update the samtools to solve it.
conda install -c bioconda samtools
Upvotes: 0
Reputation: 412
For anyone that might still be having this problem:
This is an ongoing problem on Apple's side, and what worked for me is upgrading to ios 13.4(beta). Installed that and worked like a charm.
Upvotes: -1
Reputation: 11577
First make sure that external added library has option embed is selected in General Tab, Embbed Binaries.
If still not works..
This happens because you have different, unmatched versions of libraries present.
Update the Pods
pod update
Important: Check all libraries are included in the Build Settings -> libraries and frameworks list and you have given option to embbed in the build
Just working awesome
Upvotes: 2
Reputation: 1854
After upgrade Mac OS to Mojave. I tried to install npm modules via yarn
command I got error:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6
Was fixed with:
brew update
brew upgrade
Upvotes: 118
Reputation: 7720
In the target's General
tab, there is a section called Frameworks, Libraries, and Embedded Content
Click on the +
sign, add required framework
and the crash is resolved.
Upvotes: 126
Reputation: 35032
For my framework I was using an Xcode subproject added as a git submodule.
I believe I was getting this error because I was signing the framework with a different signing Team than my main app. (switched teams for app; forgot to switch for framework)
Solution is to not sign within the framework project. Instead, in the main app's Target > General > Frameworks, Libraries, and Embedded Content
section, sign the framework via Embed & Sign
.
If I select Do not Embed
or Embed Without Signing
I instead get the error:
FRAMEWORK not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Upvotes: 3
Reputation: 157
I fixed this issue by using Product > Clean Build Folder
(CommandShiftK), which makes a new clean build, really odd.
Upvotes: 3
Reputation: 11343
If you're using Xcode 11 onwards:
Go to General
tab and add the framework in Frameworks, Libraries, and Embedded Content
section.
Important: By default it might be marked as Do Not Embed
, change it to Embed Without Signing
like shown in the image and you are good to go.
For Xcode versions below 11:
Just add the framework in Embedded Binaries
section and you are done.
Cheers!
Upvotes: 11
Reputation: 1379
if you use virtualenv just remove the folder of your environment and recreate it with this command
virtualenv --python=/usr/local/bin/python3 the_name_of_my_env
Upvotes: 2
Reputation: 9
I faced the app crash issue quoting SIGABRT error in thread.Overview of the crash is dyld library not loaded and image not found something like that.
This was seen in Xcode 9.3. The reason I found out was Xcode is not picking up libraries dynamically so I had to do it manually which solved my crash issue.
Follow the below steps:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos
Now you will be able to see some swift dylibs, Select all the swift libraries with .dylib extension and click on open.
These will get added to the embedded binaries in the general tab of app.
Create a new group in project folder and add all these libraries.
Now run your app.
Upvotes: 0
Reputation: 79
If you use cmake, add DYLIB_INSTALL_NAME_BASE "@rpath"
to target properties:
set_target_properties(target_dyLib PROPERTIES
# # for FRAMEWORK begin
# FRAMEWORK TRUE
# FRAMEWORK_VERSION C
# MACOSX_FRAMEWORK_IDENTIFIER com.cmake.targetname
# MACOSX_FRAMEWORK_INFO_PLIST ./Info.plist
# PUBLIC_HEADER targetname.h
# # for FRAMEWORK end
IPHONEOS_DEPLOYMENT_TARGET "8.0"
DYLIB_INSTALL_NAME_BASE "@rpath" # this is the key point
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM}"
)
or in Xcode dynamic library project Target -> Build Setting set Dynamic Library Install Name Base to @rpath
Upvotes: 3
Reputation: 4338
Now that Xcode has upgraded their IDE, they have changed a little bit how this functions.
It used to be split up into separate section as demonstrated above with 'Embedded Binaries' and 'Linked Frameworks and Libraries' as separate sections.
Now, it is one combined section with drop-downs on the right as to what should be embedded.
This was confusing to me at first, but makes perfect sense now.
Upvotes: 12