Hello everyone,
I am new to racket and had a couple of questions about distributing programs in general and if it was really possible to distribute a "single" executable. So far I also had problems with raco distribute (which does not produce a single executable, i know). So I would say that we have two separate issues.
I compiled one as it is stated in the docs, with raco exe --gui (from my linux machine)
but then on another linux machine i got this error:
./cat_animation: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_ABI_DT_RELR' not found (required by ./cat_animation)
I am really not able to compile something on a machine and having it run on another machine with racket... am i missing something?
Can somebody help me debug this and understand?
Hi,
as far as i understand you want to make a standalone executable with Racket , which normally should be possible, but i haven't made one since many years, so i can not help a lot about that.
About your error, it seems that you made the standalone executable on a development host and ran it on another but on the other host it seems some library or version or library are missing or different from the development host (where possibly the executable has been linked dynamically) . As far as i remember it seems there was an option to create a standalone executable that embed all the needed libraries...
check on your development host in Racket->executable there is 2 options : stand-alone and distribution :
use 'distribution' option
check on your target host if the symbol GLIBC_ABI_DT_RELR is existing, for example on my old linux box:
readelf -sW /lib/x86_64-linux-gnu/libc.so.6 | grep GLIBC_ABI_DT_RELR
not on this host... a problem of glibc version.Solution is to have 2 hosts with same versions.
1 Like
raco exe
creates an executable suitable for the running only on the machine it was created on. raco dist
creates an executable plus a directory structure with required dependencies. If the whole directory is copied to another machine, the executable will have everything it needs to run.
If I understand correctly, both exe and dist are behaving as they should for you. I'm not aware of a way to create a distributable executable that is a single binary file.
2 Likes
This sounds right to me—there might be a way to get a single
dynamically linked executable, but it would still require libraries +
runtime support (and I think raco exe is the closest thing to this
today). Using raco distribute is definitely the simplest way to get a
"bundle of stuff that can be used to run a program on another machine"
(as long as that other machine shares certain characteristics; see
raco cross if it doesn't).
1 Like
Ok it seems then that I just will have to run raco exe and raco distribute and have the whole directory. At the moment there is no way to get a single "fat" executable with everything embedded in it. That is also fine. Thank you a lot people!
Theoretically you can but that wouldn't be equivalent to how you compile C and link the objects into a binary. Racket depends on Chez, which compiles your code into bytecode. Think of Java, C# or SBCL, you can only distribute your bytecode + runtime.
ok and in practice, just for the sake of curiosity how would one do that?
I'm not sure this makes a lot of difference to this conversation, but Chez does not compile to bytecode; it does in fact compile to native code.
Following up on the comment by @jjsimpso, I think that the fundamental problem here is that even in C, you can't create an executable that runs on all machines; to take an obvious example (and I'm going to sound like a meany-pants here, I know) the Firefox binary for Windows and macOS are different. Well, okay, you say, but can I at least have a binary that works for (say) all Windows machines? In principle, yes; you could make a binary which jumps through a lot of hoops to self-install itself and/or download a bunch of extra pieces, and make things work. In practice, what I think you'll see across nearly all modern languages (JS, Python, Java, Racket, etc etc etc) is that you generally don't share binaries; you generally directly share source code or use a package manager to do the same thing, but more transparently.
Apologies if I've misunderstood you!