diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index ce137bd..6907ed2 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -244,6 +244,23 @@ else warn "Neither 'timeout' nor 'gtimeout' found; running without timeout protection" fi +# 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: 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" + 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 + export LD_LIBRARY_PATH="${SMOKE_LD_PATH}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" + fi +fi + set +e if [[ -n "$TIMEOUT_CMD" ]]; then $TIMEOUT_CMD "$TIMEOUT" "${WORK_DIR}/hello" > "${WORK_DIR}/actual" 2>&1