Amy Marie
Amy Marie

Reputation: 1

Why is a program not finding a library that's right in the same directory as the program?

I'm trying to get a program from GitHub up and running. When I run the setup.py program it comes with, I get the following error message:

/usr/bin/ld: cannot find -lmpfit
collect2: error: ld returned 1 exit status
error: command 'x86_64-linux-gnu-g++' failed with exit status 1

This is happening even though I put the mpfit directory right in the same directory as setup.py. I'm using Ubuntu on Windows 10, with Python 2.7.

Does anyone know what I might be missing? Thank you!

Upvotes: 0

Views: 75

Answers (1)

Roland Smith
Roland Smith

Reputation: 43523

If you want to link to libmpfit.so (which is basically what -lmpfit means), it is generally considered best to install it in a the standard directory for shared libraries. Often this is /usr/local/lib.

If libmpfit is written in C or C++, it might need to be compiled and installed before you can use it. (Unless you've downloaded a pre-built binary.)

If Ubuntu has a package for libmpfit, I would suggest using that, because in that case the people who have packaged the software for Ubuntu have done the hard work for you. Such a package will install the files in the right places for you.

If you have to built libmpfit yourself, unpack the source package. That will usually contain a text file named README or INSTALL that will tell you how to build and install the library. Read them carefully; you might need extra libraries or tools to build libmpfit.

Upvotes: 2

Related Questions