Compilation error

157 views
Skip to first unread message

Thuan Pham

unread,
Nov 20, 2016, 2:45:12 AM11/20/16
to syzkaller
Hello,
I am a beginner in Go and syzkaller and trying to get familiar with syzkaller. I have installed Go v1.6 on Ubuntu 14.04 64-bit and compiled the hello world example successfully. However, when I tried to compile syzkaller using make, I got the following error. syzkaller source code was checked out to $HOME/syzkaller and GOROOT was set to /usr/local/go.

thuan@thuan-Inspiron-3847:~/syzkaller$ export GOPATH=$HOME/syzkaller
thuan@thuan-Inspiron-3847:~/syzkaller$ make
make generate
make[1]: Entering directory `/home/thuan/syzkaller'
go build -o bin/syz-sysgen ./sysgen
sysgen/syscallnr.go:11:2: cannot find package "github.com/google/syzkaller/sysparser" in any of:
        /usr/local/go/src/github.com/google/syzkaller/sysparser (from $GOROOT)
        /home/thuan/syzkaller/src/github.com/google/syzkaller/sysparser (from $GOPATH)
make[1]: *** [bin/syz-sysgen] Error 1
make[1]: Leaving directory `/home/thuan/syzkaller'
make: *** [all] Error 2

I suspect that the GOPATH env variable is not correct. 

I also checked the environment variables used by go as belows but did not recognize anything wrong
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/thuan/work"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

Can someone suggest me how to fix this problem?
Many thanks,
Thuan

Thuan Pham

unread,
Nov 20, 2016, 2:54:16 AM11/20/16
to syzkaller
PS. There is something inconsistent in my question. You see in the first part, I set GOPATH to $HOME/syzkaller but when I printed the list of env variables, GOPATH is $HOME/work. To clarify, I tried to place syzkaller source code at two different locations - $HOME/syzkaller and $HOME/work/src/syzkaller (since I read a tutorial somewhere that suggest to creat src, pkg, and bin folders in the workspace) and export GOPATH to $HOME/syzkaller and $HOME/work accordingly. However, both the two setups did not work.

Athanasios Kostopoulos

unread,
Nov 20, 2016, 3:26:08 AM11/20/16
to syzkaller
Hi,
I had the same problem under Fedora. The solution for this particular error was to
go get github.com/google/syzkaller/sysparser

more errors will await you down the line though (see my next post).

Best Regards,
Athanasios

Dmitry Vyukov

unread,
Nov 20, 2016, 5:16:55 AM11/20/16
to syzkaller
Guess I need to write it up on wiki. But for now:

Download Go 1.7.3 from https://golang.org/dl/, unpack it to ~/go1.7
Set GOROOT to ~/go1.7
Set PATH to ~/go1.7/bin:$PATH
Set GOPATH to ~/gopath
go get -u -d github.com/google/syzkaller/...
It will checkout syzkaller and all dependencies.
> --
> You received this message because you are subscribed to the Google Groups
> "syzkaller" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Thuan Pham

unread,
Nov 20, 2016, 9:54:03 AM11/20/16
to syzkaller
Thanks Dmitry. I follow your steps but get another error. I attach here the output when I run make inside syzkaller project (at $HOME/syzkaller). syzkaller was downloaded by running "go get -u -d github.com/google/syzkaller/...".
FYI, all three folders - go1.7, gopath and syzkaller are placed at my home directory.
Thuan
error.txt

Dmitry Vyukov

unread,
Nov 20, 2016, 10:03:54 AM11/20/16
to syzkaller
$HOME/syzkaller is _not_ what was downloaded by "go get -u -d
github.com/google/syzkaller/...".
go get places sources into $GOPATH. syzkaller should be in
$GOPATH/src/github.com/google/syzkaller.
Delete $HOME/syzkaller, and run make from
$GOPATH/src/github.com/google/syzkaller.

dastig...@gmail.com

