Library not loaded: /opt/local/lib/libffi.5.dylib - macos

I am compiling some C++ code on Mac OX Snow Leopard (MacPorts).
I got error message:
collect2: error: ld terminated with signal 5 [Trace/BPT trap]
dyld: Library not loaded: /opt/local/lib/libffi.5.dylib
Referenced from: /opt/local/libexec/llvm-3.3/lib/libLTO.dylib
Reason: image not found
I know libffi was updated to a newer version which now provides libffi version 6 that I have now.
Any help? Thanks.

Try 'sudo port rev-upgrade' first.* This should identify missing / mis-linked files and rebuild the required ports. (Will use pre-compiled binaries rather than build when permitted by licenses and config.)
In general, you may find the mailing list the most productive place to ask these questions. https://lists.macosforge.org/mailman/listinfo/macports-users
actually, do 'sudo port selfupdate && sudo port upgrade outdated' first if you haven't recently.

Related

Error “ld: library not found for -lSystem” with GPS on MacOS

I'm programing ADA with GPS. The problem is that when I compile any code with GPS I get this error:
ld: library not found for -lSystem collect2: error: ld returned 1 exit status
I have updated and reinstalled everything (xcode, gcc), reinstalled GPS, and installed comand line tools.
That's what GPS show to me by terminal:
gprbuild -d -P/Users/pedromarti/Desktop/helloWorld/default.gpr /Users/pedromarti/Desktop/helloWorld/src/main.adb Bind [gprbind] main.bexch [Ada] main.ali Link [link] main.adb ld: library not found for -lSystem collect2: error: ld returned 1 exit status gprbuild: link of main.adb failed gprbuild: failed command was: /users/pedromarti/opt/gnat/2019/bin/gcc main.o b__main.o -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/ /users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/libgnat.a -Wl,-rpath,#executable_path/ -Wl,-rpath,#executable_path/../../..//opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib -o main [2021-03-18 13:38:56] process exited with status 4, elapsed time: 02.57s
I don't know what more I can do. If anyone knows a solution, you are welcome!
You’re using GNAT Community Edition 2019. I can’t tell which OS release you’re running on, and in this case I don’t think it makes a difference.
The README from the download site says
== Mac OS: Xcode is now needed ==
On Mac OS, GNAT Community 2019 requires Xcode version 10 or above to be
installed. Once you do have Xcode installed, if you still observe an error
of the form:
ld: library not found for -lSystem
then you might have to execute the following:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Xcode is large but free, and takes a while to download from the App Store (go to the Develop tab).
If your building system has a cache system, you need to clear the cache.
For example, if you are using cmake, remember to delete cmake build directory to avoid the cmakecache take it to the wrong link.

pyside-rcc "dyld: Library not loaded:..."

I'm a python and Qt rookie and I have some problems running pyside-rcc (and pyrcc4). The problem is not the link to the executable but a library problem it seems. That I'm not a unix wizard, probably doesn't help either:)
When I run $ pyside-rcc i get the following error
dyld: Library not loaded: #rpath/lib/QtCore.framework/Versions/4/QtCore
Referenced from: /Users/[USERNAME]/Library/Enthought/Canopy_64bit/User/bin/pyside-rcc
Reason: image not found
Trace/BPT trap: 5
For $ pyrcc4 the error is similar but not exactly the same:
dyld: Library not loaded: #rpath/lib/QtXml.framework/Versions/4/QtXml
Referenced from: /Users/[USERNAME]/Library/Enthought/Canopy_64bit/User/bin/pyrcc4
Reason: image not found
Trace/BPT trap: 5
I'm running Mac OS X 10.9
I have Enthought Canopy (v.1.5.1) installed with the following
packages: Qt 4.8.5-10, PySide 1.2.2, PyQt 4.11.0-1
I have also installed Qt Creator (3.3.0) which came with Qt 5.4.0
To activate the Canopy python packages system wide I have the following line in mt .bash_profile
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/[USERNAME]/Library/Enthought/Canopy_64bit/User/bin/activate
I have found a lot of posts with dyld: Library not loaded... errors but I can't find the right path to the Qt framework and thus, I'm stuck... Does anyone with Enthought Canopy have the same problem?
Thank you in advance, I appreciate any help.
Solved! I found a similar question here: http://qt-project.org/forums/viewthread/9024
The libraries (when installed through Canopy) is in /Users/[USERNAME]/Library/Enthought/Canopy_64bit/User/lib
Apparently they should be in /Library/Frameworks After copying them here it works...

Trying to compile GnuPG-2.1.1 on OS X Yosemite 10.10.1

While trying to build the latest GnuPG (2.1.1 modern), my build fails when trying to link t-stringhelp. make outputs:
ld: warning: ignoring file libcommon.a, file was built for archive which is not the architecture being linked (x86_64): libcommon.a
Undefined symbols for architecture x86_64:
"_compare_filenames", referenced from:
_main in t-stringhelp.o
"_make_absfilename_try", referenced from:
_main in t-stringhelp.o
"_make_filename_try", referenced from:
_main in t-stringhelp.o
"_percent_escape", referenced from:
_main in t-stringhelp.o
"_strconcat", referenced from:
_main in t-stringhelp.o
"_xstrconcat", referenced from:
_main in t-stringhelp.o
I don't know how to fix this as libcommon is part of the source, so it should build fine. When building with CFLAGS="-m64" (-arch x86_64 does nothing), I get this:
ld: warning: ignoring file ../common/libgpgrl.a, file was built for archive which is not the architecture being linked (x86_64): ../common/libgpgrl.a
Undefined symbols for architecture x86_64:
"_gnupg_rl_initialize", referenced from:
_main in gpg.o
I've also rebuilt all the depandancies (as I built them on Mavericks), except pinentry, as it can't find libiconv which is also installed. My configure outputs that its target is Darwin (x86_64-apple-darwin14.0.0), so this should work. I have also got all the latest prerequisites, tried to install everything in its own directory (--prefix=/usr/local/gnupg-2.1.1), build all the dependancies and GnuPG as 32 bits (again, fails on same error), created a separate build folder and tried to build in there, but only one thing so far has solved the error: looking at how libgpgrl.a is being built - it's only component is common/gpgrlhelp.c - so I cd'ed into g10 and tried to build gpg2, replacing ../common/libgpgrl.a with ../common/gpgrlhelp.o, the lib common.a with all of its object files, for all the libraries that didn't work. Then some programs weren't linking to libksba libgcrypt and libassuan, so I changed the Makefiles, so that they could link. I can now compile all the code well, I installed everything, but I get a new error, when I try to run gpg2:
dyld: lazy symbol binding failed: Symbol not found: __gcry_mpi_init
Referenced from: /usr/local/gnupg-2.1.1/lib/libgcrypt.20.dylib
Expected in: flat namespace
dyld: Symbol not found: __gcry_mpi_init
Referenced from: /usr/local/gnupg-2.1.1/lib/libgcrypt.20.dylib
Expected in: flat namespace
I have everything in my path, which is:
/usr/local/gnupg-2.1.1/bin:/usr/local/gnupg-2.1.1/lib:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
I could compile GnuPG-2.0.22 on Mavericks, but no version of GnuPG builds on Yosemite.
Please help, I'm really confused.
I’ve been running GnuPG 2.1 on Yosemite 10.10.2 (the latest public beta of as of this writing) for about a week and it’s been fine.
You can follow these directions for using brew tap or you can use the raw URL: brew install https://github.com/mtigas/homebrew-gpg21/raw/master/Formula/gnupg2.rb.
Note this formula installs GnuPG 2.1; not GnuPG 2.1.1, the version originally asked about. I can confirm this bug where gpg2 --refresh-keys fails with some keyservers using 2.1 (apparently fixed in 2.1.1) but it’ll get you 90% there.
It shouldn’t be hard to update the formula to install 2.1.1.
Update
Someone submitted a pull request for GNuPG 2.1.1 support—I just tried it and it worked great. Short answer: brew install https://raw.githubusercontent.com/calebthompson/homebrew-gpg21/2.1.1/Formula/gnupg2.rb.
Personally, I would install homebrew, which is a one-liner pasted from their website (http://brew.sh) then do
brew install gnupg
If therw are any problems, run
brew doctor
and heed the good doctor's advice.
Turns out I had a ranlib in /usr/local/bin/ranlib. It was broken, I don't know how it got there (I did try to build gcc at some point, it doesn't support make uninstall, so that's probably why). I just ran:
sudo mv /usr/local/ranlib /usr/local/ranlib_old
Then I just rebuilt all the dependancies, and it worked!

How can I fix this PDL installation?

I have installed PDL on a Mac OS X (10.7.3) machine. Evidently the SciPDL installer places PDL.pm in /Library/Perl/5.12/darwin-thread-multi-2level, so I added
use lib '/Library/Perl/5.12/darwin-thread-multi-2level';
at the top of my test script. I now get these errors:
dyld: lazy symbol binding failed: Symbol not found: _Perl_Gthr_key_ptr
Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/PDL/Core/Core.bundle
Expected in: flat namespace
dyld: Symbol not found: _Perl_Gthr_key_ptr
Referenced from: /Library/Perl/5.12/darwin-thread-multi-2level/auto/PDL/Core/Core.bundle
Expected in: flat namespace
Unfortunately these errors don't mean much to me. What do they mean? And what's the solution?
Use cpanm to install modules instead of the SciPDL installer. Install cpanm:
either bootstrap from the Web:
curl -L http://cpanmin.us | perl - --self-upgrade
or with the CPAN client that ships with Perl:
cpan App::cpanminus
Install PDL:
cpanm PDL
This compiles PDL for your specific platform, making sure all the paths are set properly.

dyld: Library not loaded: /opt/local/lib/libglib-2.0.0.dylib

I've gotten MDB-Tools compiled for OSX, but when I try to run a sample command line program on another computer I get this error:
dyld: Library not loaded: /opt/local/lib/libglib-2.0.0.dylib
Referenced from: /Users/dev/mdb/mdb-test
Reason: image not found
Trace/BPT trap: 5
I believe that this means that the target system is missing a library and I think its something to do with linkage, but I'm not exactly positive how to go about fixing this. Could anyone point me in the right direction?
The /opt/local directory is typically used by MacPorts. Your compiled program has a dependency on glib from MacPorts. You either need to install that on the machines where you want to run your program or you need to bundle together your program and all of the libraries it depends on.
Check Apple's Dynamic Library Programming Topics.
Yes, I had hit similar issue while upgrading vim on Mac.
$ vi linkedlist.cc
dyld: Library not loaded: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.6/Python
Referenced from: /usr/local/bin/vim
Reason: image not found
Abort trap: 6
To solve the problem, I tried to upgrade packages.
$ brew update
Already up-to-date.
$ brew upgrade
It started working after doing upgrades.

Resources