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

musl binary is not statically linked #10

Closed
dufferzafar opened this issue May 26, 2022 · 7 comments
Closed

musl binary is not statically linked #10

dufferzafar opened this issue May 26, 2022 · 7 comments

Comments

@dufferzafar
Copy link

I downloaded the latest musl binary from GitHub releases, but am unable to run it.

❯ /spare/ssd/szafar/apps/bin/hgrep
zsh: no such file or directory: /spare/ssd/szafar/apps/bin/hgrep

❯ ldd /spare/ssd/szafar/apps/bin/hgrep
        linux-vdso.so.1 (0x00007fff4bdf7000)
        libgtk3-nocsd.so.0 => /lib/x86_64-linux-gnu/libgtk3-nocsd.so.0 (0x00007fad62b28000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fad62b0d000)
        libc.musl-x86_64.so.1 => not found
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fad62b07000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fad62ae4000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fad628f2000)
        /lib/ld-musl-x86_64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x00007fad633d2000)

❯ file /spare/ssd/szafar/apps/bin/hgrep
/spare/ssd/szafar/apps/bin/hgrep: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, with debug_info, not stripped
@rhysd
Copy link
Owner

rhysd commented May 27, 2022

Your ldd output says that musl libc is not installed in your system.

@dufferzafar
Copy link
Author

@rhysd But I've never needed it before with other application's musl build. I thought the point of musl was to create a statically linked binary that works anywhere?

@rhysd
Copy link
Owner

rhysd commented May 27, 2022

OK, I understood your point. I'll change the title.

@rhysd rhysd changed the title Unable to run the musl binary musl binary is not statically linked May 27, 2022
@rhysd
Copy link
Owner

rhysd commented May 27, 2022

Can you download binary from the following link and check if this issue was fixed on your side?

https://github.com/rhysd/hgrep/suites/6685740113/artifacts/253610627

@dufferzafar
Copy link
Author

dufferzafar commented May 27, 2022

Yes it works! What did you change on your end?

I was facing this error with another rust app as well: jmacdonald/amp#255

@rhysd rhysd closed this as completed in f228502 May 27, 2022
@rhysd
Copy link
Owner

rhysd commented May 27, 2022

This is the change:

f228502

I noticed that -crt-static prevents linking libc statically. I just removed it and rebuilt release binary.

@rhysd
Copy link
Owner

rhysd commented May 27, 2022

v0.2.6 was released

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

2 participants