Skip to content
Discussion options

You must be logged in to vote

use the :static option instead of putting -static in :lflags

(declare-executable
  :name "helloworld"
  :static true
  :lflags ["-s"]
  :entry "helloworld/init.janet")

the reason is janet-pm looks up libm/librt/libdl on its own and adds them with a -Wl,-Bdynamic after them, so the linker ends up back in dynamic mode. gcc's own -lc at the very end then resolves to libc.so and you get the "attempted static link of dynamic object" errors plus the undefined refs from libm.a. with :static true it adds -static itself and switches back to -Wl,-Bstatic after those libs (the libs function in spork/cc.janet), so libc comes from libc.a as well

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@fnaj77
Comment options

@heidari-dev
Comment options

@fnaj77
Comment options

Answer selected by fnaj77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants