Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling for native_posix with newlib is missing various math symbols #8502

jukkar opened this issue Jun 21, 2018 · 1 comment


None yet
2 participants
Copy link

commented Jun 21, 2018

Just noticed that if I have


defined and my application tries to use sqrt() or pow() math functions, then with native_posix board I will get following linker error:

subsys/net/ip/l2/gptp/libsubsys__net__ip__l2__gptp.a(gptp.c.obj): In function `get_stats':
zephyr/subsys/net/ip/l2/gptp/gptp.c:922: undefined reference to `sqrt'
subsys/net/ip/l2/gptp/libsubsys__net__ip__l2__gptp.a(gptp_messages.c.obj): In function `gptp_handle_sync':
zephyr/subsys/net/ip/l2/gptp/gptp_messages.c:885: undefined reference to `pow'
subsys/net/ip/l2/gptp/libsubsys__net__ip__l2__gptp.a(gptp_mi.c.obj): In function `gptp_mi_pss_rcv_compute':
zephyr/subsys/net/ip/l2/gptp/gptp_mi.c:315: undefined reference to `pow'
collect2: error: ld returned 1 exit status

There is no error if minimal libc and native_posix are being used. I need to use newlib in some cases because %f print modifier does not work with minimal libc.

Tested this with frdm_k64f and sam_e70_xplained boards, and there the math symbols are found just fine during linking if newlib is enabled. So this only affects newlib with native_posix board.


This comment has been minimized.

Copy link

commented Jun 21, 2018

PR with fix coming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.