notjack
2021-2-12 11:42:36

resyntax can migrate define-struct forms to struct forms pretty effectively now! https://github.com/racket/scribble/pull/295


laurent.orseau
2021-2-12 13:06:14

You should create a macro that avoids all these #:extra-constructor-names :yum:


laurent.orseau
2021-2-12 20:05:01

Is there a way to embed the relevant linux libraries within a stand alone executable built with raco exe --orig-exe?


laurent.orseau
2021-2-12 20:06:09

I found this by @ryanc https://github.com/racket/racket/issues/3306 but I’m not sure how much is related, although the linked SO post seems to be about the same issue


me1890
2021-2-12 20:09:51

I’m pretty sure that you can.


me1890
2021-2-12 20:10:05

I remember experimenting with this a bit in the past while trying to make portable linux binaries


laurent.orseau
2021-2-12 20:19:58

Cool, that would be great. If you happen to remember any details at all, that could be useful :slightly_smiling_face:


laurent.orseau
2021-2-12 20:37:34

Oh, and I meant to also embed libs like libc


me1890
2021-2-12 20:38:12

okay, yeah i figured


me1890
2021-2-12 20:38:37

i don’t remember if i got raco exe to staticly link anything, but i don’t think it should be too hard


laurent.orseau
2021-2-12 21:07:45

I used define-runtime-path and the libs do seem to get embedded (the binary’s size increases), but it looks like the executable does not look for them there, so I’m probably missing some steps


laurent.orseau
2021-2-12 21:09:47

I didn’t copy/link them first in local directory though


laurent.orseau
2021-2-12 21:10:45

At the same time, I don’t know how to tell the executable to use a local version of libc


laurent.orseau
2021-2-12 21:23:38

So… I created a lib subdirectory and symlinked there all the relevant libs (libc, libpthread, etc.). In the code, I have (define-runtime-path libc.so.6 "lib/libc.so.6") ... Then I did: (export LD_LIBRARY_PATH="lib"; raco exe --orig-exe myprog.rkt) but ldd myprog still reports global paths like: libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f26ebc0c000)


mflatt
2021-2-12 22:04:19

Shared objects will not get embedded by raco exe. Using define-runtime-path makes them included in a distribution created by raco dist at a path relative to the executable. So, they get bundled with the executable in that sense, but not embedded in a single file.

There’s no way to relink shared objects into a single executable, if that’s really what you had in mind. You’d have to link static libraries to create a new executable, which is outside of anything raco exe tries to do.


jjsimpso
2021-2-12 22:06:06

Just curious, but what does the ’++lib" option to ‘raco exe’ do?


mflatt
2021-2-12 22:07:55

That refers to a Racket library, not a shared object or OS library.


laurent.orseau
2021-2-12 22:08:43

Ok, gotcha, I’ll try to find another way then. Thanks


jjsimpso
2021-2-12 22:10:26

Ok, that is what I expected but wasn’t entirely sure.


raoul.schorer
2021-2-12 22:56:51

Hi, in my custom #lang I’d like to read numbers according to the same rules as racket, i.e. "3+4i" is read as a complex number without having to redefine lexing/parsing for it in my language. Is there an easy way to do that, please?


joel
2021-2-12 23:28:48

If you peek ahead in the port and see the next character is a number or a # you can just do (read port) to get the next datum out


joel
2021-2-12 23:31:42

(assuming numbers and hash marks don’t have any other special significance in your #lang. You can ignore the # part if you don’t need to parse some of the fancy special cases the Racket reader can handle: https://docs.racket-lang.org/reference/reader.html#%28part._parse-number%29)


raoul.schorer
2021-2-12 23:33:30

Ah yes, I should have thought of that. This should work perfectly, thanks! :+1:


joel
2021-2-12 23:36:05

:smiley: