Doug
Doug

Reputation: 3003

No rule to make target /usr/lib/someLib.so

The build use to work in buntu 11.04, now in 12.04 it does not.

There is a conflict with the location of someLib.so. That is, it is looking in the wrong location. /usr/lib/here/someLib.so is the correct location.

When I run the 'c' configuration cmd in ccmake, it noticed the conflict,.. once. Now ccmake no longer complains, but the err is still there. runtime library [someLib.so] in /usr/lib may be hidden by files in: /usr/lib/here

The lines in CMakeLists.txt that cause the build err are:

ADD_EXECUTABLE(test main.cpp)
TARGET_LINK_LIBRARIES(test moreStuff evenMoreStuff)

I see the problem in the build.make file. Which is generated by ccmake. I can't figure out where ccmake is getting the idea that someLib.so is at /usr/lib/, rather than @ /usr/lib/here/. I figure it would be a SET() statement somewhere. I'm not finding it.

1) What is the configuration file (ccmake 'c' cmd) called? Where would it be (same dir?)? I figure if I del it, I'll be able to see the err again. (Changing CMakeFile.txt doesn't seem to do it.)
2) How can I find out where the location of someLib.so is being set? (What am I looking for?)

I hate CCMAKE. Thanks

Upvotes: 13

Views: 27441

Answers (2)

Saadat
Saadat

Reputation: 521

First I suggest to check if the package is already installed using the following command:

dpkg -L SomeLib

If it was not installed, install it using apt-get or any other method and try again. If it's installed but located under wrong location, use the link command to create the correct location like this:

sudo ln -s locationOfLibFromAboveCommand locationItShouldBe

I hope it helps.

Upvotes: 1

Domen Vrankar
Domen Vrankar

Reputation: 1743

I would say that this is an issue with one of find_library calls. If I remember correctly this was occurring when your environment was pointing to two different locations that both contained a library file with the same name.

You can prevent this from happening by either changing your environment so that it doesn't point to both locations or use one of NO_*_PATH with find_library call to prevent cmake from finding both locations (e.g. you could define your own path for this find_library and use NO_DEFAULT_PATH to prevent cmake from using environment paths - see documentation: http://www.cmake.org/cmake/help/v2.8.10/cmake.html#command:find_library)

find_library(someLib_location NAMES someLib PATHS /usr/lib/here/ NO_DEFAULT_PATH)

Regarding 1) I think they are called CMakeCache files but the safest way to go is simply delete the entire build structure (not a problem if you are building out of source)

Regarding 2) I would search throug CMakeList.txt files by library name (without .so suffix and lib prefix as those are probbably added by CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES variables)

Upvotes: 1

Related Questions