fix: add -DHAVE_CURL to el_runtime.c compilation, restore el_runtime.o for soul-demo

Root cause: the staged el_runtime.c (from el.git) wraps the entire OTLP
observability section (emit_metric, emit_log, trace_span_start/end) in
#ifdef HAVE_CURL. Without -DHAVE_CURL, those symbols are compiled out,
causing the undefined reference linker errors.

libcurl IS available (installed via libcurl4-openssl-dev), so -DHAVE_CURL
correctly enables the OTLP code path.

Also reverts the soul-demo compile to use el_runtime.o (the pre-compiled
cached object) now that the object will contain the correct symbols.
This commit is contained in:
2026-05-06 21:35:16 -05:00
parent 843b6e07a7
commit f0a6b55a13
+5 -5
View File
@@ -28,7 +28,10 @@ COPY runtime/el_runtime.c runtime/el_runtime.h ./
# Pre-compile el_runtime as a separate cached layer.
# el_runtime.c changes rarely; main.c changes every run.
# Splitting this out means el_runtime.o is cached across builds when only main.c changes.
RUN cc -O2 -c el_runtime.c -I. -o el_runtime.o
# -DHAVE_CURL: the staged el_runtime.c (from el.git) guards the OTLP observability
# section (emit_metric, emit_log, trace_span_*) behind #ifdef HAVE_CURL.
# libcurl IS installed above, so define HAVE_CURL to enable those functions.
RUN cc -O2 -DHAVE_CURL -c el_runtime.c -I. -o el_runtime.o
# ── Build neuron-web ──────────────────────────────────────────────────────────
#
@@ -44,15 +47,12 @@ RUN cc -O2 -rdynamic \
-lcurl -lpthread -ldl -lm -lssl -lcrypto
# ── Build soul-demo ───────────────────────────────────────────────────────────
# Compile soul-demo.c with el_runtime.c directly (not el_runtime.o) so that
# all runtime symbols — including emit_metric, emit_log, trace_span_* — are
# always resolved from the staged source rather than a cached object file.
COPY dist/soul-demo.c ./
COPY dist/vessel_stubs.c ./
RUN cc -O2 -rdynamic \
-o soul-demo \
soul-demo.c vessel_stubs.c el_runtime.c \
soul-demo.c vessel_stubs.c el_runtime.o \
-lcurl -lpthread -ldl -lm -lssl -lcrypto
# ── Stage 2: runtime image ────────────────────────────────────────────────────