This is a runtime error, not a build error. Setting the
-L flag does nothing for the runtime linker. What you need to do is to tell the runtime loader to also look in /usr/local/lib for libraries. You can do that in two ways. The first is to add the path to the
LD_LIBRARY_PATH environment variable:
The second is to update the configuration file of the runtime linker. This can happen either in the /etc/ld.so.conf file, by putting the line:
somewhere in that file, or by creating a new *.conf file in the /etc/ld.so.conf.d/ directory that contains the new path. For example:
in it. This is the recommended way of doing this, as it allows you to keep your custom library paths separate from paths set by the system. (The "99" prefix is there to make sure the file is loaded last compared to other files there, so that it won't preempt system paths that could contain the same libraries.)
After you modify/create the file in /etc, you need to run:
as root for the change to take effect. (This command updates the /etc/ld.so.cache file, which is the actual file used by the runtime linker.)
There's also another way for a binary to find needed libraries at runtime. You can actually hard-code library paths into the executable itself. This is accomplished by setting a so called "rpath". This is a linker option and must be passed from gcc (or g++) to the linker, so the
-Wl option has to be used. The linker option is
-rpath=PATH. So you would need to add this to your link flags:
I don't recommend this for your case though. An rpath is useful when you're shipping libraries together with your executable (maybe with an installer), and a relative rpath (using the
rpath $ORIGIN feature) or absolute one (for when you install in /opt, for example) is then used to find those bundled libs at runtime.
- Libraries in /usr/local/lib not found
- com.google.android.maps.MapView, was not found in the project or the libraries
- Validation libraries not found when Updating to Payara 188.8.131.52
- Eclipse not copying JARs from User Libraries into lib folder when deploying on weblogic
- sonarqube analysis failed in eclipse throws error on local analysis due to the exception language "cpp" is not found
- Source not found jre7 lib has no source attachment
- class not found error in java when compiling a project with libraries
- Web app Libraries are not found Eclipse
- Eclipse not found lib folder?
- Eclipse + Tomcat + Maven gives class not found exception even after adding Maven Libraries
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
- Libraries do not get added to APK anymore after upgrade to ADT 22
- ADT requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found
- Eclipse java debugging: source not found
- The current branch is not configured for pull No value for key branch.master.merge found in configuration
- Class Not Found Exception when running JUnit test
- Project with path ':mypath' could not be found in root project 'myproject'
- javac1.8 class not found
- get rid of POM not found warning for org.eclipse.m2e:lifecycle-mapping
- the zipalign tool was not found in the sdk
- Launch Failed Binary not found Eclipse for C in Windows
- file not found manifest.mf eclipse
- Program "make" not found in PATH
- Eclipse C++ : "Program "g++" not found in PATH"
- aapt not found under the right path
- m2eclipse not finding maven dependencies, artifacts not found
- Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener
- PHP Class DateTime not found
- Eclipse - JAR creation failed "Class files on classpath not found or not accessible for..."
- FindBugs not showing the bugs found
More Query from same tag
- adapting a start (shell?) script for Eclipse to MacOS (Windows and Linux examples given)
- import java.awt.Desktop is not resolved in Eclipse
- need to create a phonegap project for blackberry in eclipse
- Adding Class files to Google App Engine Wave Bot in Java using Eclipse
- Can we use Lync/Skype SDK in Eclipse IDE
- Android & Eclispe - ADT is closed unexpectedly while exporting my application
- Does eclipse sdk has an adt bundle?
- Getting a RCP feature to export to a p2 site that supports multiple platforms using Buckminster
- Issue with Displaying error message when the file is empty
- Eclipse console output formatting issue
- The class folder is not associated to any output library entry
- How can I use Eclipse without the Android Debug Bridge?
- Catching Info with xml.dom.minidom
- Finish button when trying to import not responding
- Get rid of nonexistent options on workspace selection
- copied the jdk to /Library/Java/JavaVirtualMachines/ next to the default 1.6.0 one
- Performance issue while loading huge table(SWT/JFace)
- Is there an easy way to attach source in Eclipse?
- No files changed but Git Eclipse project explorer indicates there are
- android application development- saving and retrieving the values of editText and textView
- Android Development - Dealing with XML
- Ant script: Have <exec> tag dump out entire command line
- error while loading shared libraries: libopencv_core.so.3.1
- Removing Objects From ArrayList Sometimes Not Working
- Java plug-in into the prepackaged Eclipse PHP
- Build Windows RCP Application on Unix Machine
- Problems Installing akka with Scala IDE
- Exclude directories & subdirectories from validation in Eclipse
- Build project has encountered a problemm Eclipse C++.
- I had trouble with Android Studio Project