IRC channel logs

2022-07-21.log

back to list of logs

***X-Scale` is now known as X-Scale
***X-Scale` is now known as X-Scale
<tribals>Hello!
<tribals>It's me again
<tribals> https://www.gnu.org/software/guile/manual/html_node/Network-Sockets-and-Communication.html#:~:text=Variable%3A%20PF_UNIX-,Variable%3A%20PF_INET,-Variable%3A%20PF_INET6
<tribals>Why PF_INET instead of AF_INET?
<sneek>Welcome back dsmith-work :)
<dsmith-work>Morning Greetings, Guilers
<civodul`>just learned from guix-devel that Tom Lord passed away
<dadinn>  clear
***civodul` is now known as civodul
<drakonis>does guile have compiled binaries?
<rekado_>drakonis: binaries of what?
<drakonis>the kind that can be executed in the cli
<drakonis>i'm aware that it compiles into bytecode but i havent seen anything regarding executable binaries
<drakonis>what i have seen though, are scripts that execute a code snippet to execute a init function
<rekado_>best you can do is to byte-compile it and add a tiny script wrapper that loads the compiled blob
<rekado_>e.g. a file “hello.scm” with contents (define (main . args) (display "hello")) (main)
<rekado_>compile with “guild compile hello.scm”
<drakonis>aye
<rekado_>then run the binary with guile -c '(load-compiled "hello.scm.go")'
<drakonis>that's what i thought.
<dsmith-work>Guile can not (currently) create machine native binary excecutables. It does do JIT compilation to native.
<rekado_>with some effort (and a little bit of C) you can stuff everything into a self-extracting archive and execute the blob from a memfd
<dsmith-work>Thinking about that, kind of surprised no one has done it yet.
<dsmith-work>A reason might be: With Guix, who needs that?
*dsmith-work doesn't run Guix. yet?
<drakonis>soon.
<drakonis>rekado_: will look into it later
<rekado_>I’ve built something not too dissimilar earlier: https://elephly.net/paste/1657921926.c.html
<rekado_>it was an experiment to see if we could have binaries that include a wrapper that would set environment variables needed by Guix
<drakonis>handy.
<rekado_>the blob is an executable that performs some work and then executes its payload binary
<rekado_>it’s ugly and gross and it made my wilted heart rejoice for a minute
<drakonis>hah
<drakonis>it warms my frozen heart to see such hacks
<dsmith-work>rekado_: Very cute!
<dsmith-work>rekado_: I like the sendfile
<dsmith-work>rekado_: Does that need to be on a PAGE_SIZE boundary?
<rekado_>dsmith-work: I don’t know. I didn’t use my brain much when I wrote this. My terminal merely told me that it worked. ¯\_(ツ)_/¯
<dsmith-work>What's ORIGINAL_SIZE ? Passed in via gcc -D ?
<rekado_>yes
<rekado_>there’s a comment after the license header that shows how I used it
<rekado_>I found it simpler to pass in the original size of the wrapped binary than to parse the ELF file to find the offset
<dsmith-work>I see now. That color theme grays out comments, so I didn't really notice it.
<drakonis> https://www.nongnu.org/grip/
<drakonis>neat
<nmeum>hi, is a wrapper for the glob(3) function available in guile somewhere?
<rekado_>drakonis: https://elephly.net/paste/1658437003.sh.html
<drakonis>oh, nice.
<rekado_>this uses tail and tar at runtime; guix is needed at pack time
<drakonis>that's fine.
<drakonis>the resulting tar shouldn't be that large, yeah?
<rekado_>my (display "hello") is a whopping 138M…
<drakonis>it seems like a good way to move execution to runtime
<drakonis>wooow
<drakonis>okay.
<drakonis>that's terrible.
<rekado_>it’s because the closure of the guile package is huge.
<rekado_>and it’s not compressed
<rekado_>compressed it would be something like 38M
<rekado_>I didn’t compress because tar can’t append to a compressed archive.
<rekado_>(I’m appending the compiled app binaries to the output of “guix pack guile”)
<drakonis>i see.
<rekado_>it would probably work to compress and just concatenate the archives
<rekado_>just use a slightly more complicated process to extract the two archives
<drakonis>its not ideal, provided i wanted to compile a guile binary and rsync it into another machine
<drakonis>its integral to my scripting plan
<drakonis>guess i should learn more about guile's internals and attempt to output binaries
<rekado_>concatenation works, too.
<rekado_>still, it’s not great that this is an archive that needs unpacking. Slows startup down and you need more space.
<drakonis>aye.
<drakonis>i'm inclined towards compiling binaries and/or image loading
<drakonis>one for standalone/native execution and the other for loading large amounts of code into a running session
<rekado_>here’s the compressed version: https://elephly.net/paste/1658438468.sh.html