| 10 Jul 2025 |
Curid | patchelf --set-interpreter "/lib64/ld-linux-x86-64.so.2" file | 19:17:21 |
jrick | there's that hack, but also there's a variable you can set in the go tooling | 19:17:38 |
jrick | don't remember it exactly off top of my head, just that it exists | 19:17:52 |
jrick | go tool link -extld <path> | 19:19:02 |
jrick | so, set that with ldflags | 19:19:11 |
Diamond (it/she) | CGO_ENABLED=0 definitely will work | 20:47:58 |
Diamond (it/she) | if your binary still has PIE then you have to fix your environment | 20:48:03 |
Diamond (it/she) | oh this is Nix, perfect! CGO_ENABLED=0 will work | 20:48:39 |
Diamond (it/she) | i've done it before | 20:48:41 |
jrick | pie without cgo doesn't really work. static pie is a thing, but go doesn't produce those | 20:50:31 |
jrick | well it can, but i haven't tried to cross compile them | 20:50:58 |
jrick | err, i have tried, and failed lol | 20:51:54 |
kdn | yeah, CGO_ENABLED=0 go build works fine on NixOS | 20:52:15 |
Diamond (it/she) | yeah for the explicit purpose of cross-building i wouldn't bother with PIE | 20:55:57 |
Diamond (it/she) | or i guess just build a Nix OCI container instead | 20:56:14 |
jrick | the issue with building static pie executables is that you need the target platform's ld.so and essentially embed it into the final binary | 20:57:05 |
jrick | it works if you have the file and can set the appropriate go flags to link with it | 20:57:45 |
jrick | but makes cross compiling a nightmare | 20:57:49 |
kdn | I'd love to, but the team uses goreleaser to build for few-teen targets including different architectures, containers & operating systems | 20:58:28 |
Diamond (it/she) | hm ic | 21:00:36 |
kdn | I just wanted to adjust my local build to whatever they're running so I can make a proper entrypoint | 21:01:08 |
Diamond (it/she) | i mean in terms of building containers for usage, whether it's Nix-built or FROM alpine Dockerfile-built doesn't matter too much | 21:02:58 |
Diamond (it/she) | i mean the whole point of OCI containers is that it has that level of portability | 21:03:06 |
Diamond (it/she) | i was gonna say if this tool is just dragged into the container as a build step then you can definitely have it build an image and use that in Dockerfile i think? | 21:03:40 |
Diamond (it/she) | but idrk what you're doing | 21:03:47 |
kdn | I've no clue either how the whole thing is set up, my guess is that the binary artifact is somewhat carried over from previous steps in the CI/GoReleaser | 21:05:55 |
| 11 Jul 2025 |
| @aerunakai:matrix.org removed their profile picture. | 16:40:26 |
| @aerunakai:matrix.org removed their display name aerunakai. | 16:40:31 |
| @aerunakai:matrix.org left the room. | 16:40:39 |
| elitewhale75 joined the room. | 17:39:15 |