Skip to content

Fix order ldflags - #699

Open
paugier wants to merge 2 commits into
spylang:mainfrom
paugier:fix-order-ldflags
Open

paugier wants to merge 2 commits into
spylang:mainfrom
paugier:fix-order-ldflags

Conversation

@paugier

@paugier paugier commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Fix a bug (native with -lm) by changing ldflags order: -lm last.

The PR contains a failing test and a very simple fix. The error produced by pytest spy/tests/compiler/test_native.py:

E           FAILED: test 
E           cc src/test.o src/_print.o -o test -lm -L /home/pierre/dev/spy/spy/libspy/build/native/debug -lspy
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/build/native/debug/libspy.a(operator.o): in function `spy_operator$f32_floordiv':
E           /home/pierre/dev/spy/spy/libspy/src/operator.c:50: undefined reference to `floorf'
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/build/native/debug/libspy.a(operator.o): in function `spy_unsafe$f32_unchecked_floordiv':
E           /home/pierre/dev/spy/spy/libspy/src/operator.c:60: undefined reference to `floorf'
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/build/native/debug/libspy.a(operator.o): in function `spy_operator$f32_mod':
E           /home/pierre/dev/spy/spy/libspy/src/operator.c:68: undefined reference to `fmodf'
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/build/native/debug/libspy.a(operator.o): in function `spy_unsafe$f32_unchecked_mod':
E           /home/pierre/dev/spy/spy/libspy/src/operator.c:84: undefined reference to `fmodf'
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/build/native/debug/libspy.a(operator.o): in function `spy_operator$f32_pow':
E           /home/pierre/dev/spy/spy/libspy/src/operator.c:135: undefined reference to `truncf'
E           /usr/bin/ld: /home/pierre/dev/spy/spy/libspy/src/operator.c:138: undefined reference to `powf'
E           collect2: error: ld returned 1 exit status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant