<div dir="ltr"><div>I did a bit more searching around, and, for me at least, setting 
Boost_REALPATH on also seems to be a valid solution to the problem, as 
the linker will no longer get confused between the system installed 
libraries and my custom ones.  I dunno if that works in all situations, but it seems to be the cleanest solution to what I'm doing.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 15, 2016 at 5:16 PM, Elizabeth Fischer <span dir="ltr"><<a href="mailto:rpf2116@columbia.edu" target="_blank">rpf2116@columbia.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Something is wrong here.  In 99% of the cases I've seen, it is not necessary to set LD_LIBRARY_PATH.  That env var is evil, and should be used only as a last resort, and temporarily at that.  There must be a better way...<div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Mar 15, 2016 at 2:38 PM, James Benze <span dir="ltr"><<a href="mailto:benzejaa@gmail.com" target="_blank">benzejaa@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div>So I combed through the source code, and solved the problem, mostly.  It did turn out to be a cmake issue, sort of, so I figured I'd post here for posterity in case future problem solvers come across a similar issue.<br><br></div>So I'm using both a custom compiler and a custom set of boost libraries.  For simplicity, I installed them to the same prefix (/path/to/custom/stuff).  Now cmake has a list of libraries that it thinks are always looked in for link directories.  If you use a custom compiler (/path/to/custom/stuff/bin/g++ for example), it adds that compiler's libraries to it's "implicit link directories", ones that it assumes are found automatically (in this case /path/to/custom/stuff/lib and /path/to/custom/stuff/lib64).  Because my custom boost version was in this library path (/path/to/custom/stuff/lib) cmake assumed that the compiler could find them and just used the "-l" syntax with no RPATH set.  When I used my control set of libraries, they were installed in a different prefix (/path/to/test/boost/) so cmake says "oh you can't find these" and did the full path linkage plus RPATH.<br><br></div>So my two solutions are as follows:<br><br></div>1) set LD_LIBRARY_PATH when building. In this case, everything links correctly, although ld harmlessly complains about conflicts with the distribution-installed libraries in /usr/lib/<br></div>2) Install boost in a different directory than my custom compiler.<br><br></div><div>Cheers, all.<br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 15, 2016 at 10:38 AM, James Benze <span dir="ltr"><<a href="mailto:benzejaa@gmail.com" target="_blank">benzejaa@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hey all:<br><br></div>I'm trying to compile boost with some weird options, and I can't get projects linked with it to compile correctly.  As using regularly compiled boost seems to work just fine, this indicates my issue is not with cmake...however I was hoping I could get some clarification on how cmake searches for things in order to diagnose my issue.<br><br></div>I made a toy project here:<br><br></div>cmake_minimum_required(VERSION 2.8.4)<br></div>project(testproject)<br><br></div>find_package(Boost 1.58.0 REQUIRED COMPONENTS thread)<br></div>add_executable(a.out main.cpp)<br></div>target_link_libraries(a.out ${Boost_LIBRARIES})</div><div><br></div>When I build this project with the "good" normally compiled boost libraries, I get this CMakeFiles/a.out.dir/link.txt:<br><br></div>/full/path/to/compiler/g++ CMakeFiles/a.out.dir/main.cpp.o -o a.out -rdynamic /full/path/to/good/boost/libboost_thread.so -Wl,-rpath,/full/path/to/good/boost<br><br></div>When I build the project with the exact same options, except substituting the "bad" boost for the BOOST_ROOT variable, I get:<br><div><div><div><br>/full/path/to/compiler/g++ CMakeFiles/a.out.dir/main.cpp.o -o a.out 
-rdynamic -lboost_thread<br><br></div><div>The obvious differences here are that with the good boost libraries, we get a full path to the boost library and not a shortened path.  Additionally, with the good library, I get a the rpath to the library set as well.  The ${Boost_LIBRARIES} variable is the full path to libboost_thread.so in both cases.<br><br></div><div>This is obviously a problem with my boost compilation, but this is my only clue to diagnosing the problem.  I was hoping for some insight as to why cmake would choose one way of linking over another so I could attempt to fix my actual problem.<br><br></div><div>Thanks!<br></div></div></div></div>
</blockquote></div><br></div>
</div></div><br></div></div>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>
</blockquote></div><br></div>