Skip to content

Commit 20b98cc

Browse files
Fix check for statically linked binaries (#341)
1 parent 2f56eec commit 20b98cc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

linux/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ RUN git clone ${crystal_repo} \
6060
\
6161
&& make crystal stats=true static=true ${release:+release=true} \
6262
CRYSTAL_CONFIG_TARGET=${gnu_target} \
63-
&& ([ "$(ldd .build/crystal 2>&1 | wc -l)" -eq "1" ] || { echo './build/crystal is not statically linked'; ldd .build/crystal; exit 1; })
63+
&& ( (readelf --program-headers .build/crystal | grep -q "Elf file type is EXEC") || { echo 'crystal is not statically linked'; exit 1; }) \
64+
&& .build/crystal --version
6465

6566
# Build shards
6667
ARG shards_version
@@ -71,7 +72,9 @@ RUN git clone https://github.com/crystal-lang/shards \
7172
&& make SHARDS=false CRYSTAL=/crystal/bin/crystal \
7273
FLAGS="--stats --target ${musl_target} --static ${release:+--release}" \
7374
\
74-
&& ([ "$(ldd bin/shards 2>&1 | wc -l)" -eq "1" ] || { echo 'shards is not statically linked'; ldd bin/shards; exit 1; })
75+
&& bin/shards --version \
76+
&& ( (readelf --program-headers bin/shards | grep -q "Elf file type is EXEC") || { echo 'shards is not statically linked'; exit 1; }) \
77+
&& readelf --program-headers bin/shards
7578

7679
COPY --from=bdwgc /bdwgc/.libs/libgc.a /libgc-debian.a
7780

0 commit comments

Comments
 (0)