Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dev] link directly to system libunwind #172

Merged
merged 8 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .ci_support/linux_64_.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ cxx_compiler_version:
- '13'
docker_image:
- quay.io/condaforge/linux-anvil-cos7-x86_64
libunwind:
- '1.6'
target_platform:
- linux-64
zip_keys:
Expand Down
13 changes: 1 addition & 12 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LLVM_PREFIX=$PREFIX
if [[ "$target_platform" == osx-* ]]; then
export CFLAGS="$CFLAGS -isysroot $CONDA_BUILD_SYSROOT"
export CXXFLAGS="$CXXFLAGS -isysroot $CONDA_BUILD_SYSROOT"
export LDFLAGS="$LDFLAGS -isysroot $CONDA_BUILD_SYSROOT"
export LDFLAGS="$LDFLAGS -isysroot $CONDA_BUILD_SYSROOT -framework CoreFoundation"

export CMAKE_EXTRA_ARGS="-DCMAKE_OSX_SYSROOT=$CONDA_BUILD_SYSROOT -DLIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS=ON"
fi
Expand Down Expand Up @@ -41,15 +41,4 @@ ninja -C build install-cxx install-cxxabi install-unwind
if [[ "$target_platform" == osx-* ]]; then
# on osx we point libc++ to the system libc++abi
$INSTALL_NAME_TOOL -change "@rpath/libc++abi.1.dylib" "/usr/lib/libc++abi.dylib" $PREFIX/lib/libc++.1.0.dylib
# same for libunwind
$INSTALL_NAME_TOOL -change "@rpath/libunwind.1.dylib" "/usr/lib/system/libunwind.dylib" $PREFIX/lib/libc++.1.0.dylib
else
# point libcxxabi & libcxx (the actual libs, not the symlinks) to the
# libunwind from https://github.com/conda-forge/libunwind-feedstock
for f in $PREFIX/lib/libc++abi.so.1.0 $PREFIX/lib/libc++.so.1.0; do
# first SOVER is the one from LLVM, the second is what we're replacing it with
patchelf --replace-needed libunwind.so.1 libunwind.so.8 --output patched $f
chmod +x patched
mv patched $f
done
fi
17 changes: 6 additions & 11 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ source:
- url: https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-{{ version.replace(".rc", "-rc") }}.tar.gz
sha256: 09c08693a9afd6236f27a2ebae62cda656eba19021ef3f94d59e931d662d4856
patches:
- patches/0003-custom-error-message-for-old-sdk.patch
# See https://discourse.llvm.org/t/shipping-custom-libc-on-macos/58606
- patches/0001-Fix-ABI-compatibility-with-system.patch # [sys_abi == "pre-12"]
- patches/0002-custom-error-message-for-old-sdk.patch
# disable feature that requires up-to-date libcxxabi, which we don't ship
- patches/0005-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch
- patches/0003-disable-_LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPT.patch
# work around https://github.com/llvm/llvm-project/issues/90332
- patches/0006-Work-around-stray-nostdlib-flags-causing-errors-with.patch
- patches/0004-Work-around-stray-nostdlib-flags-causing-errors-with.patch

build:
number: 5
number: 6
skip: true # [win]
skip: true # [ppc64le or aarch64]
ignore_run_exports:
Expand All @@ -30,11 +32,9 @@ requirements:
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
- python >3 # [not osx]
- patchelf # [linux]
host:
- clangdev {{ version }} # [not osx]
- llvmdev {{ version }} # [not osx]
- libunwind # [linux]

outputs:
- name: libcxx
Expand All @@ -52,7 +52,6 @@ outputs:
- {{ compiler('cxx') }}
- {{ stdlib('c') }}
host:
- {{ pin_subpackage("libcxxabi", exact=True) }} # [linux]
run:
- {{ pin_subpackage("libcxxabi", exact=True) }} # [linux]
run_constrained:
Expand Down Expand Up @@ -110,10 +109,6 @@ outputs:
build:
# for run-exports
- {{ stdlib('c') }}
host:
- libunwind # [linux]
run:
- libunwind # [linux]
test:
commands:
- test -f $PREFIX/lib/libc++abi.so # [linux]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From b1113a136e91b0788e2fa28e578142e45016eae9 Mon Sep 17 00:00:00 2001
From b461291f007bc7457a5a7f7219cd0943b8e7ba3d Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Tue, 13 Jul 2021 01:57:06 -0500
Subject: [PATCH 2/5] Fix ABI compatibility with system
Subject: [PATCH 1/4] Fix ABI compatibility with system

---
libcxx/src/locale.cpp | 16 ++++++++--------
Expand Down
37 changes: 0 additions & 37 deletions recipe/patches/0001-Support-legacy-standalone-builds.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 7e2722ee435b20f9445be40ace0f5298126ae23c Mon Sep 17 00:00:00 2001
From bacfd686f6d24164b4c6bbdc8cdf022740106991 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <[email protected]>
Date: Wed, 29 Dec 2021 19:28:35 -0800
Subject: [PATCH 3/5] custom error message for old sdk
Subject: [PATCH 2/4] custom error message for old sdk

Co-Authored-By: H. Vetinari <[email protected]>
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 4744d322ef96d67b8543897b49ec8897d2633a1a Mon Sep 17 00:00:00 2001
From b696d088e01cfa8b3e7dd226342ca37bd8c95621 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Sun, 26 May 2024 22:04:04 +1100
Subject: [PATCH 4/5] disable _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
Subject: [PATCH 3/4] disable _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
unconditionally

When _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS is not defined, things
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
From 6a49c1d89912796cd7ea3f4a9e3eb606ca553257 Mon Sep 17 00:00:00 2001
From 46bea2a31254d1d997c220685742f68f02f1f351 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Sun, 26 May 2024 13:01:28 +1100
Subject: [PATCH 5/5] Work around stray `-nostdlib++` flags causing errors with
Subject: [PATCH 4/4] Work around stray `-nostdlib++` flags causing errors with
C compiler

---
libcxxabi/cmake/config-ix.cmake | 7 +++++--
libunwind/cmake/config-ix.cmake | 7 +++++--
libunwind/src/CMakeLists.txt | 6 ++++--
2 files changed, 9 insertions(+), 4 deletions(-)
3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/libcxxabi/cmake/config-ix.cmake b/libcxxabi/cmake/config-ix.cmake
index 10f2087c68c5..c0e58f8b255c 100644
--- a/libcxxabi/cmake/config-ix.cmake
+++ b/libcxxabi/cmake/config-ix.cmake
@@ -106,8 +106,11 @@ elseif(ANDROID)
check_library_exists(c __cxa_thread_atexit_impl ""
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
else()
- check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
- check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
+ # misdetected due to https://github.com/llvm/llvm-project/issues/90332
+ # check_library_exists(dl dladdr "" LIBCXXABI_HAS_DL_LIB)
+ # check_library_exists(pthread pthread_once "" LIBCXXABI_HAS_PTHREAD_LIB)
+ set(LIBCXXABI_HAS_DL_LIB YES)
+ set(LIBCXXABI_HAS_PTHREAD_LIB YES)
check_library_exists(c __cxa_thread_atexit_impl ""
LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
endif()
diff --git a/libunwind/cmake/config-ix.cmake b/libunwind/cmake/config-ix.cmake
index 126c872f0d48..ab9ea1d5ce01 100644
--- a/libunwind/cmake/config-ix.cmake
Expand Down