"unexpected move R_X86_64_64 for dynamic character" when using Cgo

I am trying to create a binding for a C library using Cgo. I have a package that uses Cgo to import a library and make some calls. It compiles and installs perfectly. But when I try to use this package from the Go program, I get the error message "Unexpected move R_X86_64_64 for dynamic character" when linking.

Any ideas?

+3
source share
3 answers

It appears in the assembly generation in the compiler 6g:

case 256 + R_X86_64_64:
        if(targ->dynimpname != nil && !targ->dynexport)
                diag("unexpected R_X86_64_64 relocation for dynamic symbol %s",
                     targ->name);
        r->type = D_ADDR;
        return;

R_X86_64_64 - . amd64 ~ 70 .

, 386 amd64?

, . , , , ?

cgo ?

+1

Elazar , , 32- 64- .

gccgo?

0

:

root@Ubuntu-1304-raring-64-minimal:/etc# uname -a
Linux Ubuntu-1304-raring-64-minimal 3.8.13.4 #2 SMP Mon Jul 8 23:59:05 CEST 2013 x86_64 x86_64 x86_64 GNU/Linux

:

cd /usr/local
mkdir /var/go
apt-get install mercurial
hg clone https://code.google.com/p/go/

/etc/profile.d/go.sh follewing :

export GOPATH=/var/go
export GOROOT=/usr/local/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
export GOROOT_FINAL=/var/go
export GOHOSTARCH=amd64
export GOARCH=amd64
export CGO_ENABLED=1

. NO source xxx - ! :

cd /usr/local/go/src
./make.bash

do this and then copy all things from / usr / local / go to / var / go - or is there a way to combine both directories with symlink, no matter what you prefer. After this comment GOROOT_FINAL in the go.sh script above And restart your shell again. And you're fine with Go's latest working language!

root@Ubuntu-1304-raring-64-minimal:/usr/work/golang/go/src# go version
go version devel +35d5bae6aac8 Fri Oct 18 10:45:19 2013 +0400 linux/amd64

Note bene: Two shell reloads are required - this was difficult.

0
source

All Articles