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: TestFFLAGS fails #19080

Closed
alexbrainman opened this issue Feb 14, 2017 · 5 comments
Closed

cmd/go: TestFFLAGS fails #19080

alexbrainman opened this issue Feb 14, 2017 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@alexbrainman
Copy link
Member

What version of Go are you using (go version)?

go version devel +e7ec06e Fri Feb 10 21:38:07 2017 +0000 linux/386

What operating system and processor architecture are you using (go env)?

GOARCH="386"
GOBIN=""
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root"
GORACE=""
GOROOT="/root/go"
GOTOOLDIR="/root/go/pkg/tool/linux_386"
GCCGO="gccgo"
GO386=""
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build737276700=/tmp/go-build"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

cd $GOROOT/src/cmd/go
go test -v -run=FFLAGS

What did you expect to see?

Test PASS.

What did you see instead?

=== RUN   TestFFLAGS
--- FAIL: TestFFLAGS (0.29s)
	go_test.go:260: running testgo [build -x p]
	go_test.go:279: standard error:
	go_test.go:280: WORK=/tmp/go-build798066230
		mkdir -p $WORK/p/_obj/
		mkdir -p $WORK/p/_obj/exe/
		cd /tmp/gotest682813338/p/src/p
		CGO_LDFLAGS="-g" "-O2" "-lgfortran" /root/go/pkg/tool/linux_386/cgo -objdir $WORK/p/_obj/ -importpath p -- -I $WORK/p/_obj/ -g -O2 main.go
		cd $WORK
		gcc -fdebug-prefix-map=a=b -c trivial.c
		gcc -gno-record-gcc-switches -c trivial.c
		cd /tmp/gotest682813338/p/src/p
		gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/p/_obj/ -g -O2 -o $WORK/p/_obj/_cgo_export.o -c $WORK/p/_obj/_cgo_export.c
		gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/p/_obj/ -g -O2 -o $WORK/p/_obj/main.cgo2.o -c $WORK/p/_obj/main.cgo2.c
		gfortran -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/p/_obj/ -g -O2 -no-such-fortran-flag -o $WORK/p/_obj/a.f.o -c ./a.f
		# p
		gfortran: unrecognized option '-no-such-fortran-flag'
		gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/p/_obj/ -g -O2 -o $WORK/p/_obj/_cgo_main.o -c $WORK/p/_obj/_cgo_main.c
		gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -o $WORK/p/_obj/_cgo_.o $WORK/p/_obj/_cgo_main.o $WORK/p/_obj/_cgo_export.o $WORK/p/_obj/main.cgo2.o $WORK/p/_obj/a.f.o -g -O2 -lgfortran
		/root/go/pkg/tool/linux_386/cgo -dynpackage main -dynimport $WORK/p/_obj/_cgo_.o -dynout $WORK/p/_obj/_cgo_import.go
		cd $WORK
		gcc -no-pie -c trivial.c
		cd /tmp/gotest682813338/p/src/p
		gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -o $WORK/p/_obj/_all.o $WORK/p/_obj/_cgo_export.o $WORK/p/_obj/main.cgo2.o $WORK/p/_obj/a.f.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
		/root/go/pkg/tool/linux_386/compile -o $WORK/p.a -trimpath $WORK -p main -buildid ae9e4f7d070099097dac88e723e25f8ce46bd3bb -D _/tmp/gotest682813338/p/src/p -I $WORK -pack $WORK/p/_obj/_cgo_gotypes.go $WORK/p/_obj/main.cgo1.go $WORK/p/_obj/_cgo_import.go
		pack r $WORK/p.a $WORK/p/_obj/_all.o # internal
		cd .
		/root/go/pkg/tool/linux_386/link -o $WORK/p/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=ae9e4f7d070099097dac88e723e25f8ce46bd3bb $WORK/p.a
		mv $WORK/p/_obj/exe/a.out p
		
	go_test.go:297: testgo succeeded unexpectedly
FAIL
exit status 1
FAIL	cmd/go	2.785s

Perhaps unrelated, but I can also see file named "p" created in $GOROOT/src/cmd/go after command above completes.

Alex

@ianlancetaylor ianlancetaylor changed the title cmd/go: TestFFLAGS failes cmd/go: TestFFLAGS fails Feb 15, 2017
@ianlancetaylor
Copy link
Contributor

That's odd, it looks like the gfortran command succeeded even though we gave it an unknown option. I see gfortran: unrecognized option '-no-such-fortran-flag' but apparently it exited successfully anyhow.

