Skip to content

Build a statically linked executable for linux (to support older linuxes) #521

Description

@nickolay

Didn't see this discussed anywhere, so logging it just in case it's useful for someone else.

I'm currently upgrading an ancient stack and was hoping to use sling to help with the migration.

When trying to run it on ubuntu 18.04, I got this:

$ ./sling-official
./sling-official: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./sling-official)
./sling-official: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by ./sling-official)

Now, having built sling myself, I see that the version produced with the instructions from README on my dev machine (Ubuntu 22.04) works on the same ancient OS without a problem:

$ file sling-official
sling-official: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e90be750e39e23dc7f98d934f9fef3e39b22a0f2, for GNU/Linux 3.2.0, with debug_info, not stripped


$ file sling
sling: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=jA28l_J4aGuDYmGGZRZD/UHVi-y7PqMI6IVKFYsmb/YqRQbGVg4-pLKkI8J9Ci/PoN1lbN7dkSPDjtShNFV, with debug_info, not stripped

(I had to disable sqlite parts of the code due to a weird error that only appears on linux go/pkg/mod/github.com/psanford/sqlite3vfs@v0.0.0-20220823065410-bd28ac7ee3c2 /sqlite3vfs.go:28:9: undefined: newVFS, so can't do a file size comparison — my executable is currently even a little smaller.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions