Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by danenania on Thursday November 28, 2024 @06:09PM
(#42269281)
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.
[ Parent
| on HN ]
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by wild_egg on Thursday November 28, 2024 @08:37PM
(#42270047)
I'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.
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by AYBABTME on Thursday November 28, 2024 @08:50PM
(#42270108)
Example? Curious, can Zig can be used to simplify CGO dependency management in general, or only for Zig programs?
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by rockorager on Thursday November 28, 2024 @10:39PM
(#42270590)
It 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.
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by wffurr on Thursday November 28, 2024 @09:17PM
(#42270230)
Zig is a C compiler. Much like D, you can use it to cross compile any C code.
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by kristoff_it on Friday November 29, 2024 @12:34AM
(#42271117)
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by karel-3d on Friday November 29, 2024 @04:01AM
(#42272324)
I 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?
Re:Tk9.0: CGo-free, cross platform GUI toolkit for Go
by karel-3d on Friday November 29, 2024 @03:57AM
(#42272304)
Note 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_l...
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.