@alexbrainman
Copy link
Member Author

the gfortran command succeeded even though we gave it an unknown option

It does indeed:

# cat main.go
package main

// #cgo FFLAGS: -no-such-fortran-flag
import "C"

func main() {
}
# cat a.f
! comment
# go build -x -work
WORK=/tmp/go-build963077227
mkdir -p $WORK/t/_obj/
mkdir -p $WORK/t/_obj/exe/
cd /root/src/t
CGO_LDFLAGS="-g" "-O2" "-lgfortran" /root/go/pkg/tool/linux_386/cgo -objdir $WORK/t/_obj/ -importpath t -- -I $WORK/t/_obj/ -g -O2 main.go
cd $WORK
gcc -fdebug-prefix-map=a=b -c trivial.c
gcc -gno-record-gcc-switches -c trivial.c
cd /root/src/t
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/t/_obj/ -g -O2 -o $WORK/t/_obj/_cgo_export.o -c $WORK/t/_obj/_cgo_export.c
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/t/_obj/ -g -O2 -o $WORK/t/_obj/main.cgo2.o -c $WORK/t/_obj/main.cgo2.c
gfortran -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/t/_obj/ -g -O2 -no-such-fortran-flag -o $WORK/t/_obj/a.f.o -c ./a.f
# t
gfortran: unrecognized option '-no-such-fortran-flag'
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/t/_obj/ -g -O2 -o $WORK/t/_obj/_cgo_main.o -c $WORK/t/_obj/_cgo_main.c
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -o $WORK/t/_obj/_cgo_.o $WORK/t/_obj/_cgo_main.o $WORK/t/_obj/_cgo_export.o $WORK/t/_obj/main.cgo2.o $WORK/t/_obj/a.f.o -g -O2 -lgfortran
/root/go/pkg/tool/linux_386/cgo -dynpackage main -dynimport $WORK/t/_obj/_cgo_.o -dynout $WORK/t/_obj/_cgo_import.go
cd $WORK
gcc -no-pie -c trivial.c
cd /root/src/t
gcc -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -o $WORK/t/_obj/_all.o $WORK/t/_obj/_cgo_export.o $WORK/t/_obj/main.cgo2.o $WORK/t/_obj/a.f.o -g -O2 -Wl,-r -nostdlib -Wl,--build-id=none
/root/go/pkg/tool/linux_386/compile -o $WORK/t.a -trimpath $WORK -p main -buildid ab7a8a8d4580e098c2303f813fc08f47e4a7d7f5 -D _/root/src/t -I $WORK -pack $WORK/t/_obj/_cgo_gotypes.go $WORK/t/_obj/main.cgo1.go $WORK/t/_obj/_cgo_import.go
pack r $WORK/t.a $WORK/t/_obj/_all.o # internal
cd .
/root/go/pkg/tool/linux_386/link -o $WORK/t/_obj/exe/a.out -L $WORK -extld=gcc -buildmode=exe -buildid=ab7a8a8d4580e098c2303f813fc08f47e4a7d7f5 $WORK/t.a
mv $WORK/t/_obj/exe/a.out t
# export WORK=/tmp/go-build963077227
# gfortran -I . -fPIC -m32 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -I $WORK/t/_obj/ -g -O2 -no-such-fortran-flag -o $WORK/t/_obj/a.f.o -c ./a.f; echo $?
gfortran: unrecognized option '-no-such-fortran-flag'
0
#

Alex

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 1, 2017
@ALTree ALTree added this to the Go1.9 milestone Mar 1, 2017
@ALTree
Copy link
Member

ALTree commented Mar 1, 2017

Probably related to the gcc version on the machine? I can reproduce the failure with an old compiler:

$ gfortran --version
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

While the test succeeds when using, for example,

$ gfortran --version
GNU Fortran (GCC) 5.4.0

Next step (if this is really only an issue for very old gfortran versions) is to decide if we actually care about supporting gcc 4.something, or not.

@ALTree ALTree added the Testing An issue that has been verified to require only test changes, not just a test failure. label Mar 1, 2017
@alexbrainman
Copy link
Member Author

Probably related to the gcc version on the machine?

# gfortran --version
GNU Fortran (Gentoo 4.5.3-r2 p1.5, pie-0.4.7) 4.5.3

Alex

@gopherbot
Copy link

CL https://golang.org/cl/37658 mentions this issue.

@golang golang locked and limited conversation to collaborators Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

4 participants