[libcxx] [libcxxabi] Improve cmake scripts

Hi,

I’m trying to build a C++ runtime stack composed of libcxx, libcxxabi and libunwind on Linux, out of the LLVM tree. It is pretty smooth once you find out the right options to use, which are not mentioned on the official pages.

But there’s still something I find a bit annoying and could be easily fixed in the cmake scripts:

  • When building libcxx, you can specify locations of libcxxabi’s headers and library file respectively via LIBCXX_CXX_ABI_INCLUDE_PATHS and LIBCXX_CXX_ABI_LIBRARY_PATH. But somehow LIBCXX_CXX_ABI_LIBRARY_PATH is not parsed properly in the cmake script and you can’t set it to a relative path; while you can set LIBCXX_CXX_ABI_INCLUDE_PATHS to either relative or absolute paths. This looks inconsistent to me, and can be trivially fixed.

  • When building libcxxabi, you can specify the location of libunwind’s headers via LIBCXXABI_LIBUNWIND_PATH, but have nowhere to specify the location of its library file; thus I have to manually set CMAKE_SHARED_LINKER_FLAGS to include this path. Again this looks inconsistent, and could be fixed by introducing a similar variable named LIBCXXABI_LIBUWIND_LIBRARY_PATH.

These are not big problems. I just feel like making the cmake options look more consistent, and the fix is really trivial. I include the experimental patches that I use and it’s just a few lines of change.

Thanks!
Lei

libcxx.diff (526 Bytes)

libcxxabi.diff (978 Bytes)

Hi,

Just to be clear, you are building libcxx/libcxxabi and libunwind out-of-tree right? I normally do in-tree builds and don’t see any of these problems on Linux.

I think it would be easiest if you raise defects (see for example [1,2]) and attach your patches there.

I agree that we should improve the build scripts to make them work out-of-the-box.

/ Asiri

[1] https://llvm.org/bugs/show_bug.cgi?id=27706
[2] https://llvm.org/bugs/show_bug.cgi?id=27751

Just to be clear, you are building libcxx/libcxxabi and libunwind
out-of-tree right? I normally do in-tree builds and don't see any of these
problems on Linux.

Yes, I'm building them out of tree.

I think it would be easiest if you raise defects (see for example [1,2])
and attach your patches there.

Thanks for the pointer! Will do.

I agree that we should improve the build scripts to make them work
out-of-the-box.

Actually besides those mentioned, I also noticed some other suspicious
settings in the cmake scripts; I'm just too lazy to investigate them all...
It would be great if some insider could overhaul the scripts thus making
the building experience even smoother :slight_smile:

BTW, the tutorials on the official pages could be improved, too.

Lei

Actually besides those mentioned, I also noticed some other suspicious
settings in the cmake scripts; I'm just too lazy to investigate them all...
It would be great if some insider could overhaul the scripts thus making
the building experience even smoother :slight_smile:

There are only a very few "insiders" (I'm not one). So, patches welcome! :wink:

/ Asiri