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

fuzz doesn't work with the new fortran linker #125

Open
btracey opened this issue Mar 23, 2016 · 4 comments
Open

fuzz doesn't work with the new fortran linker #125

btracey opened this issue Mar 23, 2016 · 4 comments

Comments

@btracey
Copy link
Contributor

btracey commented Mar 23, 2016

I am trying to fuzz some Go code against the (suposedly) equivalent fortran code. I am seeing a linker error with go-fuzz-build that I am not seeing with go build

brendan:~/Documents/mygo/src$ go version
go version devel +7177cb9 Tue Mar 22 17:30:30 2016 +0000 darwin/amd64
brendan:~/Documents/mygo/src$ go get -u -t github.com/dvyukov/go-fuzz/go-fuzz
brendan:~/Documents/mygo/src$ go get -u -t github.com/dvyukov/go-fuzz/go-fuzz-build
brendan:~/Documents/mygo/src$ go build github.com/btracey/amosfuzz/amos/amostest/fuzz/
brendan:~/Documents/mygo/src$ go-fuzz-build github.com/btracey/amosfuzz/amos/amostest/fuzz/
failed to execute go build: exit status 2
# go.fuzz.main
/var/folders/s0/2lsmv0jd7x37kkxmc_q6wyj80000gn/T/go-fuzz-build517577423/src/go.fuzz.main/main.go:5: non-canonical import path "github.com/btracey/amosfuzz/amos/amostest/fuzz/" (should be "github.com/btracey/amosfuzz/amos/amostest/fuzz")
/var/folders/s0/2lsmv0jd7x37kkxmc_q6wyj80000gn/T/go-fuzz-build517577423/src/go.fuzz.main/main.go:5: can't find import: "github.com/btracey/amosfuzz/amos/amostest/fuzz/"

I do not think this is a duplicate of #101 . I have somewhat equivalent code (though with c wrappers) at github.com/btracey/blasfuzz and it works just fine.

@btracey
Copy link
Contributor Author

btracey commented Mar 23, 2016

Sorry, one moment, that's a different error.

@btracey
Copy link
Contributor Author

btracey commented Mar 23, 2016

I'm not sure what's happening in that code snippet, but this is what I see with almost equivalent code in a different place

brendan:~/Documents/mygo/src$ go build blah.com/mathext/amos/airytest/fuzz/
brendan:~/Documents/mygo/src$ go-fuzz-build blah.com/mathext/amos/airytest/fuzz
failed to execute go build: exit status 2
# blah.com/mathext/amos/airytest
Undefined symbols for architecture x86_64:
  "_zs1s2_", referenced from:
      __cgo_4cc63b68db0e_Cfunc_zs1s2_ in fortran.cgo2.o
     (maybe you meant: __cgo_4cc63b68db0e_Cfunc_zs1s2_)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

@btracey
Copy link
Contributor Author

btracey commented Mar 23, 2016

Ah, I see, the original code snippet had a trailing / that is evidently allowed with go build but not go fuzz build

Here is the correct report. Sorry for the noise.

brendan:~/Documents/mygo/src$ go version
go version devel +7177cb9 Tue Mar 22 17:30:30 2016 +0000 darwin/amd64
brendan:~/Documents/mygo/src$ go get -u -t github.com/dvyukov/go-fuzz/go-fuzz
brendan:~/Documents/mygo/src$ go get -u -t github.com/dvyukov/go-fuzz/go-fuzz-build
brendan:~/Documents/mygo/src$ go build github.com/btracey/amosfuzz/amos/amostest/fuzz
brendan:~/Documents/mygo/src$ go-fuzz-build github.com/btracey/amosfuzz/amos/amostest/fuzz
failed to execute go build: exit status 2
# github.com/btracey/amosfuzz/amos/amostest
Undefined symbols for architecture x86_64:
  "_zs1s2_", referenced from:
      __cgo_89d2cf6f37ae_Cfunc_zs1s2_ in fortran.cgo2.o
     (maybe you meant: __cgo_89d2cf6f37ae_Cfunc_zs1s2_)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

@btracey
Copy link
Contributor Author

btracey commented Mar 23, 2016

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/brendan/Documents/mygo"
GORACE=""
GOROOT="/Users/brendan/gover/go"
GOTOOLDIR="/Users/brendan/gover/go/pkg/tool/darwin_amd64"
CC="gcc-5"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/var/folders/s0/2lsmv0jd7x37kkxmc_q6wyj80000gn/T/go-build627340727=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="g++-5"
CGO_ENABLED="1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants