Skip to content

Fail to build - relocation R_X86_64_32 against `main.initdone·' can not be used when making a shared object; recompile with -fPIC #120

Closed
@zaibon

Description

@zaibon

When tying to compile a project that imports this package I get this error :

LC_ALL=EN go install -x .
WORK=/tmp/go-build323209142
mkdir -p $WORK/github.com/Zaibon/yarnouch/_obj/
mkdir -p $WORK/github.com/Zaibon/yarnouch/_obj/exe/
cd /home/zaibon/dev/go/src/github.com/Zaibon/yarnouch
/usr/lib/go/pkg/tool/linux_amd64/6g -o $WORK/github.com/Zaibon/yarnouch/_obj/_go_.6 -p github.com/Zaibon/yarnouch -complete -D _/home/zaibon/dev/go/src/github.com/Zaibon/yarnouch -I $WORK -I /home/zaibon/dev/go/pkg/linux_amd64 ./yarnouch.go
/usr/lib/go/pkg/tool/linux_amd64/pack grcP $WORK $WORK/github.com/Zaibon/yarnouch.a $WORK/github.com/Zaibon/yarnouch/_obj/_go_.6
cd .
/usr/lib/go/pkg/tool/linux_amd64/6l -o $WORK/github.com/Zaibon/yarnouch/_obj/exe/a.out -L $WORK -L /home/zaibon/dev/go/pkg/linux_amd64 $WORK/github.com/Zaibon/yarnouch.a
# github.com/Zaibon/yarnouch
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/go-link-dWUrCZ/go.o: relocation R_X86_64_32 against `main.initdone·' can not be used when making a shared object; recompile with -fPIC
/var/tmp/go-link-dWUrCZ/go.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
/usr/lib/go/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100
go version
go version go1.2 linux/amd64
gcc --version
gcc (Gentoo Hardened 4.7.3-r1 p1.4, pie-0.5.5) 4.7.3
Copyright (C) 2012 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.

I tried to passed the argument '-fPIC' with -ldflags but it doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions