Fix nDPI protocol analyzer compilation
Properly link required libraries (json-c, pthread, math) and fail build if compilation fails instead of silencing the error. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -49,14 +49,15 @@ RUN echo "=== Searching for nDPI files ===" && \
|
||||
echo "=== Checking pkg-config ===" && \
|
||||
pkg-config --cflags libndpi 2>/dev/null || echo "pkg-config failed"
|
||||
|
||||
# Try multiple compilation approaches, create fallback if all fail
|
||||
RUN (gcc -o protocol_analyzer protocol_analyzer.c $(pkg-config --cflags --libs libndpi) -lpcap) || \
|
||||
(gcc -o protocol_analyzer protocol_analyzer.c -I/usr/local/include -L/usr/local/lib -lndpi -lpcap) || \
|
||||
(gcc -o protocol_analyzer protocol_analyzer.c -I/usr/include -L/usr/lib -lndpi -lpcap) || \
|
||||
(echo "nDPI compilation failed, creating fallback analyzer" && \
|
||||
echo '#!/bin/bash' > protocol_analyzer && \
|
||||
echo 'echo "{\"protocol\":\"Unknown\",\"category\":\"Generic\",\"confidence\":0}"' >> protocol_analyzer && \
|
||||
chmod +x protocol_analyzer)
|
||||
# Fix nDPI compilation with proper linking order and paths
|
||||
RUN echo "=== Attempting nDPI compilation ===" && \
|
||||
ldconfig && \
|
||||
pkg-config --cflags --libs libndpi && \
|
||||
gcc -o protocol_analyzer protocol_analyzer.c \
|
||||
-I/usr/local/include -L/usr/local/lib \
|
||||
-lndpi -lpcap -ljson-c -lpthread -lm \
|
||||
&& echo "✅ nDPI compilation successful" \
|
||||
|| (echo "❌ nDPI compilation failed with exit code $?" && exit 1)
|
||||
|
||||
# Compile the application
|
||||
RUN dart compile exe lib/main.dart -o waylume_server
|
||||
|
||||
Reference in New Issue
Block a user