Compilation of libwebp fails due to syntax errors in the generated go code.
This stems from the slack investigation that starts here.
Here are steps to reproduce this problem (on Arch Linux, though I suspect they'll work on any UNIX-like):
git clone --depth=1 https://github.com/webmproject/libwebp
cd libwebp
./autogen.sh
./configure --disable-libwebpmux --disable-libwebpdemux --disable-sse4.1 --disable-sse2 --disable-neon --disable-neon-rtcd --disable-threading --disable-gl --disable-sdl --disable-png --disable-jpeg --disable-tiff --disable-gif --disable-wic --disable-shared
ccgo -compiledb cdb.json make
go mod init libwebp
go get modernc.org/libc
CC=$(which gcc) ccgo -trace-translation-units cdb.json src/.libs/libwebp.a
The compilation fails with syntax errors in the Go file:
a_linux_amd64.go:20664:52: expected operand, found ')'
a_linux_amd64.go:20665:5: expected ')', found 'for'
a_linux_amd64.go:20672:3: missing ',' in argument list
a_linux_amd64.go:20673:1: expected operand, found '}'
a_linux_amd64.go:20678:1: missing ',' in argument list
a_linux_amd64.go:20679:3: missing ',' in argument list
a_linux_amd64.go:20700:71: missing ',' in argument list
a_linux_amd64.go:20708:1: expected ')', found 'defer'
a_linux_amd64.go:20710:3: missing ',' in argument list
a_linux_amd64.go:20711:3: missing ',' in argument list
a_linux_amd64.go:20713:3: missing ',' in argument list
: exit status 2
I have attached the compressed a_linux_amd64.go so that these errors can be explored more easily.