Skip to content

Commit b6b152e

Browse files
committed
FreeBSD: Drop system libxml2 dep in tools
This drops the dependency on the system libxml2 from the tools shipped in the toolchain bundle. libxml2 is disabled entirely for the LLVM/lld build, which uses it for processing the Windows manifest files. LLDB is changed to link against the static libxml2 built for the FoundationXML library. This is technically incorrect since the runtime may be cross-compiled for a different platform than what the toolchain is built to run on, but build-script is already mixing toolchain and runtime content in inconsistent ways, so this is no worse off than we are already. libxml2 is updated pretty frequently in inconsistent ways, resulting in failures to launch due to version incompatibilities.
1 parent 16ce6b8 commit b6b152e

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

utils/build-presets.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,6 +1374,9 @@ xctest
13741374
swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;libexec;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc
13751375
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;llvm-objdump;llvm-objcopy;llvm-symbolizer;IndexStore;clang;clang-resource-headers;builtins;runtimes;clangd;libclang;lld;LTO;clang-features-file
13761376

1377+
extra-llvm-cmake-options=
1378+
-DLLVM_ENABLE_LIBXML2=OFF
1379+
13771380
install-foundation
13781381
install-libdispatch
13791382
install-llbuild

utils/build-script-impl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,33 @@ for host in "${ALL_HOSTS[@]}"; do
21262126
DOTEST_EXTRA="${DOTEST_EXTRA} -Xlinker -rpath -Xlinker ${FOUNDATION_BUILD_DIR}/lib"
21272127
fi
21282128

2129+
if [[ ! "${SKIP_BUILD_LIBXML2}" ]]; then
2130+
# Note: This is wrong when cross-compiling. LLDB is part of
2131+
# the toolchain while the built libxml2 is built for the
2132+
# runtime environment for use in FoundationXML.
2133+
# Build-Script does not separate the toolchain and runtime
2134+
# build, so this is already broken.
2135+
BASE_INSTALL_DIR="$(get_host_install_destdir ${host})"
2136+
LIBXML2_HEADERS="${BASE_INSTALL_DIR}/usr/include/libxml2"
2137+
LIBXML2_LIBRARY="${BASE_INSTALL_DIR}/usr/lib/libxml2.a"
2138+
2139+
if [[ -z "${DRY_RUN}" && ! -d "${LIBXML2_HEADERS}" ]]; then
2140+
echo "Error: '${LIBXML2_HEADERS}' does not exist" 1>&2
2141+
exit 1
2142+
fi
2143+
2144+
if [[ -z "${DRY_RUN}" && ! -e "${LIBXML2_LIBRARY}" ]]; then
2145+
echo "Error: '${LIBXML2_LIBRARY}' does not exist" 1>&2
2146+
exit 1
2147+
fi
2148+
2149+
cmake_options+=(
2150+
-DLIBXML2_INCLUDE_DIR:PATH="${LIBXML2_HEADERS}"
2151+
-DLIBXML2_LIBRARY:PATH="${LIBXML2_LIBRARY}"
2152+
-DLIBXML2_DEFINITIONS="-DLIBXML_STATIC"
2153+
)
2154+
fi
2155+
21292156
# Watchpoint testing is currently disabled: see rdar://38566150.
21302157
LLDB_TEST_CATEGORIES="--skip-category=watchpoint"
21312158

0 commit comments

Comments
 (0)