[PATCH] [libcxx] Add support for building and testing with an ABI library not along linker paths

Dan Albert danalbert at google.com
Sat Aug 30 09:56:55 PDT 2014


>>! @EricWF wrote:
> Unfortunately not only does the user have to pass -DCMAKE_LIBRARY_PATH=/path/to/lib to CMake, but they also need to set RPATH=/path/to/lib when building libc++.
> CMake does not have a mechanism for configuring relative paths via CMake variable.

find_file() does this. Look at how I select libc++ header paths in the libc++abi CMakeLists.txt.

================
Comment at: lib/CMakeLists.txt:46
@@ -45,1 +45,3 @@
 
+# Linking against libcxxrt requires libdl on linux.
+if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt" AND
----------------
libcxxrt is the one that should be linking libdl.

For a static libcxxrt we will need this though. Do we have a way to tell if we're linking a static abi lib?

================
Comment at: lib/CMakeLists.txt:48
@@ +47,3 @@
+if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt" AND
+    "${CMAKE_SYSTEM}" MATCHES "Linux")
+  append_if(libraries LIBCXX_HAS_DL_LIB dl)
----------------
What about FreeBSD? If the BSDs need it too, I think you actually just want to remove the second half of this conditional and let append_if work out this detail.

================
Comment at: test/lit.cfg:342
@@ +341,3 @@
+        lpaths = self.get_lit_conf('library_paths', '').split(';')
+        lpaths = list((l for l in lpaths if l.strip()))
+        self.link_flags += ['-L' + self.obj_root + '/lib']
----------------
    [l for l in lpaths if l.strip()]

================
Comment at: www/index.html:440
@@ +439,3 @@
+    <p>
+        <strong>Note: This is not recommended in almost all cases.</strong>
+    </p>
----------------
Then why are we doing this?

Assuming we do want to do this, should explain why this isn't recommended.

================
Comment at: www/index.html:447
@@ +446,3 @@
+        <code>-DCMAKE_LIBRARY_PATH=/path/to/abi/lib</code> when configuring
+        CMake and set <code>RPATH=/path/to/abi/lib</code> when building libc++.
+    </p>
----------------
Aren't "configuring CMake" and "building libc++" the same thing from the (cmake) user's perspective?

More importantly, I'm pretty sure we only need one of these. See my comment about find_file().

================
Comment at: www/index.html:452
@@ +451,3 @@
+        <ul>
+        <li><code>CC=clang CXX=clang++ cmake -G "Unix Makefiles"
+                 -DLIBCXX_CXX_ABI=libc++abi
----------------
Drop the -G part. It's the default.

================
Comment at: www/index.html:456
@@ +455,3 @@
+                 -DCMAKE_LIBRARY_PATH="/path/to/libcxxabi-build/lib"
+                 <libc++-source-dir></code></li>
+        <li><code>export RPATH=/path/to/libcxxabi-build/lib</code></li>
----------------
Is this how we phrase this elsewhere in the page? I thought we did path/to/libcxx.

http://reviews.llvm.org/D5038






More information about the cfe-commits mailing list