<div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>How are you adding the library?  Are you using "-L /path/to/boost/libs -lboost_foo" syntax when using target_link_libraries?  What do you see when running "otool -L" on the resulting executable?  If you still need to run install_name_tool, I suppose you can do it using a POST_BUILD cmake command.</div><div><a href="https://cmake.org/cmake/help/v3.13/command/add_custom_command.html">https://cmake.org/cmake/help/v3.13/command/add_custom_command.html</a><br></div><div><br></div><div>Regards,</div><div><br></div><div>Juan</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 6, 2019 at 11:32 AM Stephens, J. Adam <<a href="mailto:jasteph@sandia.gov">jasteph@sandia.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-US">
<div class="gmail-m_6332617771472082348WordSection1">
<p class="MsoNormal">Hi Juan,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I believe BUILD_WITH_INSTALL_RPATH would place the correct RPATH in the executables. It’s a potentially easier alternative to using the BUILD_RPATH property for that purpose. However, I think it’s only half of what needs to happen. The
 linker still would be unable to find the boost libraries because their install names do not contain @rpath. Thanks for the suggestion.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">--<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">J. Adam Stephens, Ph.D.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">Dakota Support Analyst<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif"><a href="https://dakota.sandia.gov/" target="_blank"><span style="color:rgb(5,99,193)">https://dakota.sandia.gov/</span></a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">Optimization and UQ<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">Sandia National Laboratories<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:12pt;font-family:"Times New Roman",serif">Albuquerque, NM<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">Juan Sanchez <<a href="mailto:juan.e.sanchez@gmail.com" target="_blank">juan.e.sanchez@gmail.com</a>><br>
<b>Date: </b>Tuesday, February 5, 2019 at 3:37 PM<br>
<b>To: </b>"Stephens, J. Adam" <<a href="mailto:jasteph@sandia.gov" target="_blank">jasteph@sandia.gov</a>><br>
<b>Cc: </b>"Maynard, Robert (External Contact)" <<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>>, "<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>" <<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>><br>
<b>Subject: </b>Re: [CMake] [EXTERNAL] Re: Linking to boost on OS X 10.12<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal">Hello, <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Are you able to use BUILD_WITH_INSTALL_RPATH:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://cmake.org/cmake/help/v3.13/prop_tgt/BUILD_WITH_INSTALL_RPATH.html" target="_blank">https://cmake.org/cmake/help/v3.13/prop_tgt/BUILD_WITH_INSTALL_RPATH.html</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://cmake.org/cmake/help/v3.13/prop_tgt/INSTALL_RPATH.html#prop_tgt:INSTALL_RPATH" target="_blank">https://cmake.org/cmake/help/v3.13/prop_tgt/INSTALL_RPATH.html#prop_tgt:INSTALL_RPATH</a><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Juan<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Feb 5, 2019 at 4:00 PM Stephens, J. Adam via CMake <<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Hi Robert,<br>
<br>
Thanks for your reply. We do use install_name_tool and the like when installing/packaging, and our packages continue to work fine on OS X 10.12. My question is about what to do with executables before packaging, while they are still just in the build tree.
 We need them to work for purposes of testing via CTest.<br>
<br>
Adam<br>
<br>
<br>
On 2/5/19, 2:56 PM, "Robert Maynard" <<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>> wrote:<br>
<br>
    My general approach for the second problem is to run a tool such as<br>
    install_name_tool to change the library names to have @rpath when<br>
    constructing the package.<br>
<br>
    On Tue, Feb 5, 2019 at 2:25 PM Stephens, J. Adam via CMake<br>
    <<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>> wrote:<br>
    ><br>
    > Hello,<br>
    ><br>
    ><br>
    ><br>
    > The project I work on links to several shared boost libraries. After our organization disallowed use of OS X 10.11 and we upgraded our built/test slave to 10.12, we encountered a problem with our testing. Executables in the build tree that were built
 as part of our project now fail to run with the error that boost libraries can’t be found.<br>
    ><br>
    ><br>
    ><br>
    > Superficially, the problem is that (I think) Apple strengthened the SIP between 10.11 and 10.12 to prevent DYLD_LIBRARY_PATH from having any effect – previously the linker was able to locate the boost libs for our build tree executables that way.<br>
    ><br>
    ><br>
    ><br>
    > The deeper problem is twofold: First, the build tree executables don’t include the boost lib folder in their RPATHs. Second, the install names embedded in boost libs themselves are just the bare filenames with no @rpath. (My understanding is, the boost
 project does that deliberately because they can’t know what users of their libraries will want.)<br>
    ><br>
    ><br>
    ><br>
    > Recent versions of CMake (3.8+) have the property BUILD_RPATH that we could use to embed the path to the boost libs into the build tree executables. That doesn’t solve the second part of the problem, though. Without embedding install names that look like
 @rpath/libboost_foo.dylib in the build tree executables, I think the linker will still be unable to find them.<br>
    ><br>
    ><br>
    ><br>
    > What is the best (or least bad) way to fix this?<br>
    ><br>
    ><br>
    ><br>
    > Thanks!<br>
    ><br>
    ><br>
    ><br>
    > Adam<br>
    ><br>
    ><br>
    ><br>
    > --<br>
    ><br>
    > J. Adam Stephens, Ph.D.<br>
    ><br>
    > Dakota Support Analyst<br>
    ><br>
    > <a href="https://dakota.sandia.gov/" target="_blank">https://dakota.sandia.gov/</a><br>
    ><br>
    > Optimization and UQ<br>
    ><br>
    > Sandia National Laboratories<br>
    ><br>
    > Albuquerque, NM<br>
    ><br>
    ><br>
    ><br>
    > --<br>
    ><br>
    > Powered by <a href="http://www.kitware.com" 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" 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" target="_blank">
http://cmake.org/cmake/help/support.html</a><br>
    > CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">
http://cmake.org/cmake/help/consulting.html</a><br>
    > CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" 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" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
    ><br>
    > Follow this link to subscribe/unsubscribe:<br>
    > <a href="https://cmake.org/mailman/listinfo/cmake" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
<br>
<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" 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" 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" target="_blank">
http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">
http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" 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" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>

</blockquote></div>