Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

make binary causes fatal error: btrfs/ioctl.h: No such file or directory #663

Closed
yuchengwu opened this issue May 27, 2019 · 2 comments · Fixed by #664
Closed

make binary causes fatal error: btrfs/ioctl.h: No such file or directory #663

yuchengwu opened this issue May 27, 2019 · 2 comments · Fixed by #664

Comments

@yuchengwu
Copy link

wyc@smile:~/go/src/github.com/containers/skopeo$ make binary
docker build  -f Dockerfile.build -t skopeobuildimage .
Sending build context to Docker daemon  46.92MB
Step 1/4 : FROM ubuntu:18.10
 ---> d23255d3a3b2
Step 2/4 : RUN apt-get update && apt-get install -y     golang     btrfs-tools     git-core     libdevmapper-dev     libgpgme11-dev     go-md2man     libglib2.0-dev     libostree-dev
 ---> Using cache
 ---> 36acb410926a
Step 3/4 : ENV GOPATH=/
 ---> Using cache
 ---> e0a0e6ad93f2
Step 4/4 : WORKDIR /src/github.com/containers/skopeo
 ---> Using cache
 ---> 16e8d9c31481
Successfully built 16e8d9c31481
Successfully tagged skopeobuildimage:latest
docker run --rm --security-opt label=disable -v $(pwd):/src/github.com/containers/skopeo \
        skopeobuildimage make binary-local  BUILDTAGS='   containers_image_ostree_stub '
go build "-buildmode=pie" -ldflags "-X main.gitCommit=0c90e57eaf6496b77516310faefbe43a6e7e126a" -gcflags "" -tags "containers_image_ostree_stub " -o skopeo ./cmd/skopeo
# github.com/containers/skopeo/vendor/github.com/containers/storage/drivers/btrfs
vendor/github.com/containers/storage/drivers/btrfs/btrfs.go:8:10: fatal error: btrfs/ioctl.h: No such file or directory
 #include <btrfs/ioctl.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:98: binary-local] Error 2
Makefile:87: recipe for target 'binary' failed
make: *** [binary] Error 2

env

wyc@smile:~/go/src/github.com/containers/skopeo$ uname -a
Linux smile 4.15.0-47-generic #50~16.04.1-Ubuntu SMP Fri Mar 15 16:06:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
wyc@smile:~/go/src/github.com/containers/skopeo$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
@yuchengwu
Copy link
Author

using make binary-static as a workaround:

wyc@smile:~/go/src/github.com/containers/skopeo$ make binary-static DISABLE_CGO=1                                                                                                                           
docker build  -f Dockerfile.build -t skopeobuildimage .                                                                                                                                                     
Sending build context to Docker daemon  24.47MB                                                                                                                                                             
Step 1/4 : FROM ubuntu:18.10                                                                                                                                                                                
 ---> d23255d3a3b2                                                                                                                                                                                          
Step 2/4 : RUN apt-get update && apt-get install -y     golang     btrfs-tools     git-core     libdevmapper-dev     libgpgme11-dev     go-md2man     libglib2.0-dev     libostree-dev                     
 ---> Using cache                                                                                                                                                                                          
 ---> 36acb410926a
Step 3/4 : ENV GOPATH=/
 ---> Using cache
 ---> e0a0e6ad93f2
Step 4/4 : WORKDIR /src/github.com/containers/skopeo
 ---> Using cache
 ---> 16e8d9c31481
Successfully built 16e8d9c31481
Successfully tagged skopeobuildimage:latest
docker run --rm --security-opt label=disable -v $(pwd):/src/github.com/containers/skopeo \
        skopeobuildimage make binary-local-static  BUILDTAGS='containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp'                            
go build -ldflags "-extldflags \"-static\" -X main.gitCommit=0c90e57eaf6496b77516310faefbe43a6e7e126a" -gcflags "" -tags "containers_image_ostree_stub exclude_graphdriver_devicemapper exclude_graphdriver$
btrfs containers_image_openpgp" -o skopeo ./cmd/skopeo
# github.com/containers/skopeo/cmd/skopeo
/usr/bin/ld: /tmp/go-link-614361114/000005.o: in function `mygetgrouplist':
/build/golang-1.10-0Gb4kq/golang-1.10-1.10.4/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc v$
rsion used for linking
/usr/bin/ld: /tmp/go-link-614361114/000004.o: in function `mygetgrgid_r':
/build/golang-1.10-0Gb4kq/golang-1.10-1.10.4/src/os/user/cgo_lookup_unix.go:38: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc versi$
n used for linking
/usr/bin/ld: /tmp/go-link-614361114/000004.o: in function `mygetgrnam_r':
/build/golang-1.10-0Gb4kq/golang-1.10-1.10.4/src/os/user/cgo_lookup_unix.go:43: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc versi$
n used for linking
/usr/bin/ld: /tmp/go-link-614361114/000004.o: in function `mygetpwnam_r':
/build/golang-1.10-0Gb4kq/golang-1.10-1.10.4/src/os/user/cgo_lookup_unix.go:33: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc versi$
n used for linking
/usr/bin/ld: /tmp/go-link-614361114/000004.o: in function `mygetpwuid_r':
/build/golang-1.10-0Gb4kq/golang-1.10-1.10.4/src/os/user/cgo_lookup_unix.go:28: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc versi$
n used for linking
/usr/bin/ld: /tmp/go-link-614361114/000023.o: in function `_cgo_f7895c2c5a3a_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:46: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking 

@mtrmac
Copy link
Contributor

mtrmac commented May 27, 2019

Thanks for your report, this should be fixed by #664.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants