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

Compatibility with Alpine Linux #1482

Closed
RReverser opened this issue Jun 23, 2020 · 7 comments · Fixed by #2003
Closed

Compatibility with Alpine Linux #1482

RReverser opened this issue Jun 23, 2020 · 7 comments · Fixed by #2003
Assignees
Labels
🎉 enhancement New feature!

Comments

@RReverser
Copy link

Thanks for proposing a new feature!

Motivation

Many tiny Docker deployments use Alpine Linux as its base to reduce size of images and containers. Currently, wasmer is incompatible with such environments because it's compiled against glibc.

Proposed solution

Provide a build of wasmer that can work with musl libc as well.

Additional context

For background, initially I stumbled upon this due to non-sensical error after installation:

/ # ls /root/.wasmer/bin/wasmer
/root/.wasmer/bin/wasmer
/ # /root/.wasmer/bin/wasmer
sh: /root/.wasmer/bin/wasmer: not found

After searching around, I found explanation of a similar issue as well a workaround that creates a symbolic link for musl libc pretending to be full one: https://stackoverflow.com/questions/34729748/installed-go-binary-not-found-in-path-on-alpine-linux-docker

That helped a bit, but there are still missing functions due to differences in libc implementations:

/ # mkdir /lib64
/ # ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
/ # /root/.wasmer/bin/wasmer
Error relocating /root/.wasmer/bin/wasmer: __snprintf_chk: symbol not found
Error relocating /root/.wasmer/bin/wasmer: mallinfo: symbol not found
Error relocating /root/.wasmer/bin/wasmer: __fprintf_chk: symbol not found
Error relocating /root/.wasmer/bin/wasmer: __vsnprintf_chk: symbol not found
Error relocating /root/.wasmer/bin/wasmer: __longjmp_chk: symbol not found

Hence, I think it would be best if wasmer would be built against musl as well.

@RReverser RReverser added the 🎉 enhancement New feature! label Jun 23, 2020
@syrusakbary
Copy link
Member

Thanks for creating the issue @RReverser!

It seems the not-found symbols are all related to the emscripten integration. Perhaps we can shape it so we don't require those or adapt them to be compatible with musl.
We could also create a new binary that is built without emscripten support (probably the simplest solution).

Would the latter suffice for your use case?

@RReverser
Copy link
Author

Yeah that sounds reasonable.

@MarkMcCaskey MarkMcCaskey self-assigned this Sep 23, 2020
@krasin
Copy link

krasin commented Jan 5, 2021

Just saw an announce of Wasmer 1.0 (congrats!) and tried it locally on an Alpine Linux dev laptop. Did not work, same reasons:

$ ldd ~/.wasmer/bin/wasmer 
	/lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
	libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
	librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
	libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fc4de7f6000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fc4de7dc000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fc4e2942000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/krasin/.wasmer/bin/wasmer)
Error relocating /home/krasin/.wasmer/bin/wasmer: __snprintf_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: mallinfo: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __memcpy_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: backtrace_symbols_fd: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: backtrace: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: pthread_getname_np: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __vsnprintf_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __longjmp_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __register_atfork: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __realpath_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __sprintf_chk: symbol not found
Error relocating /home/krasin/.wasmer/bin/wasmer: __res_init: symbol not found

@syrusakbary
Copy link
Member

syrusakbary commented Jan 5, 2021

Sorry, this issue completely slipped for 1.0.0.

@jubianchi can we disable emscripten when doing the musl build?

@jubianchi
Copy link
Contributor

I'll have a look at this today.

@jubianchi jubianchi self-assigned this Jan 6, 2021
@jubianchi
Copy link
Contributor

@krasin some update here: I had Wasmer build on musl working.

I'll continue working on that and see how we can produces this builds in our CI pipeline.

@krasin
Copy link

krasin commented Jan 7, 2021

@jubianchi awesome, thank you for the update!

jubianchi added a commit that referenced this issue Jan 11, 2021
jubianchi added a commit that referenced this issue Jan 11, 2021
jubianchi added a commit that referenced this issue Jan 11, 2021
jubianchi added a commit that referenced this issue Jan 12, 2021
jubianchi added a commit that referenced this issue Jan 12, 2021
jubianchi added a commit that referenced this issue Jan 12, 2021
jubianchi added a commit that referenced this issue Jan 12, 2021
jubianchi added a commit that referenced this issue Jan 12, 2021
jubianchi added a commit that referenced this issue Jan 13, 2021
jubianchi added a commit that referenced this issue Jan 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Jan 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Jan 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Jan 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Jan 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Jan 14, 2021
jubianchi added a commit that referenced this issue Jan 14, 2021
jubianchi added a commit that referenced this issue Jan 14, 2021
jubianchi added a commit that referenced this issue Jan 14, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 11, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit that referenced this issue Feb 12, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit to jubianchi/wasmer that referenced this issue Feb 13, 2021
jubianchi added a commit that referenced this issue Feb 13, 2021
jubianchi added a commit that referenced this issue Feb 13, 2021
jubianchi added a commit that referenced this issue Feb 13, 2021
jubianchi added a commit that referenced this issue Feb 13, 2021
jubianchi added a commit that referenced this issue Feb 19, 2021
jubianchi added a commit that referenced this issue Feb 19, 2021
jubianchi added a commit that referenced this issue Feb 19, 2021
jubianchi added a commit that referenced this issue Mar 3, 2021
bors bot added a commit that referenced this issue Mar 5, 2021
2003: chore: Build Wasmer on musl r=jubianchi a=jubianchi


This patch adds a specific build for musl. Currently, it will only support JIT engine.

I also changes the workflow definition a bit so we don't depend on the OS name but rather on the environment ID which is our convention.

Closes #1482
Closes #1766

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description
<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: jubianchi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants