Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: C compiler flags not passed when building buildid.s #27929

Open
amandeepgautam opened this issue Sep 28, 2018 · 2 comments
Open

cmd/go: C compiler flags not passed when building buildid.s #27929

amandeepgautam opened this issue Sep 28, 2018 · 2 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@amandeepgautam
Copy link

Please answer these questions before submitting your issue. Thanks!

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="/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.11/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-build299260346=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

tried compiling a 64 bit lib with go install. In this particular example, trying to install glog

amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ sudo GOPATH=/opt/go_pkgs  CC='gcc -m64' CGO_CFLAGS='-m64' CGO_LDFLAGS='-m64' GOARCH=sparc64 CGO_ENABLED=1 go install -x -gccgoflags=-m64
WORK=/tmp/go-build365019570
mkdir -p $WORK/b001/
cd $WORK
/usr/gnu/bin/gccgo -fgo-importcfg=/dev/null -c -x c - || true
cd /opt/go_pkgs/src/github.com/golang/glog
/usr/gnu/bin/gccgo -c -g -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -fgo-pkgpath=github.com/golang/glog -o $WORK/b001/_go_.o -I $WORK/b001/_importcfgroot_ -m64 ./glog.go ./glog_file.go
echo '  .section .go.buildid,"e"' >> $WORK/b001/_buildid.s
echo '  .byte 0x79,0x71,0x58,0x37,0x74,0x64,0x76,0x6c' >> $WORK/b001/_buildid.s
echo '  .byte 0x7a,0x59,0x53,0x39,0x41,0x6a,0x30,0x58' >> $WORK/b001/_buildid.s
echo '  .byte 0x34,0x53,0x78,0x39,0x2f,0x79,0x71,0x58' >> $WORK/b001/_buildid.s
echo '  .byte 0x37,0x74,0x64,0x76,0x6c,0x7a,0x59,0x53' >> $WORK/b001/_buildid.s
echo '  .byte 0x39,0x41,0x6a,0x30,0x58,0x34,0x53,0x78' >> $WORK/b001/_buildid.s
echo '  .byte 0x39' >> $WORK/b001/_buildid.s
echo '' >> $WORK/b001/_buildid.s
/usr/gnu/bin/gccgo -xassembler-with-cpp -I $WORK/b001/ -c -o $WORK/b001/_buildid.o -D GOOS_solaris -D GOARCH_sparc64 -D GOPKGPATH=github_com_golang_glog $WORK/b001/_buildid.s
ar rcD $WORK/b001/_pkg_.a $WORK/b001/_go_.o $WORK/b001/_buildid.o
/usr/gnu/libexec/gcc/sparc-sun-solaris2.11/8.2.1/buildid -w $WORK/b001/_pkg_.a # internal
cp $WORK/b001/_pkg_.a /root/.cache/go-build/a4/a47820a6bcb6e72c26a3be36129e80b12a0f0193dd5959e2c7304a3b169d9af8-d # internal
mkdir -p /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/
cp $WORK/b001/_pkg_.a /opt/go_pkgs/pkg/gccgo_solaris_sparc64/github.com/golang/libglog.a
rm -r $WORK/b001/

More info on the mailing list about it: https://groups.google.com/forum/#!topic/golang-nuts/mRVt7Ge2iaM

What did you expect to see?

a 64-bit lib

What did you see instead?

a 32-bit lib

amandeep@s113ldom1:/opt/go_pkgs/src/github.com/golang/glog$ 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
@ianlancetaylor ianlancetaylor changed the title Not able to build 64 bit package solaris 11 cmd/go: C compiler flags not passed when building buildid.s Sep 28, 2018
@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 28, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Sep 28, 2018
@bcmills
Copy link
Contributor

bcmills commented Jan 17, 2019

Does this issue also affect the use of the gc compiler, or only gccgo?

@bcmills bcmills modified the milestones: Go1.12, Go1.13 Jan 17, 2019
@ianlancetaylor
Copy link
Contributor

This only affects gccgo.

@bcmills bcmills modified the milestones: Go1.13, Gccgo, Unplanned May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants