Skip to content

gccgo: cgo not working on Solaris 10 #27838

@amandeepgautam

Description

@amandeepgautam

What version of Go are you using (go version)?

go version go1.10.3 gccgo (GCC) 8.2.1 20180813 solaris/sparc

Does this issue reproduce with the latest release?

Yes. Compiled from source

What operating system and processor architecture are you using (go env)?

GOARCH="sparc"
GOBIN=""
GOCACHE="/export/home/amandeep/.cache/go-build"
GOEXE=""
GOHOSTARCH="sparc"
GOHOSTOS="solaris"
GOOS="solaris"
GOPATH="/opt/go_pkgs"
GORACE=""
GOROOT="/usr/gnu"
GOTMPDIR=""
GOTOOLDIR="/usr/gnu/libexec/gcc/sparc-sun-solaris2.10/8.2.1"
GCCGO="/usr/gnu/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build699772262=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

Tried to compile a simple program:

package main                                                                   
 
/*                                                                             
#include <stdio.h>                                                             

void testc() {                                                                 
    printf("Hello cgo");
}                                                                              
*/                                                                             
import "C"                                                                     
                                                                               
func main() {                                                                  
    C.testc()                                                                  
}                                                                              

What did you see instead?

Compilation fails with:
./abc.go:13:5: call of non-function C.testc

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Solaris

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions