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

Fail to compile from source #138

Closed
tamalsaha opened this issue Nov 24, 2018 · 8 comments
Closed

Fail to compile from source #138

tamalsaha opened this issue Nov 24, 2018 · 8 comments

Comments

@tamalsaha
Copy link
Contributor

I am trying to rebuild the binary on a Ubuntu 18.04 machine. I am getting the following error:

~/g/s/g/wal-g $ go get github.com/wal-g/wal-g
# github.com/wal-g/wal-g/vendor/github.com/google/brotli/go/cbrotli
wal-g/vendor/github.com/google/brotli/go/cbrotli/reader.go:13:10: fatal error: brotli/decode.h: No such file or directory
 #include <brotli/decode.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.

What do I need to do for brotli ?

Thanks.

@x4m
Copy link
Collaborator

x4m commented Nov 24, 2018

Hi!
Call ./build.sh
Works for me and Travis.
Also works on Mac, but integration tests will fail - containers are Linux, but will get Mach binary.

@tamalsaha
Copy link
Contributor Author

./build.sh worked. Thank you!

I want to use the generated binary inside an Alpine based Docker image. Usually libc based builds do not work with Alpine's musl libc. Any change, we can get a Alpine based build (probably build using inside a Docker image) ?

@x4m
Copy link
Collaborator

x4m commented Nov 24, 2018

I do not know, maybe you can add something to build.sh to produce necessary build? Or add script that will produce version you want?

Also, we could make brotli built with gotags like lzo. This will partially solve the problem, but I really expect that this compression algorithm is far superior to lz4 for typical database workloads.

@tamalsaha
Copy link
Contributor Author

I just tried with an Alpine specific (need to install compiler and removed docker-compose parts) build-alpine.sh and run it inside golang:1.11.2-alpine Docker image using make alpine command. You can see my change here: kubedb@d83b9b0

But I am getting a new error from zstd:

+ make
(cd cmd/wal-g && go build  -ldflags "-s -w -X main.BuildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X main.GitRevision=`git rev-parse --short HEAD` -X main.WalgVersion=`git tag -l --points-at HEAD`")
../../zstd_decompressor.go:4:2: build constraints exclude all Go files in /go/src/github.com/wal-g/wal-g/vendor/github.com/DataDog/zstd
make: *** [Makefile:30: cmd/wal-g/wal-g] Error 1
Makefile:33: recipe for target 'alpine' failed

Do you know where this build tag is defined?

@tamalsaha
Copy link
Contributor Author

The error was fixed after I removed CGO_ENABLED=0 .
golang/go#24433

@tamalsaha
Copy link
Contributor Author

Looks like it worked

~/g/s/g/w/wal-g (alpine) $ file cmd/wal-g/wal-g 
cmd/wal-g/wal-g: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, stripped

@tamalsaha
Copy link
Contributor Author

Do you think Alpine build can be supported by this project ? This is the change I needed?

kubedb@4fe7467

@Tinsane
Copy link
Collaborator

Tinsane commented Nov 26, 2018

HI!
The possibility of the Alpine build is very cool! Unfortunately, none of the active WAL-G developers use Alpine so for us, it's impossible to validate the correctness of the build. You can maintain it by yourself but in such a case it gonna be easier for you if you refactor the Alpine build logic in such a manner, that we shouldn't make build process changes in both scripts for Alpine and other OSs.

@Tinsane Tinsane closed this as completed Dec 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants