fix(ci): link only soul.c to avoid GNU ld duplicate symbol errors
The El compiler inlines imported modules into each module's .c file. On macOS, ld64 accepts duplicate strong symbols silently. On Linux, GNU ld rejects them. soul.c is a fully merged file — every function from every imported module is present in it — so linking only soul.c against el_runtime.c produces a correct binary with no duplicates.
This commit is contained in:
@@ -109,7 +109,23 @@ jobs:
|
||||
ELC=/opt/el/dist/platform/elc
|
||||
RUNTIME=/opt/el/runtime
|
||||
|
||||
$ELB --elc=$ELC --runtime=$RUNTIME/el_runtime.c
|
||||
# Compile all El modules to C (may fail at link on Linux: the El compiler
|
||||
# inlines imported modules into each module's .c file, producing duplicate
|
||||
# symbol definitions that GNU ld rejects as errors. macOS ld accepts them
|
||||
# silently. We ignore the link failure and re-link manually below.)
|
||||
$ELB --elc=$ELC --runtime=$RUNTIME/el_runtime.c || true
|
||||
|
||||
# soul.c is a fully self-contained merged file — every function from every
|
||||
# imported module is inlined into it. Link only soul.c against el_runtime.c;
|
||||
# this avoids all duplicate-symbol conflicts from the individual module files.
|
||||
mkdir -p dist
|
||||
cc -O2 -DHAVE_CURL \
|
||||
-I$RUNTIME \
|
||||
dist/soul.c \
|
||||
$RUNTIME/el_runtime.c \
|
||||
-lssl -lcrypto -lcurl -lpthread -lm \
|
||||
-o dist/neuron
|
||||
|
||||
ls -lh dist/neuron
|
||||
|
||||
- name: Smoke test
|
||||
|
||||
Reference in New Issue
Block a user