redspread / spread

Docker to Kubernetes in one command
https://coreos.com
Apache License 2.0
1.84k stars 83 forks source link

Building the gitlab image fails #172

Open RobinVanCauter opened 7 years ago

RobinVanCauter commented 7 years ago

I've installed libgit2, I've setup LD_LIBRARY_PATH and running ld -v -lgit2 tells me the compiler is able to find it at /usr/local/lib/libgit2.so.

But when I run make build-gitlab or build/spread-linux-static gcc seems to fail.

I've not meddled around with Go before, so I might be missing something obvious here?

GOOS=linux go build -o build/spread-linux-static -i -v -ldflags "-X main.Version=v0.0.0 -extldflags "-static" --s -w" rsprd.com/spread/cmd/spread
rsprd.com/spread/cmd/spread
# rsprd.com/spread/cmd/spread
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lgit2
/tmp/go-link-587612200/000003.o: In function `mygetgrouplist':
/tmp/workdir/go/src/os/user/getgrouplist_unix.go:15: warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-587612200/000003.o: In function `mygetgrgid_r':
/tmp/workdir/go/src/os/user/lookup_unix.go:38: warning: Using 'getgrgid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-587612200/000003.o: In function `mygetgrnam_r':
/tmp/workdir/go/src/os/user/lookup_unix.go:43: warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-587612200/000003.o: In function `mygetpwnam_r':
/tmp/workdir/go/src/os/user/lookup_unix.go:33: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-587612200/000003.o: In function `mygetpwuid_r':
/tmp/workdir/go/src/os/user/lookup_unix.go:28: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/tmp/go-link-587612200/000002.o: In function `_cgo_7a2d42f1a351_C2func_getaddrinfo':
/tmp/workdir/go/src/net/cgo_unix.go:66: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status

Makefile:100: recipe for target 'build/spread-linux-static' failed
make: *** [build/spread-linux-static] Error 2
acaire commented 7 years ago

I'm running OSX and managed to get a build by adding -DBUILD_SHARED_LIBS=0 to the existing cmake flags in hack/build-libgit2.sh