Hello,
I have created a template project for building musl-built static binaries here: https://github.com/kaushalmodi/hello_musl .
But I will need some help to complete the Todo list in there.
Eventually I would like to have everything packed in a single config.nims file without needing that helper foo.nimble file. Is that possible?
Thanks!
I just do:
nim --gcc.exe:/usr/bin/musl-gcc --gcc.linkerexe:/usr/bin/musl-gcc --opt:size c hello
Yes, that works. I would like to translate that + strip -s to a single config.nims recipe.
Right now, I am close (as you see in that repo).. using config.nims + PROJ.nimble files. With that I need to do just nimble musl.
The issue is portability.. I need to copy/paste the necessary tasks from PROJ.nimble in each new project.
I was eventually able to pack everything in a single config.nims file.
With this config.nims, you now need to just run nim musl FOO.nim to generate a FOO static binary.
What kind of benefit do you get from musl?
I use alpine linux which uses musl, that means my stuff is musl built? I did not need special config for that? Does nim sill use glibc when build on alpine that uses musl?
I use alpine linux which uses musl
I use RHEL 6.8 where musl is not the default.
Also, if I publish binaries of a CLI project built with Nim, it's better that I distribute musl built binaries. That way almost all GNU/Linux type distributions will be able to run those binaries right away.
Example: the choosenim binary that's distributed is not built using musl. So it doesn't work on my OS. It requires glibc>=2.14, whereas my OS has glibc 2.12.
Building and distributing binaries using musl will avoid such issues.