Skip to content

Commit 07c8a25

Browse files
committed
fix(lambda-layer): drop unused libicu DT_NEEDED via --as-needed linker flag
AL2023's boost-devel puts libicu on the linker's library path. The default ld behaviour records every library in scope as DT_NEEDED, so libparquet.so ended up declaring libicudata/libicui18n/libicuuc as runtime deps even though Arrow uses zero ICU symbols (confirmed by `objdump -T`). Lambda's AL2023 runtime doesn't ship libicu, so layers for py3.12+ failed to import with "libicudata.so.67: cannot open shared object file". Pass -Wl,--as-needed via CMAKE_{SHARED,EXE}_LINKER_FLAGS so the linker omits DT_NEEDED entries for libraries whose symbols are never referenced. This is the proper fix for the original problem PR #3336 worked around — it now applies generally rather than relying on libicu being absent from the build env.
1 parent 434fbda commit 07c8a25

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

building/lambda/build-lambda-layer.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ mkdir $ARROW_HOME
2626
mkdir arrow/cpp/build
2727
pushd arrow/cpp/build
2828

29+
# -Wl,--as-needed drops DT_NEEDED entries for libraries whose symbols are never
30+
# referenced. On AL2023, boost-devel pulls libicu into the linker's library
31+
# path; without --as-needed, libparquet.so picks up libicudata/libicui18n/
32+
# libicuuc as DT_NEEDED even though Arrow uses zero ICU symbols. Lambda's
33+
# AL2023 runtime doesn't ship libicu, so the resulting layer fails to import.
2934
cmake \
3035
-DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
3136
-DCMAKE_INSTALL_LIBDIR=lib \
37+
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed" \
38+
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed" \
3239
-DARROW_PYTHON=ON \
3340
-DARROW_PARQUET=ON \
3441
-DARROW_DATASET=ON \

0 commit comments

Comments
 (0)