Direnv: v2.23.0 Breaks Alpine Linux Support

Created on 12 Oct 2020  路  3Comments  路  Source: direnv/direnv

Describe the bug
I suspect something related to the dynamic linking against glibc precludes it from working.

To Reproduce
Steps to reproduce the behavior:

docker run alpine:3.12 sh -c ' wget https://github.com/direnv/direnv/releases/download/v2.23.0/direnv.linux-amd64; chmod 755 direnv.linux-amd64 ; ./direnv.linux-amd64; ldd ./direnv.linux-amd64'
Connecting to github.com (192.30.255.113:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.28.76:443)
saving to 'direnv.linux-amd64'
direnv.linux-amd64    32% |**********                      | 3264k  0:00:02 ETA
direnv.linux-amd64   100% |********************************|  9.8M  0:00:00 ETA
'direnv.linux-amd64' saved
sh: ./direnv.linux-amd64: not found
Error relocating ./direnv.linux-amd64: __vfprintf_chk: symbol not found
Error relocating ./direnv.linux-amd64: __fprintf_chk: symbol not found
    /nix/store/w7hmngvdx4fhg3vd8iad0hjh58w3gqsm-glibc-2.27/lib/ld-linux-x86-64.so.2 (0x7f23c1076000)
    libpthread.so.0 => /nix/store/w7hmngvdx4fhg3vd8iad0hjh58w3gqsm-glibc-2.27/lib/ld-linux-x86-64.so.2 (0x7f23c1076000)
    libc.so.6 => /nix/store/w7hmngvdx4fhg3vd8iad0hjh58w3gqsm-glibc-2.27/lib/ld-linux-x86-64.so.2 (0x7f23c1076000)

I find the paths to /nix/store/... most suspect as that's presumably an artifact of building on NixOS.

Note it runs fine in v2.22.1 (and we've been running it for years in alpine)

docker run alpine:3.12 sh -c ' wget https://github.com/direnv/direnv/releases/download/v2.22.1/direnv.linux-amd64; chmod 755 direnv.linux-amd64 ; ./direnv.linux-amd64; ldd ./direnv.linux-amd64'
Connecting to github.com (192.30.255.113:443)
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (52.216.161.243:443)
saving to 'direnv.linux-amd64'
direnv.linux-amd64     1% |                                | 51768  0:01:37 ETA
direnv.linux-amd64   100% |********************************| 4949k  0:00:00 ETA
'direnv.linux-amd64' saved
direnv v2.22.1
Usage: direnv COMMAND [...ARGS]

Available commands
------------------
allow [PATH_TO_RC]:
  Grants direnv to load the given .envrc
deny [PATH_TO_RC]:
  Revokes the authorization of a given .envrc
edit [PATH_TO_RC]:
  Opens PATH_TO_RC or the current .envrc into an $EDITOR and allow
  the file to be loaded afterwards.
exec DIR COMMAND [...ARGS]:
  Executes a command after loading the first .envrc found in DIR
help [SHOW_PRIVATE]:
  shows this help
hook SHELL:
  Used to setup the shell hook
prune:
  removes old allowed files
reload:
  triggers an env reload
status:
  prints some debug status information
stdlib:
  Displays the stdlib available in the .envrc execution context
version [VERSION_AT_LEAST]:
  prints the version (2.22.1) or checks that direnv is older than VERSION_AT_LEAST.
/lib/ld-musl-x86_64.so.1: ./direnv.linux-amd64: Not a valid dynamic program

Using libc6-compat does not affect the outcome.

Expected behavior

Running ./direnv.linux-amd64 on alpine linux should result in successful execution.

Environment

Bug

All 3 comments

The latest one is broken for me as well. Pinning to 2.22.1 works.

OS: Ubuntu 16.04
Shell: bash
Direnv version 2.23.0

$ ldd bin/direnv
        linux-vdso.so.1 =>  (0x00007ffc91cde000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f594f065000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f594ec9b000)
        /nix/store/w7hmngvdx4fhg3vd8iad0hjh58w3gqsm-glibc-2.27/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f594f282000)

Sorry about that. I re-built the binaries with CGO_ENABLED=0 which should solve the problem. Can you try the re-uploaded binaries?

Looks like that did it! Thanks =)

This works now:

docker run alpine:3.12 sh -c ' wget https://github.com/direnv/direnv/releases/download/v2.23.0/direnv.linux-amd64; chmod 755 direnv.linux-amd64 ; ./direnv.linux-amd64'
Was this page helpful?
0 / 5 - 0 ratings