Reflections on using Go instead of D
Adam D Ruppe
destructionator at gmail.com
Tue Jul 12 12:42:50 UTC 2022
On Tuesday, 12 July 2022 at 02:42:00 UTC, jfondren wrote:
> 2. I'd like the program to be a completely static binary.
This generally isn't worth the effort. Just using the oldest
glibc you want to support and dynamic loading openssl will
generally achieve the same task - newer glibcs tend to work with
programs built against older ones, but not vice versa. So
building something on a new distro makes it look really
incompatible, but building on an old one works fine.
I've also never actually seen a Go program be a static build...
> Take static binaries: they're the default in Go,
idk maybe it is just my system but this is an out-of-the-box go
install with all the default settings:
me at arsd:~/test$ go build hello.go
me at arsd:~/test$ ./hello
hello world from go
me at arsd:~/test$ ldd ./hello
linux-vdso.so.1 (0x00007ffe1fff6000)
libgo.so.14 => /usr/lib64/libgo.so.14 (0x00007fdee7566000)
libm.so.6 => /lib64/libm.so.6 (0x00007fdee7419000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1
(0x00007fdee73ff000)
libc.so.6 => /lib64/libc.so.6 (0x00007fdee721a000)
/lib64/ld-linux-x86-64.so.2 (0x00007fdee8cb5000)
libpthread.so.0 => /lib64/libpthread.so.0
(0x00007fdee71f8000)
That's nearly identical to D:
me at arsd:~/test$ dmd hellobasic.d
me at arsd:~/test$ ldd hellobasic
linux-vdso.so.1 (0x00007fff4bdd0000)
libpthread.so.0 => /lib64/libpthread.so.0
(0x00007f52dcb50000)
libm.so.6 => /lib64/libm.so.6 (0x00007f52dca03000)
librt.so.1 => /lib64/librt.so.1 (0x00007f52dc9f9000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f52dc9f4000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1
(0x00007f52dc9da000)
libc.so.6 => /lib64/libc.so.6 (0x00007f52dc7f5000)
/lib64/ld-linux-x86-64.so.2 (0x00007f52dcbce000)
Can you do that test on your computer? Maybe it is just a config
thing in my setup.
> 3. arsd-official:http can work with system libssl, with a
> caveat about 32-bit windows
Oh that's actually an obsolete note, I should remove that. I
fixed it last year so it just works now.
BTW one of the problems with ssl is you also need the
certificates... it is unlikely to work correctly with a
self-contained static build anyway. I wonder just how Go does
it...
More information about the Digitalmars-d
mailing list