Use pkg-config flags for nDPI compilation

Let pkg-config provide the correct include paths instead of overriding them.
This commit is contained in:
ImBenji
2025-08-29 16:05:35 +01:00
parent 39e50ab4e4
commit fe88b4bc3f

View File

@@ -49,13 +49,13 @@ RUN echo "=== Searching for nDPI files ===" && \
echo "=== Checking pkg-config ===" && \ echo "=== Checking pkg-config ===" && \
pkg-config --cflags libndpi 2>/dev/null || echo "pkg-config failed" pkg-config --cflags libndpi 2>/dev/null || echo "pkg-config failed"
# Fix nDPI compilation with proper linking order and paths # Fix nDPI compilation using pkg-config output
RUN echo "=== Attempting nDPI compilation ===" && \ RUN echo "=== Attempting nDPI compilation ===" && \
ldconfig && \ ldconfig && \
pkg-config --cflags --libs libndpi && \ NDPI_FLAGS=$(pkg-config --cflags --libs libndpi) && \
echo "Using nDPI flags: $NDPI_FLAGS" && \
gcc -o protocol_analyzer protocol_analyzer.c \ gcc -o protocol_analyzer protocol_analyzer.c \
-I/usr/local/include -L/usr/local/lib \ $NDPI_FLAGS -lpcap -ljson-c -lpthread \
-lndpi -lpcap -ljson-c -lpthread -lm \
&& echo "✅ nDPI compilation successful" \ && echo "✅ nDPI compilation successful" \
|| (echo "❌ nDPI compilation failed with exit code $?" && exit 1) || (echo "❌ nDPI compilation failed with exit code $?" && exit 1)