unread,
May 17, 2017, 8:38:07 AM5/17/17
to syzkaller
I am really sorry to annoy you again, with problems that apparently nobody else besides me has...
I tried the exact way you describe here and get the following error:
make[1]: Leaving directory '/home/user/gopath/src/github.com/google/syzkaller'
go install ./syz-manager ./syz-fuzzer
gce/gce.go:21:2: cannot find package "golang.org/x/net/context" in any of:
/home/user/go1.7/src/golang.org/x/net/context (from $GOROOT)
/home/user/gopath/src/golang.org/x/net/context (from $GOPATH)
gce/gce.go:22:2: cannot find package "golang.org/x/oauth2" in any of:
/home/user/go1.7/src/golang.org/x/oauth2 (from $GOROOT)
/home/user/gopath/src/golang.org/x/oauth2 (from $GOPATH)
gce/gce.go:23:2: cannot find package "golang.org/x/oauth2/google" in any of:
/home/user/go1.7/src/golang.org/x/oauth2/google (from $GOROOT)
/home/user/gopath/src/golang.org/x/oauth2/google (from $GOPATH)
vm/console.go:16:2: cannot find package "golang.org/x/sys/unix" in any of:
/home/user/go1.7/src/golang.org/x/sys/unix (from $GOROOT)
/home/user/gopath/src/golang.org/x/sys/unix (from $GOPATH)
gce/gce.go:24:2: cannot find package "google.golang.org/api/compute/v0.beta" in any of:
/home/user/go1.7/src/google.golang.org/api/compute/v0.beta (from $GOROOT)
/home/user/gopath/src/google.golang.org/api/compute/v0.beta (from $GOPATH)
gce/gce.go:25:2: cannot find package "google.golang.org/api/googleapi" in any of:
/home/user/go1.7/src/google.golang.org/api/googleapi (from $GOROOT)
/home/user/gopath/src/google.golang.org/api/googleapi (from $GOPATH)
Makefile:12: recipe for target 'all' failed
make: *** [all] Error 1

> go version
go version go1.7.3 linux/amd64

> env | grep -i go
PATH=/home/user/go1.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
GOROOT=/home/user/go1.7
GOPATH=/home/user/gopath

I really tried it the exact same way you described...

Firo Yang

unread,
May 17, 2017, 8:46:59 AM5/17/17
to dastig...@gmail.com, syzkaller
Hi dastigerchen,

I have also met this issue before.
I am using Fedora dirstro, I fix this compilation error by installing
following packages:
golang-google-golang-api-devel.noarch
golang-github-golang-sys-devel.noarch
golang-golangorg-net-devel
golang-golangorg-oauth2-devel

And there should be something wrong the path in these packages in your
environment .
For example,

rpm -ql golang-golangorg-oauth2-devel | grep src
/usr/share/gocode/src/golang.org/x/oauth2
/usr/share/gocode/src/golang.org/x/oauth2/bitbucket/bitbucket.go
/usr/share/gocode/src/golang.org/x/oauth2/client_appengine.go
/usr/share/gocode/src/golang.org/x/oauth2/clientcredentials/clientcredentials.go
/usr/share/gocode/src/golang.org/x/oauth2/facebook/facebook.go

So you need to make a soft link to /usr/share/gocode/src/ under
$GOROOT or $GOPATH.

Thanks,
Firo

Andrey Konovalov

unread,
May 17, 2017, 8:48:39 AM5/17/17
to dastigerchen, syzkaller
You're missing the required dependencies.

You can install them by running `go get -u -d
github.com/google/syzkaller` (the `-u` flag).

I'll update the README.

>
>> go version
> go version go1.7.3 linux/amd64
>
>> env | grep -i go
> PATH=/home/user/go1.7/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
> GOROOT=/home/user/go1.7
> GOPATH=/home/user/gopath
>
> I really tried it the exact same way you described...
>
>
> Am Sonntag, 20. November 2016 16:03:54 UTC+1 schrieb Dmitry Vyukov:
>>
>> On Sun, Nov 20, 2016 at 3:54 PM, Thuan Pham <thuan...@gmail.com> wrote:
>> > Thanks Dmitry. I follow your steps but get another error. I attach here
>> > the
>> > output when I run make inside syzkaller project (at $HOME/syzkaller).
>> > syzkaller was downloaded by running "go get -u -d
>> > github.com/google/syzkaller/...".
>> > FYI, all three folders - go1.7, gopath and syzkaller are placed at my
>> > home
>> > directory.
>>
>>
>> $HOME/syzkaller is _not_ what was downloaded by "go get -u -d
>> github.com/google/syzkaller/...".
>> go get places sources into $GOPATH. syzkaller should be in
>> $GOPATH/src/github.com/google/syzkaller.
>> Delete $HOME/syzkaller, and run make from
>> $GOPATH/src/github.com/google/syzkaller.
>

Dmitry Vyukov

unread,
May 17, 2017, 12:23:53 PM5/17/17
to Andrey Konovalov, dastigerchen, syzkaller
We test with latest versions of dependent packages, so there is some
chance that distro provided packages may not work.
"go get -d github.com/google/syzkaller/..." is all you need.
"go get -d -u github.com/google/syzkaller/..." if you installed some
Go packages before, but they are outdated.

dastigerchen

unread,
May 17, 2017, 12:42:19 PM5/17/17
to Dmitry Vyukov, Andrey Konovalov, syzkaller
Thanks guys, now it's working...
I can recommend the "-u" flag ;)
Reply all
Reply to author
Forward
0 new messages