diff options
author | Ayke van Laethem <[email protected]> | 2020-04-01 23:13:16 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-11-04 17:15:38 +0100 |
commit | 403d93560b78a7eb6cc3bc2853d80cb7dfadc239 (patch) | |
tree | acc51a31099783f35b3ea7dbaa82a19c635de025 /.circleci | |
parent | b344d657819827d54936c88df6c66c56331ef0b6 (diff) | |
download | tinygo-403d93560b78a7eb6cc3bc2853d80cb7dfadc239.tar.gz tinygo-403d93560b78a7eb6cc3bc2853d80cb7dfadc239.zip |
builder: build static binaries using musl on Linux
This commit adds support for musl-libc and uses it by default on Linux.
The main benefit of it is that binaries are always statically linked
instead of depending on the host libc, even when using CGo.
Advantages:
- The resulting binaries are always statically linked.
- No need for any tools on the host OS, like a compiler, linker, or
libc in a release build of TinyGo.
- This also simplifies cross compilation as no cross compiler is
needed (it's all built into the TinyGo release build).
Disadvantages:
- Binary size increases by 5-6 kilobytes if -no-debug is used. Binary
size increases by a much larger margin when debugging symbols are
included (the default behavior) because musl is built with debugging
symbols enabled.
- Musl does things a bit differently than glibc, and some CGo code
might rely on the glibc behavior.
- The first build takes a bit longer because musl needs to be built.
As an additional bonus, time is now obtained from the system in a way
that fixes the Y2038 problem because musl has been a bit more agressive
in switching to 64-bit time_t.
Diffstat (limited to '.circleci')
-rw-r--r-- | .circleci/config.yml | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index dbdb6b54b..de75739b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,18 +17,15 @@ commands: echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<<parameters.llvm>> main' | sudo tee /etc/apt/sources.list.d/llvm.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - sudo apt-get update - sudo apt-get install \ + sudo apt-get install --no-install-recommends \ llvm-<<parameters.llvm>>-dev \ clang-<<parameters.llvm>> \ libclang-<<parameters.llvm>>-dev \ lld-<<parameters.llvm>> \ - gcc-arm-linux-gnueabihf \ - gcc-aarch64-linux-gnu \ qemu-system-arm \ qemu-user \ gcc-avr \ avr-libc - sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-8-dev install-node: steps: - run: @@ -139,17 +136,12 @@ commands: name: "Install apt dependencies" command: | sudo apt-get update - sudo apt-get install \ + sudo apt-get install --no-install-recommends \ libgnutls30 libssl1.0.2 \ - gcc-arm-linux-gnueabihf \ - libc6-dev-armel-cross \ - gcc-aarch64-linux-gnu \ - libc6-dev-arm64-cross \ qemu-system-arm \ qemu-user \ gcc-avr \ avr-libc - sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev - install-node - install-wasmtime - install-xtensa-toolchain: @@ -209,17 +201,12 @@ commands: name: "Install apt dependencies" command: | sudo apt-get update - sudo apt-get install \ + sudo apt-get install --no-install-recommends \ libgnutls30 libssl1.0.2 \ - gcc-arm-linux-gnueabihf \ - libc6-dev-armel-cross \ - gcc-aarch64-linux-gnu \ - libc6-dev-arm64-cross \ qemu-system-arm \ qemu-user \ gcc-avr \ avr-libc - sudo apt-get install --no-install-recommends libc6-dev-i386 lib32gcc-6-dev - install-node - install-wasmtime - install-xtensa-toolchain: |