Error compiling an app with Go: Undefined

I got this error , I need help please

tools/syz-env/env.go:52:36: target.CrossCFlags undefined (type *targets.Target has no field or method CrossCFlags)
Makefile:35: *** syz-env failed. Stop.

Hi @Jules_Irenge,

The error message says,

How is targets.Target defined?

1 Like

Thanks for reply. I believe it is defined in the pkg/compiler/compiler.go .

SyzVegas/env.go at 20200120 · SoveraNia/SyzVegas · GitHub :52

Thanks, this is a good starting point. The file imports the Target type from the google/syzkaller repo:

And there is indeed no CrossCFlags field defined.

The error message points to file

tools/syz-env/env.go

which looks like belonging to syzkaller but the repo does not seem to contain that path.

I’d reckon that there is something wrong with either of the two repos, maybe a mismatch of checked-out branches or commits.

1 Like

Thanks for the reply
I matched the checkout and hit

jules@ubuntux:~/Desktop/year_report/SyzVegas$ make
GOOS=linux GOARCH=amd64 go install ./syz-manager
GOOS=linux GOARCH=amd64 go install ./syz-fuzzer
syz-fuzzer/fuzzer.go:25:2: cannot find package "github.com/google/syzkaller/pkg/glc" in any of:
	/home/jules/Desktop/year_report/go/src/github.com/google/syzkaller/pkg/glc (from $GOROOT)
	/home/jules/Desktop/year_report/SyzVegas/src/github.com/google/syzkaller/pkg/glc (from $GOPATH)
make: *** [Makefile:113: target] Error 1
make: *** Waiting for unfinished jobs....
syz-manager/rpc.go:16:2: cannot find package "github.com/google/syzkaller/pkg/glc" in any of:
	/home/jules/Desktop/year_report/go/src/github.com/google/syzkaller/pkg/glc (from $GOROOT)
	/home/jules/Desktop/year_report/SyzVegas/src/github.com/google/syzkaller/pkg/glc (from $GOPATH)
make: *** [Makefile:109: host] Error 1
and the install glc failed

Any help

The error in that output is:

Have you run go get github.com/google/syzkaller/pkg/glc to install that package?

Yeah , it gave me some error about not being in the same
go get …/google/syzkaller/pkg/glc
package …/google/syzkaller/pkg/glc: cannot find package “…/google/syzkaller/pkg/glc” in any of:
/home/jules/Desktop/year_report/go/…/google/syzkaller/pkg/glc (from $GOROOT)
/home/jules/Desktop/year_report/SyzVegas/src/…/google/syzkaller/pkg/glc (from $GOPATH)

I tried go get at my end, and this is what I get:

> go get github.com/google/syzkaller/pkg/glc
go: downloading github.com/google/syzkaller v0.0.0-20220201125236-4ebb27982f89
go: module github.com/google/syzkaller@upgrade found (v0.0.0-20220201125236-4ebb27982f89), but does not contain package github.com/google/syzkaller/pkg/glc

which seems a correct error because syzkaller indeed does not contain /pkg/glc.

I guess the problem persists because SoveraNia/SyzVegas is a project from pre-Go-Module times and has not been updated to Go Module use. The external dependencies certainly have evolved since then, and now they seem to contain breaking changes that the Go Module system could have prevented. The repo owner would need to add a go.mod file and carefully set up the project’s external dependencies with proper version information. However, the repo looks quite abandoned. And the repo owner has no contributions on GitHub since August 2020.

Possible options IMHO: fork the SyzVegas repo and maintain it for yourself, or look for alternatives.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.