From 9fc65b8d5993026bad84a9a8619a7f4610fa1616 Mon Sep 17 00:00:00 2001 From: Yuma Endo Date: Sun, 22 Mar 2026 14:41:58 +0900 Subject: [PATCH 1/3] fix: set LD_LIBRARY_PATH for smoke test to use ingot libraries The test binary compiled by the ingot's compiler links against the ingot's libstdc++.so, which may be newer than the container's version. Set LD_LIBRARY_PATH (Linux) and DYLD_LIBRARY_PATH (macOS) to include the ingot's lib/ and lib64/ directories during test execution. Fixes: GLIBCXX_3.4.32 not found when running smoke test in ubuntu:20.04 container with GCC 15.2.0 built libstdc++. --- scripts/smoke-test.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index ce137bd..24d30bd 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -244,12 +244,26 @@ else warn "Neither 'timeout' nor 'gtimeout' found; running without timeout protection" fi +# Add ingot lib directories to library search path so the test binary +# can find libraries shipped with the toolchain (e.g., libstdc++.so +# built by GCC). Without this, the binary may link against the host/ +# container's older libstdc++ and fail with GLIBCXX version errors. +INGOT_LIB="${INGOT_ROOT}/lib" +INGOT_LIB64="${INGOT_ROOT}/lib64" +SMOKE_LD_PATH="" +[[ -d "$INGOT_LIB" ]] && SMOKE_LD_PATH="${INGOT_LIB}" +[[ -d "$INGOT_LIB64" ]] && SMOKE_LD_PATH="${SMOKE_LD_PATH:+${SMOKE_LD_PATH}:}${INGOT_LIB64}" + set +e if [[ -n "$TIMEOUT_CMD" ]]; then - $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \ + DYLD_LIBRARY_PATH="${SMOKE_LD_PATH}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}" \ + $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? else - "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \ + DYLD_LIBRARY_PATH="${SMOKE_LD_PATH}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}" \ + "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? fi set -e From fcaf3ac2c522cfc3b8a7b705477c2887113746ac Mon Sep 17 00:00:00 2001 From: Yuma Endo Date: Sun, 22 Mar 2026 14:50:13 +0900 Subject: [PATCH 2/3] fix: only set LD_LIBRARY_PATH on Linux, not DYLD_LIBRARY_PATH on macOS DYLD_LIBRARY_PATH on macOS conflicts with system frameworks and causes Abort trap: 6 crashes (observed with LLVM/Clang smoke test on darwin). macOS toolchains use @rpath or install_name for library resolution. Restrict library path override to Linux only via LD_LIBRARY_PATH. --- scripts/smoke-test.sh | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index 24d30bd..4d8b1d0 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -244,26 +244,31 @@ else warn "Neither 'timeout' nor 'gtimeout' found; running without timeout protection" fi -# Add ingot lib directories to library search path so the test binary -# can find libraries shipped with the toolchain (e.g., libstdc++.so -# built by GCC). Without this, the binary may link against the host/ -# container's older libstdc++ and fail with GLIBCXX version errors. -INGOT_LIB="${INGOT_ROOT}/lib" -INGOT_LIB64="${INGOT_ROOT}/lib64" -SMOKE_LD_PATH="" -[[ -d "$INGOT_LIB" ]] && SMOKE_LD_PATH="${INGOT_LIB}" -[[ -d "$INGOT_LIB64" ]] && SMOKE_LD_PATH="${SMOKE_LD_PATH:+${SMOKE_LD_PATH}:}${INGOT_LIB64}" +# On Linux, add ingot lib directories to LD_LIBRARY_PATH so the test +# binary can find libraries shipped with the toolchain (e.g., libstdc++.so +# built by GCC). Without this, the binary may link against the container's +# older libstdc++ and fail with GLIBCXX version errors. +# NOTE: DYLD_LIBRARY_PATH is NOT set on macOS because it can conflict with +# system frameworks and cause crashes (Abort trap: 6). macOS toolchains +# are expected to use @rpath or install_name for library resolution. +SMOKE_ENV=() +if [[ "$(uname -s)" == "Linux" ]]; then + INGOT_LIB="${INGOT_ROOT}/lib" + INGOT_LIB64="${INGOT_ROOT}/lib64" + SMOKE_LD_PATH="" + [[ -d "$INGOT_LIB" ]] && SMOKE_LD_PATH="${INGOT_LIB}" + [[ -d "$INGOT_LIB64" ]] && SMOKE_LD_PATH="${SMOKE_LD_PATH:+${SMOKE_LD_PATH}:}${INGOT_LIB64}" + if [[ -n "$SMOKE_LD_PATH" ]]; then + SMOKE_ENV=(env LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}") + fi +fi set +e if [[ -n "$TIMEOUT_CMD" ]]; then - LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \ - DYLD_LIBRARY_PATH="${SMOKE_LD_PATH}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}" \ - $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + "${SMOKE_ENV[@]}" $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? else - LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \ - DYLD_LIBRARY_PATH="${SMOKE_LD_PATH}${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}" \ - "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + "${SMOKE_ENV[@]}" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? fi set -e From 7a8be9fe5fdb1888ff2865660dfef9a675255de2 Mon Sep 17 00:00:00 2001 From: Yuma Endo Date: Sun, 22 Mar 2026 14:54:44 +0900 Subject: [PATCH 3/3] fix: use export instead of env array for LD_LIBRARY_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Empty arrays cause 'unbound variable' error with set -u (bash nounset). Use simple export on Linux instead — cleaner and avoids the issue. --- scripts/smoke-test.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index 4d8b1d0..6907ed2 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -248,10 +248,8 @@ fi # binary can find libraries shipped with the toolchain (e.g., libstdc++.so # built by GCC). Without this, the binary may link against the container's # older libstdc++ and fail with GLIBCXX version errors. -# NOTE: DYLD_LIBRARY_PATH is NOT set on macOS because it can conflict with -# system frameworks and cause crashes (Abort trap: 6). macOS toolchains -# are expected to use @rpath or install_name for library resolution. -SMOKE_ENV=() +# NOTE: Not set on macOS — DYLD_LIBRARY_PATH conflicts with system +# frameworks and causes crashes. macOS toolchains use @rpath instead. if [[ "$(uname -s)" == "Linux" ]]; then INGOT_LIB="${INGOT_ROOT}/lib" INGOT_LIB64="${INGOT_ROOT}/lib64" @@ -259,16 +257,16 @@ if [[ "$(uname -s)" == "Linux" ]]; then [[ -d "$INGOT_LIB" ]] && SMOKE_LD_PATH="${INGOT_LIB}" [[ -d "$INGOT_LIB64" ]] && SMOKE_LD_PATH="${SMOKE_LD_PATH:+${SMOKE_LD_PATH}:}${INGOT_LIB64}" if [[ -n "$SMOKE_LD_PATH" ]]; then - SMOKE_ENV=(env LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}") + export LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" fi fi set +e if [[ -n "$TIMEOUT_CMD" ]]; then - "${SMOKE_ENV[@]}" $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? else - "${SMOKE_ENV[@]}" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 + "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1 RUN_EXIT=$? fi set -e