Hi Alex, I haven't worked with Go on Windows in a year, so my knowledge might be out of date... That said, I found CGO very sensitive to the exact C compiler used, and even within GCC, the exact version. Here is the version that I had working at one point in the last couple of years:
mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0 (somewhere on sourceforge I think). Mind you, I'm not saying you cannot get Clang to work. I'm just suggesting that if you start with a positive control (that does let you build), then you can confidently try other compilers knowing that everything else is held the same. Or you might have gotten what you need with the mingw-w64 gcc, and that's good enough. Let me know if you are able to make Clang work--it would be an interesting data point. Best, Jason On Sunday, August 31, 2025 at 12:56:13 PM UTC+1 Alex wrote: > I am using the go compiler, this is about using cgo together with the go > compiler. > And this was with the 1.24 and 1.25 toolchains > > On Sunday, 31 August 2025 at 7:51:08 pm UTC+8 Michael Oguidan wrote: > >> Hi Alex, which version of Go are you using, and why don't use the actual >> Go compiler which is written in Go. >> >> On Sunday, August 31, 2025 at 8:15:39 AM UTC Alex wrote: >> >>> Been trying to use go with clang21 on windows but compiling any cgo app >>> results in "cannot parse *.o as ELF, Mach-O, PE or XCOFF" >>> >>> Tried with go1.24.* and 1.25, using clang20 works as expected. >> >> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/062912c8-754f-42d5-9c62-fe7dd9e0d142n%40googlegroups.com.