Skip to content

Commit 5d970ad

Browse files
committed
fix(ci): fix nmap compilation - remove CFLAGS override that breaks build
Passing CFLAGS="-Os" on the make command line overrides the configure- generated CFLAGS entirely, dropping -DHAVE_NETINET_IN_H and related defines. This causes nbase_misc.c to fail with 'AF_INET undeclared'. Use plain 'make -j$(nproc)' so the Makefile uses its own CFLAGS. Also remove --without-nping --without-ncat which were not in the original working configure command (belt-and-suspenders). Made-with: Cursor
1 parent 375621d commit 5d970ad

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

base-images/engine-tools/Dockerfile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,20 @@ RUN apt-get update && \
4141
ca-certificates \
4242
&& rm -rf /var/lib/apt/lists/*
4343

44-
# Compile Nmap; strip debug symbols to keep the binary smaller.
45-
# make -j$(nproc) parallelism is fine here – the builder stage is
46-
# discarded after COPY so its large intermediate files never commit.
44+
# Compile Nmap. make -j$(nproc) parallelism is fine here – the builder
45+
# stage is discarded after COPY so its large intermediate files never
46+
# commit to a registry layer. Do NOT override CFLAGS/CXXFLAGS on the
47+
# make command line; doing so replaces the configure-generated flags
48+
# (including required -D defines) and breaks the compilation.
4749
RUN cd /tmp && \
4850
wget -q https://nmap.org/dist/nmap-7.95.tar.bz2 && \
4951
tar xjf nmap-7.95.tar.bz2 && \
5052
cd nmap-7.95 && \
5153
touch aclocal.m4 configure Makefile.in config.h.in && \
5254
find . -name Makefile.in -exec touch {} \; && \
53-
./configure \
54-
--without-zenmap \
55-
--without-nmap-update \
56-
--without-ndiff \
57-
--without-nping \
58-
--without-ncat \
59-
&& make -j$(nproc) CFLAGS="-Os" CXXFLAGS="-Os" && \
55+
./configure --without-zenmap --without-nmap-update --without-ndiff && \
56+
make -j$(nproc) && \
6057
make install && \
61-
strip /usr/local/bin/nmap 2>/dev/null || true && \
6258
cd / && \
6359
rm -rf /tmp/nmap-7.95 /tmp/nmap-7.95.tar.bz2
6460

0 commit comments

Comments
 (0)