Static build for the `bag` binary

From andrewchambers:

I think all thats necessary is in your project.janet file, you just need to add :lflags ["-static"]

however, in that case if your linux distro uses glibc it won't be fully static

because they do some dumb shit

so to get a fully static one you can use a docker container with alpine linux to do the build.

that uses musl libc which can be fully statically linked

most linux distros use glibc

for windows and macos, not sure what else is needed

the windows flags will differ

macos may just work with -static For example:

  :name "hermes"
  :entry "src/hermes-main.janet"
  :lflags [;*lib-archive-lflags*
           ;(if *static-build* ["-static"] [])]
  :deps hermes-src)

you can check if its fully static like this

ldd ./some-bin

if it says 'not a dynamic binary' its fully self contained, if it prints a bunch of .so files something is not statically linked

Assigned to
2 years ago
2 years ago
No labels applied.

~subsetpark 2 years ago

so the caveat being, only C extensions you preload using the new preload thing will be importable from your user scripts afaik.

~subsetpark 2 years ago*

~subsetpark 2 years ago*

~subsetpark 2 years ago

code-src/bagatto [thread-refactor !] ⊕ jpml --compiler=musl-gcc build

Register here or Log in to comment, or comment via email.