This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Force-cache LIBCXX_CXX_ABI_LIBRARY_PATH
ClosedPublic

Authored by broadwaylamb on Oct 18 2019, 7:52 AM.

Details

Summary

The LIBCXX_CXX_ABI_LIBRARY_PATH CMake variable is cached once in
libcxx/cmake/Modules/HandleLibCXXABI.cmake in the setup_abi_lib macro,
and then cached again in libcxx/test/CMakeLists.txt. There, if it is
not set to a value, it is by default set to LIBCXX_LIBRARY_DIR.

However, this new value is not actually cached, because the old (empty)
value has been already cached. Use the FORCE CMake flag so that it
is saved to the cache.

This should not break anything, because the code changed here previously
had no effect, when it should have.

Diff Detail

Event Timeline

broadwaylamb created this revision.Oct 18 2019, 7:52 AM

Can anyone review this small modification?

Remove unrelated change

broadwaylamb edited the summary of this revision. (Show Details)Dec 6 2019, 10:34 AM

@jroelofs would you mind reviewing this one too, please?

This revision is now accepted and ready to land.Jan 9 2020, 10:57 PM
This revision was automatically updated to reflect the committed changes.

This change broke stand-alone builds. They now try to use libc++abi from the wrong directory, instead of system instance:

clang-10: error: no such file or directory: '/home/mgorny/llvm-project/libcxx/build/lib64/libc++abi.a'

That said, can we revert this from 10.x branch, please?

That said, can we revert this from 10.x branch, please?

I'm investigating it right now, thanks for pointing this out.

Could you please show me how you're building libc++? I'm having trouble reproducing the issue.

broadwaylamb added a comment.EditedJan 31 2020, 3:38 AM

Anyway, reverted from 10.x in 3573526c0286c9461f0459be1a4592b2214594e7.

Could you please show me how you're building libc++? I'm having trouble reproducing the issue.

cmake <path-to-libc++-src> -G Ninja -DLIBCXX_LIBDIR_SUFFIX=64 -DLIBCXX_ENABLE_SHARED=ON -DLIBCXX_ENABLE_STATIC=yes -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_CXX_ABI_INCLUDE_PATHS=/usr/include/libcxxabi -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF -DLIBCXX_HAS_MUSL_LIBC=no -DLIBCXX_HAS_GCC_S_LIB=ON -DLIBCXX_INCLUDE_TESTS=yes -DLIBCXX_USE_COMPILER_RT=OFF -DCMAKE_SHARED_LINKER_FLAGS="-lunwind -Wl,-O1 -Wl,--as-needed" -DLLVM_EXTERNAL_LIT=/usr/bin/lit -DLLVM_LIT_ARGS="-vv;-j;32;--param=cxx_under_test=/usr/lib/llvm/10/bin/x86_64-pc-linux-gnu-clang" -DCMAKE_BUILD_TYPE=RelWithDebInfo &&
ninja check-cxx
hans added a subscriber: hans.Feb 3 2020, 2:06 AM

Anyway, reverted from 10.x in 3573526c0286c9461f0459be1a4592b2214594e7.

Please don't push directly to the release branch without checking with me. Also, commits should go to master first, before being cherry-picked to any release branches.

I've cherry-picked the revert to master in 1a7e688b0b5a986fbbbce62ff1506a5991b0fce0

Please see http://lists.llvm.org/pipermail/llvm-dev/2020-January/138295.html for more info about the branch.

Anyway, reverted from 10.x in 3573526c0286c9461f0459be1a4592b2214594e7.

Please don't push directly to the release branch without checking with me. Also, commits should go to master first, before being cherry-picked to any release branches.

I've cherry-picked the revert to master in 1a7e688b0b5a986fbbbce62ff1506a5991b0fce0

Please see http://lists.llvm.org/pipermail/llvm-dev/2020-January/138295.html for more info about the branch.

Understood. Sorry.

@mgorny I still can't reproduce the issue. What Linux distro are you using and how did you install your LLVM toolchain?

Gentoo, using the ebuilds. I think the most relevant is how libc++abi is configured:

cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DLIBCXXABI_LIBDIR_SUFFIX=64 -DLIBCXXABI_ENABLE_SHARED=ON -DLIBCXXABI_ENABLE_STATIC=yes -DLIBCXXABI_USE_LLVM_UNWINDER=yes -DLIBCXXABI_INCLUDE_TESTS=no -DLIBCXXABI_USE_COMPILER_RT=OFF -DLIBCXXABI_LIBCXX_INCLUDES=<path-to-tree>/libcxx/include -DLIBCXXABI_LIBUNWIND_INCLUDES=/usr/include -DCMAKE_BUILD_TYPE=RelWithDebInfo <path>

After normal ninja install, we additionally copy headers (contents of include directory) to /usr/include/libcxxabi, i.e.:

$ tree /usr/include/libcxxabi/
/usr/include/libcxxabi/
├── __cxxabi_config.h
└── cxxabi.h

0 directories, 2 files

@mgorny Thank you. I've been able to reproduce it on my Ubuntu installation.