Static compiling newlisp for portable binaries

Started by TedWalther, January 27, 2017, 05:13:32 AM

Previous topic - Next topic

TedWalther

Has anyone tried to compile newlisp statically for use on Linux or other Unix?  It may work on BSD and Mac OSX, I haven't tried.  However, the problem is always the resolver.  If you use any network functions in the program, you simply cannot get a static binary.



What is a static binary?  A static binary is one where all the libraries are compiled into one file together with your program.  So you can grab the executable file and dump it on any machine and it will run, without worrying about installing the right versions of libraries.



I looked up the problem today to see if it had a fix yet, and found this article:



http://www.macieira.org/blog/2012/01/sorry-state-of-dynamic-libraries-on-linux/">http://www.macieira.org/blog/2012/01/so ... -on-linux/">http://www.macieira.org/blog/2012/01/sorry-state-of-dynamic-libraries-on-linux/



Amazing read.  I didn't realize that Linux (and GNU) have broken things so badly.  If you link your programs to libraries, there are lots of optimizations that are missed, and lots of code is done sub-optimally.  A lot of function calls have to go through 2 levels of indirection.



I wish there was more documentation like this, where people explain what is happening at the assembly language level.  It isn't that complicated, once someone actually shows you the important bits.



Has anyone else figured out how to static link newlisp on Linux?
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.

TedWalther

#1
I tested a simple socket program on OpenBSD, and static linking works fine.  So this is a Linux issue.  The solution is to use a different version of libc.  The MUSL version looks pretty good.  I'll need to test it with newlisp soon to confirm it provides everything newlisp needs.



https://www.musl-libc.org/">https://www.musl-libc.org/
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence.  Nine months later, they left with a baby named newLISP.  The women of the ivory towers wept and wailed.  \"Abomination!\" they cried.