[CMake] Cmake appears to substitute -llibrary when a full path is given.

S'orlok Reaves sorlok_reaves at yahoo.com
Tue Sep 24 01:53:16 EDT 2013



Just confirming that moving the library to a different path (e.g., /home/me/opt/local/lib/libboost_system.so) solves the problem, so LD_LIBRARY_PATH was definitely causing the "-l" path to be used. Thanks again; everything works now.

Seth




----- Original Message -----
From: S'orlok Reaves <sorlok_reaves at yahoo.com>
To: "a.neundorf-work at gmx.net" <a.neundorf-work at gmx.net>; "cmake at cmake.org" <cmake at cmake.org>
Cc: 
Sent: Tuesday, September 24, 2013 10:54 AM
Subject: Re: [CMake] Cmake appears to substitute -llibrary when a full path	is given.



Ah, thanks, it's probably LD_LIBRARY_PATH. I'll install boost into a different path and try again.

Seth




----- Original Message -----
From: Alexander Neundorf <a.neundorf-work at gmx.net>
To: cmake at cmake.org; S'orlok Reaves <sorlok_reaves at yahoo.com>
Cc: 
Sent: Tuesday, September 24, 2013 4:12 AM
Subject: Re: [CMake] Cmake appears to substitute -llibrary when a full path is given.

On Monday 23 September 2013, S'orlok Reaves wrote:
> Good afternoon all,
> 
> 
> This is my first post to this list, so please redirect me if I'm in the
> wrong place. So far cmake has been great, but I've run into an issue that
> I am having trouble understanding.
> 
> I'm searching for the Boost libs on a server that has two different
> versions installed. One is in my home directory; the other is a
> system-wide install (which is older). 
> 
> In my CMakeLists.txt:
> 
> set(Boost_NO_SYSTEM_PATHS ON)
> set(BOOST_ROOT "/home/me/opt")
> find_package(Boost COMPONENTS system REQUIRED)
> MESSAGE("${Boost_LIBRARIES}")
> #later:
> target_link_libraries (My_Program ${Boost_LIBRARIES})
> 
> 
> This prints out the following, so I know the correct library is indeed
> found: /home/me/opt/lib/libboost_system.so
> 
> 
> Now, I "make" the project, and everything compiles, but fails to link,
> specifying several missing symbols in boost::system. The linker command
> includes the following: #g++ ....etc., then:
> -o ../My_Program -rdynamic /usr/local/lib64/libsoci_core.so -lboost_system
> -Wl,-rpath,/usr/local/lib64
> 
> 
> If I change it to the following, it compiles, links, and runs fine:
> -o ../My_Program -rdynamic
> /usr/local/lib64/libsoci_core.so /home/me/opt/lib/libboost_system.so -Wl,-
> rpath,/usr/local/lib64
> 
> Clearly the "-lboost_system" flag is catching the old libraries. From
> reading the cmake docs, I was under the impression that the full path
> (/home/me/opt/lib/libboost_system.so) would only be truncated to an
> "-lboost_system" if it was on the implicit path (e.g., /usr/lib). In that
> case, I have two questions:
> 
> 1) Why is boost_system not being included via its complete path? Is this a
> bug, or am I doing something wrong? 

There is some environment variable involved, LIBDIR or LIBRARY_PATH or 
something like that, I don't remember exactly right now. grep your env for 
"LIB".
If the path to the library is contained in this environment variable, the full 
path is not used, but instead -l is used.

Alex

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake 


More information about the CMake mailing list