5 ms·
It makes cross-compiling a lot more difficult. Instead of being able to build on whatever OS/architecture you use and produce binaries for any other OS/architec
by danenania 2y ago
It makes cross-compiling a lot more difficult. Instead of being able to build on whatever OS/architecture you use and produce binaries for any other OS/architecture you want to target with a single command (one of Go's superpowers), you need a complex build pipeline.
- wild_egg 2y agoI've been using zig's toolchain in CGo projects for a couple years now and cross compilation _just works_. Maybe there are libraries it doesn't handle well but so far all of my use cases have been covered perfectly.
- AYBABTME 2y agoExample? Curious, can Zig can be used to simplify CGO dependency management in general, or only for Zig programs?
- wffurr 2y agoZig is a C compiler. Much like D, you can use it to cross compile any C code.
- rockorager 2y agoIt could definitely work for that. You have to think of zig in this context as a build system which can download and compile C/C++ codebases.
- kristoff_it 2y agohttps://zig.news/kristoff/building-sqlite-with-cgo-for-every-os-4cic https://zig.news/kristoff/building-sqlite-with-cgo-for-every...
- karel-3d 2y agoI have personally hit some roadblock before that I cannot really remember anymore, so I just gave up and used debian docker image. (Which needed to be old enough that it had old glibc, so someone with 10 year old OS doesn't complain. Linux.) zig gets around that by using musl, right? or does it use old libc?
- karel-3d 2y agoNote that modernc/cznic stuff is not really actual go but C trans-compiled to Go, the trans-compiler having specific quirks for every platform,. So it's not technically possible to compile to all platforms that Go runs on, only the platforms that the trans-compiler supports. And the resulting Go code is not that readable. https://gitlab.com/cznic/libtcl9.0/-/blob/master/libtcl9_0_linux_ppc64le.go?ref_type=heads https://gitlab.com/cznic/libtcl9.0/-/blob/master/libtcl9_0_l... https://pkg.go.dev/modernc.org/ccgo/v3 https://pkg.go.dev/modernc.org/ccgo/v3 But it still improves cross-compiling, and results in a libc independent static binary, which is nice. And the work done on the trans-compiling is great.