~subsetpark/bagatto#15: 
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:

(declare-executable
  :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

Status
REPORTED
Submitter
~subsetpark
Assigned to
No-one
Submitted
1 year, 11 months ago
Updated
1 year, 10 months ago
Labels
No labels applied.

~subsetpark 1 year, 11 months ago

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

~subsetpark 1 year, 11 months ago*


~subsetpark 1 year, 11 months ago*


~subsetpark 1 year, 10 months ago

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

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