We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Trying to pass FFLAGS to go compiler using cgo directive. It seems go is ignoring the flag. Here's a minimal example.
package main // #cgo FFLAGS: -wrong-flag import "C" import "fmt" func main() { fmt.Println("test") }
a.f90
! This is a comment line
Expected to see a compile error (since -wrong-flag is passed to the compiler).
Compiled successfully, -wrong-flag is not passed to the compiler.
gfortran -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/_/home/idavydov/tmp/cgo_flags/_obj/ -g -O2 -o $WORK/_/home/idavydov/tmp/cgo_flags/_obj/a.f90.o -c ./a.f90
Passing CGO_FFLAGS="-wrong-flag" produces the desirable effect; so FFLAGS is only ignored as a cgo directive.
gfortran -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I $WORK/_/home/idavydov/tmp/cgo_flags/_obj/ -wrong-flag -o $WORK/_/home/idavydov/tmp/cgo_flags/_obj/a.f90.o -c ./a.f90 gfortran: error: unrecognized command line option ‘-wrong-flag’
Yes.
go version go1.8rc3 linux/amd64 GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/idavydov/go" GORACE="" GOROOT="/usr/local/go" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="/usr/bin/gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build077223555=/tmp/go-build -gno-record-gcc-switches" 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" GOROOT/bin/go version: go version go1.8rc3 linux/amd64 GOROOT/bin/go tool compile -V: compile version go1.8rc3 X:framepointer uname -sr: Linux 4.4.0-21-generic Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial /lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Ubuntu GLIBC 2.23-0ubuntu5) stable release version 2.23, by Roland McGrath et al. gdb --version: GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
The text was updated successfully, but these errors were encountered:
CL https://golang.org/cl/36482 mentions this issue.
Sorry, something went wrong.
e7ec06e
No branches or pull requests
What did you do?
Trying to pass FFLAGS to go compiler using cgo directive. It seems go is ignoring the flag. Here's a minimal example.
test.go:
a.f90
go build -x -v .
What did you expect to see?
Expected to see a compile error (since -wrong-flag is passed to the compiler).
What did you see instead?
Compiled successfully, -wrong-flag is not passed to the compiler.
Passing CGO_FFLAGS="-wrong-flag" produces the desirable effect; so FFLAGS is only ignored as a cgo directive.
Does this issue reproduce with the latest release (go1.7.5)?
Yes.
System details
The text was updated successfully, but these errors were encountered: