On Fri, Sep 28, 2018 at 5:33 PM,  <amand...@cohesity.com> wrote:
> Hi Ian,
>    Setting GCCGO env variable helped. I basically compiled, helloworld.go
> with the following options and it compiled a 64 bit exectable:
>
> CC=/home/amandeep/workspace/mygcc.sh
> GCCGO=/home/amandeep/workspace/mygccgo.sh CGO_CFLAGS='-m64'
> CGO_LDFLAGS='-m64' GOARCH=sparc64 CGO_ENABLED=1 go build -gccgoflags=-m64
> helloworld.go
>
> amandeep@s113ldom1:~/workspace$ file helloworld
> helloworld:           ELF 64-bit MSB executable SPARCV9 Version 1,
> dynamically linked, not stripped
>
> However, I still can't run the executable:
> amandeep@s113ldom1:~/workspace$ ./helloworld
> ld.so.1: helloworld: fatal: /usr/gnu/lib/libgo.so.13: wrong ELF class:
> ELFCLASS32
> Killed
>
> Does it mean that I need to compile gcc from source again with 64-bit hack
> i.e. by running gcc configure with CC=/path/to/mygcc and recompile it?

You'll need to set LD_LIBRARY_PATH to point to the directory with your
64-bit libgo.so.


> When I said "a 32 bit archive" I meant the .a on which output of file
> command looks like the following:
> amandeep@s113ldom1:~/workspace$ file
> /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a
> /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a:
> current ar archive, 32-bit symbol table
>
> I assumed that the error wrong ELF class: ELFCLASS32 was related to the
> archive created with incorrect compiler options.

Pedantically speaking, this is about the objects in the archive, not
the archive itself.

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to