I built gcc 9.1.0 on Solaris 11 (SPARC) from sources (GNU). The build went well and CGO free Go code can be compiled and works.
With CGO code the gccgo build does not compile. go code referencing any C standard type like C.int returns an error:
sh> go build ./...
./main.go:18:2: call of non-function C.f
./main.go:18:6: invalid conversion to C.int: undefined C type 'int'
Here is the simple example code which does not build.
package main
/*
#include <stdio.h>
void f(int i) {
fprintf(stdout,"INT: %d
",i);
}
*/
import "C"
import (
"fmt"
)
func main() {
// Simple C function call.
C.f(C.int(1))
fmt.Println("ABC")
}
On other platforms the C type is referenced correctly. Does I have missed an compiler flag during gcc compile?
configure
of gcc is called using:
../configure --prefix=<path>/gcc-solaris-9.1.0 --enable-languages=c,c++,go,objc,lto
Does anyone has a hint how to build gccgo on Solaris SPARC correctly? Is there an header include file dependency missing, which is on Solaris needed?