[go-nuts] call of non-function C.testc

2018-09-13 Thread amandeep
Trying to compile the following on Solaris 10 gives the error: call of non-function C.testc package main /* #include void testc() { printf("Hello cgo"); } */ import "C" func main() { C.testc() } The output of go env is below: bash-4.3$ go env GOARCH="sparc" GOBIN="" GOCACHE="/expor

Re: [go-nuts] call of non-function C.testc

2018-09-13 Thread Ian Lance Taylor
On Thu, Sep 13, 2018 at 7:16 PM, wrote: > > Trying to compile the following on Solaris 10 gives the error: call of > non-function C.testc > > package main > > /* > #include > > void testc() { > printf("Hello cgo"); > } > */ > import "C" > > func main() { > C.testc() > } > > The output of

Re: [go-nuts] call of non-function C.testc

2018-09-14 Thread amandeep
oh yes, I am using gccgo. I configured gccgo from source. Below is the go version output: *go version go1.10.3 gccgo (GCC) 8.2.1 20180814 solaris/sparc * Following is the output of what is -bash-3.2$ go build -x sol10.go

Re: [go-nuts] call of non-function C.testc

2018-09-14 Thread Ian Lance Taylor
On Fri, Sep 14, 2018 at 1:40 AM, wrote: > > oh yes, I am using gccgo. I configured gccgo from source. Below is the go > version output: > go version go1.10.3 gccgo (GCC) 8.2.1 20180814 solaris/sparc What version of GCC are you using? What is the output of `gcc --version`? Ian -- You received

Re: [go-nuts] call of non-function C.testc

2018-09-14 Thread amandeep
It would be the same. Please see below. -bash-3.2$ gcc --version gcc (GCC) 8.2.1 20180814 Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. On Fr

Re: [go-nuts] call of non-function C.testc

2018-09-14 Thread Ian Lance Taylor
On Fri, Sep 14, 2018 at 2:16 PM, wrote: > It would be the same. Please see below. > > -bash-3.2$ gcc --version > gcc (GCC) 8.2.1 20180814 > Copyright (C) 2018 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCH

Re: [go-nuts] call of non-function C.testc

2018-09-14 Thread amandeep
Hi Ian, I did you told, but I could not find --debug=all option for readelf. However, there is --debug --all option with readelf. I am attaching the output below: -bash-3.2$ /opt/csw/bin/greadelf --debug --all /b001/_cgo_.o ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 0

Re: [go-nuts] call of non-function C.testc

2018-09-18 Thread Ian Lance Taylor
Thanks for sending this. Unfortunately, I have no idea what is going wrong. Everything that you sent looks as expected. At this point I don't have any suggestions. Ian On Fri, Sep 14, 2018 at 6:42 PM, wrote: > Hi Ian, >I did you told, but I could not find --debug=all option for readelf.

Re: [go-nuts] call of non-function C.testc

2018-09-18 Thread amandeep
Well, that is bad news. I am not sure what to do next either. I am setting up another Solaris 10 machine from scratch and then re-run this to see if this can be replicated. Will get back to you if I am able to replicate. Should I file a big for this? On Tuesday, September 18, 2018 at 7:45:06 AM

Re: [go-nuts] call of non-function C.testc

2018-09-18 Thread Ian Lance Taylor
On Tue, Sep 18, 2018 at 6:30 PM, wrote: > > Well, that is bad news. I am not sure what to do next either. I am setting > up another Solaris 10 machine from scratch and then re-run this to see if > this can be replicated. Will get back to you if I am able to replicate. > Should I file a big for th

Re: [go-nuts] call of non-function C.testc

2018-09-24 Thread amandeep
Hi Ian, I configured everything from scratch again and it seems that this is reproducible. I also noticed that while running: CGO_LDFLAGS='"-g" "-O2"' /usr/gnu/libexec/gcc/sparc-sun-solaris2.10/8.2.1/cgo -debug-gcc -objdir $WORK/b001/ -importpath command-line-arguments -gccgo -- -I $WORK/b001

Re: [go-nuts] call of non-function C.testc

2018-09-24 Thread Ian Lance Taylor
On Mon, Sep 24, 2018 at 7:21 PM, wrote: > >I configured everything from scratch again and it seems that this is > reproducible. I also noticed that while running: > CGO_LDFLAGS='"-g" "-O2"' > /usr/gnu/libexec/gcc/sparc-sun-solaris2.10/8.2.1/cgo -debug-gcc -objdir > $WORK/b001/ -importpath com

Re: [go-nuts] call of non-function C.testc

2018-09-24 Thread amandeep
Hello Ian, Since you mention about 32-bit SPARC, I did a little testing. It seems that gccgo is compiling 32-bit binary by default: -bash-4.3$ go build abcd.go -bash-4.3$ file abcd abcd: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped