[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.

Don Hinton via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 12:57:41 PST 2018


On Thu, Jan 25, 2018 at 5:20 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

>
>
> On Jan 25, 2018, at 17:09, Don Hinton <hintonda at gmail.com> wrote:
>
>
>
> On Thu, Jan 25, 2018 at 4:21 PM, Duncan P. N. Exon Smith <
> dexonsmith at apple.com> wrote:
>
>>
>>
>> On Jan 25, 2018, at 16:18, Duncan P. N. Exon Smith via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>
>>
>> On Jan 25, 2018, at 13:07, Don Hinton <hintonda at gmail.com> wrote:
>>
>> On Thu, Jan 25, 2018 at 12:54 PM, Chris Bieneman <beanz at apple.com> wrote:
>>
>>> Historically we have supported building libcxx without llvm-config
>>> available on the system.
>>>
>>> In all likelihood the bots didn't fail because the bots do have
>>> llvm-config because we usually require an llvm build or source checkout in
>>> order to build and run the tests since tests depend on lit and gtest.
>>>
>>
>> Ah, okay, but if the bots don't test/enforce this, does it make sense to
>> continue to support building without llvm-config?
>>
>>
>> I didn't realize we didn't have a bot enforcing this.  I just made one:
>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master
>> _cmake_standalone
>>
>> I don't want to break upstream users, but the alternative is to duplicate
>> this logic across multiple sub-projects.  (see http://lists.llvm.org/pip
>> ermail/llvm-dev/2018-January/120707.html for a related rpath issue).
>>
>>
>> It's temporary though.  In the brave new world on GitHub with monorepo,
>> the runtime libraries will be able to access a shared set of CMake
>> configuration scripts.
>>
>>
>> Note that there's other stuff duplicated in the runtime libraries, such
>> as preprocessor definitions (LLVM_... => __LIBCXX_...), that we'll never
>> really be able to collapse.
>>
>
> Great, I've changed it to this:
>
> +  if(LLVM_FOUND)
> +    llvm_setup_rpath(cxx_shared)
> +  endif()
>
> Which should work for both cases.  Is that okay?
>
>
> SGTM.
>

Turns out LLVM_FOUND doesn't cover all cases, i.e., it's only set by libcxx
and libcxxabi when doing out-of-tree builds.  A better solution is to check
if the command is actually available:

-  if(LLVM_FOUND)
+  if(COMMAND llvm_setup_rpath)
     llvm_setup_rpath(cxx_shared)
   endif()


>
>
>
>>
>>
>>
>>
>>>
>>>
>>> -Chris
>>>
>>>
>>> On Jan 25, 2018, at 12:51 PM, Don Hinton <hintonda at gmail.com> wrote:
>>>
>>> On Thu, Jan 25, 2018 at 12:29 PM, Duncan P. N. Exon Smith <
>>> dexonsmith at apple.com> wrote:
>>>
>>>> I don't really understand why, but our bots seemed to survive this:
>>>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master
>>>> _cmake/2137/
>>>>
>>>> Console output is here:
>>>> http://lab.llvm.org:8080/green/view/Libcxx/job/libcxx_master
>>>> _cmake/2137/consoleFull
>>>>
>>>> That doesn't necessarily mean it's safe.  Does anyone know why this
>>>> might have "worked"?
>>>>
>>>
>>> I'm not an expert, but llvm installs all of these cmake modules along
>>> side llvm-config, so if you find llvm-config, you find these modules.
>>>
>>> So, unless I'm missing something, it looks like AddLLVM.cmake is always
>>> available.
>>>
>>>
>>>>
>>>> On Jan 25, 2018, at 11:02, Shoaib Meenai <smeenai at fb.com> wrote:
>>>>
>>>> This is going to break building libc++ standalone (i.e. without any
>>>> LLVM repository or even its CMake modules), right? Some upstream users care
>>>> a lot about that use case (CC beanz and Duncan).
>>>>
>>>> *From: *cfe-commits <cfe-commits-bounces at lists.llvm.org> on behalf of
>>>> Don Hinton via cfe-commits <cfe-commits at lists.llvm.org>
>>>> *Reply-To: *Don Hinton <hintonda at gmail.com>
>>>> *Date: *Thursday, January 25, 2018 at 10:15 AM
>>>> *To: *"cfe-commits at lists.llvm.org" <cfe-commits at lists.llvm.org>
>>>> *Subject: *[libcxx] r323453 - [cmake] [libcxx] Call llvm_setup_rpath()
>>>> when adding shared libraries.
>>>>
>>>> Author: dhinton
>>>> Date: Thu Jan 25 10:13:26 2018
>>>> New Revision: 323453
>>>>
>>>> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llv
>>>> m.org_viewvc_llvm-2Dproject-3Frev-3D323453-26view-3Drev&d=Dw
>>>> IGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=zwv
>>>> Smk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8&s=LDCu89byjNdZWoCIY
>>>> HGHaPr3IamIdHLF0JwbnYE92vM&e=
>>>> Log:
>>>> [cmake] [libcxx] Call llvm_setup_rpath() when adding shared libraries.
>>>>
>>>> Clang and llvm already use llvm_setup_rpath(), so this change will
>>>> help standarize rpath usage across all projects.
>>>>
>>>> Differential Revision: https://urldefense.p
>>>> roofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D42459&d=D
>>>> wIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=zw
>>>> vSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8&s=YCR-YJBua5p-4IK0
>>>> 5GjHoZUU7aN8UJAFzL2xaz7byyw&e=
>>>>
>>>> Modified:
>>>>     libcxx/trunk/lib/CMakeLists.txt
>>>>
>>>> Modified: libcxx/trunk/lib/CMakeLists.txt
>>>> URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llv
>>>> m.org_viewvc_llvm-2Dproject_libcxx_trunk_lib_CMakeLists.txt-
>>>> 3Frev-3D323453-26r1-3D323452-26r2-3D323453-26view-3Ddiff&d=D
>>>> wIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=zw
>>>> vSmk9ZIfMARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8&s=Rd7xc2GWS8oyDcm0
>>>> QshNPTqM3BglPY5_aHMIuCRUt1s&e=
>>>> ============================================================
>>>> ==================
>>>> --- libcxx/trunk/lib/CMakeLists.txt (original)
>>>> +++ libcxx/trunk/lib/CMakeLists.txt Thu Jan 25 10:13:26 2018
>>>> @@ -222,6 +222,7 @@ set(LIBCXX_TARGETS)
>>>> # Build the shared library.
>>>> if (LIBCXX_ENABLE_SHARED)
>>>>    add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>)
>>>> +  llvm_setup_rpath(cxx_shared)
>>>>    target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES})
>>>>    set_target_properties(cxx_shared
>>>>      PROPERTIES
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at lists.llvm.org
>>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.ll
>>>> vm.org_cgi-2Dbin_mailman_listinfo_cfe-2Dcommits&d=DwIGaQ&c=5
>>>> VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=zwvSmk9ZIfM
>>>> ARYg3JvYvNuA0Iz-PEq3H2i_ICF6vsR8&s=TPt8bk99XfmUCdi7MBxyguYV6
>>>> hJg3PsXFCTXyDfGms8&e=
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180126/d4433b40/attachment-0001.html>


More information about the cfe-commits mailing list