how to statically compile into 1 big fat binary?
- Robotgo version (or commit ref): v0.90.3
- Go version: 1.14.2
- Gcc version: gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
- Operating system and bit: 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Resolution:
- Can you reproduce the bug at Examples:
- [ ] Yes (provide example code)
- [ ] No
- [ X ] Not relevant
- Provide example code:
https://gist.github.com/hbt/28a98538a0dfe65c7bf24ce9352f9aab
Description
Is it possible to compile and statically link all dependencies into one big binary?
From https://gist.github.com/hbt/28a98538a0dfe65c7bf24ce9352f9aab
git clone https://gist.github.com/hbt/28a98538a0dfe65c7bf24ce9352f9aab
docker-compose build
docker-compose up robotgo
This will compiles fine and creates a binary.
docker up robotgoscratch
This fails because it runs binary on a docker image without dependencies installed
./main: error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory
docker-compose up robotgostatic
This fails to statically link. Log here https://gist.github.com/hbt/a278725431212e2575dd840237e544be
In my case, I don't care about platform portability for shared libraries. Mostly need the binary to run on ubuntu:18.04 without having to install all the deps.
Currently considering either installing the deps or using docker and mounting the X socket.
Any help/guidance would be appreciated to create one big fat binary will all dependencies linked/embedded.
Thank you.