dyld: Library not loaded, Reason: image not found
Asked Answered
C

5

32

I used gdb normally until this week. Now running gdb I see:

(gdb) r
Starting program: /Volumes/MyProg 
dyld: Library not loaded: @rpath/libCore.so
  Referenced from: /Volumes/MyProg
  Reason: image not found
(gdb) 

How to fix it?

I have:

  • OSX 10.9
  • GNU gdb (GDB) 7.6 installed with MacPorts

P.S.

I have reinstalled gdb and Xcode. This does not help.

I see a lot of questions about dyld issues, but obviously I lack experience with libraries on OSX, and they appears to be useless for me.

For example this topic: dyld issues library not loaded But how to download library again?

Or this topic: Dyld: Library not loaded But how to find out install name? What is @rpath?

Cingulum answered 8/12, 2013 at 16:5 Comment(0)
C
6

How I fixed it:

  1. libCore.so is a library from ROOT framework, which MyProg uses.
  2. If I understand correctly, the message Library not loaded: @rpath/libCore.so Referenced from: /Volumes/MyProg Reason: image not found means that linker found the library, but can't use it.
  3. Root, during installation uses clang by default. Meanwhile as I prefer gcc and MyProg uses gcc.
  4. I have reinstalled root with gcc compiler:

    ./configure --with-cxx=g++ --with-cc=gcc --with-ld=g++

  5. I have recompiled MyProg.

and now I can debug it with gdb.

Cingulum answered 11/12, 2013 at 20:54 Comment(0)
E
29

I solved this issue with "Embedded Binaries" in the General project settings.

Eigenvalue answered 20/11, 2014 at 11:22 Comment(1)
yes this worked with Carthage. The Carthage instructions (as of 5/23/2015) state to add to linked libraries - but I deleted that and added it through embedded binaries. It then (on its own) appeared in linked libraries. Now all works.Assemblage
G
11

i have solved this issue by changing the following settings

Go to Project Setting Your_Target->General->Embedded Binaries-> Click on + button and add your library here

Grisly answered 18/4, 2016 at 7:39 Comment(1)
try this one but not working how it possible remove not found image errorMultiflorous
C
6

How I fixed it:

  1. libCore.so is a library from ROOT framework, which MyProg uses.
  2. If I understand correctly, the message Library not loaded: @rpath/libCore.so Referenced from: /Volumes/MyProg Reason: image not found means that linker found the library, but can't use it.
  3. Root, during installation uses clang by default. Meanwhile as I prefer gcc and MyProg uses gcc.
  4. I have reinstalled root with gcc compiler:

    ./configure --with-cxx=g++ --with-cc=gcc --with-ld=g++

  5. I have recompiled MyProg.

and now I can debug it with gdb.

Cingulum answered 11/12, 2013 at 20:54 Comment(0)
P
1

You can find more information about rpath here: link

So you need to point the path to your libCore.so, but honestly I have not faced with this library so I don't know where is it located.

You can check also this answer to understand what it is rpath: answer

Pew answered 10/12, 2013 at 13:41 Comment(5)
I saw this link. But it feels like it describe something for XCode developers and I miss very basics. The link does not answer the question how to find the value of @rpath... I see that I can find value in some windows named Target Info, but I have not idea how to find these windows.....Cingulum
I have added new link in answer maybe it will be useful for you. Please check answer.Pew
is this helpful answer? i think if not you need to wait some programers that already faced with the same problem like in your case.Pew
@kim123 or you can dart bounty for this questionPew
ok can you answer on your question, because it will be helpful for someone who has the same issue.Pew
T
0

For Xcode 11 or above, there is another simpler solution which worked for me if you are using Cocoapods.

In your Podfile, add use_frameworks! after your Target line like this -

target 'YourAppName' do
  use_frameworks!

Basically it adds all your pods as a framework in your framework folder.

Twist answered 9/3, 2020 at 11:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.