objective-cxcodemacoslibev

Xcode: Linking a libev.a static lib failed, showing dylib error


I am working on an OS X application, and planning to use libev as my asyn I/O library.

Firstly, I download latest libev package file from official site, extract it, and:

# ./configure
# make

Then I add include/ev.h and .libs/libev.a files to my xcode project. Xcode did recognized the libev.a as a new framework like this:

enter image description here

But when I ran my application, error occured:

dyld: Library not loaded: /usr/local/lib/libev.4.dylib
  Referenced from: /Users/Falcon/Library/Developer/Xcode/DerivedData/ToyControl-hibmvwhxifxymfacottfiecsflqn/Build/Products/Debug/ToyControl.app/Contents/MacOS/ToyControl
  Reason: image not found

What did these message mean? I add a .a file, why did it told me of .dylib one?

Was I correct to add libev.a library like this? If not, how should I linkie libev as a static library?

Thank you at advance!


Solution

  • I've found myself an answer, just copy libev.a to project directory. Then everything works.

    I wonder if I can link a static library without copying it...