-
Notifications
You must be signed in to change notification settings - Fork 49
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
Failed to build with MUSL target #181
Comments
The problem here is that the In the wasmtime project they have the same issue: bytecodealliance/wasmtime#8898. Given that YARA-X depends on wasmtime, the root cause is probably the same. You can force the linker to link the C runtime dynamically:
This produces a binary without issues, but of course, the binary will be dynamically linked to glibc's versions of |
In bytecodealliance/wasmtime#8898 (comment) they propose setting this environment variable:
And in fact, it worked for me. Can you try that? The problem seems to be that |
Unfortunately the produced binary causes a SIGSEGV during the startup. The issue looks similar to this: |
By setting this other environment variable I'm able to produce a binary that works:
However, it produces a nasty error message:
Except for this message everything seems to work fine. |
Thank you very much for your help, indeed it seems to work. Yet I'd like to get rid of that error if possible as the next step for we would be to try to integrate yara-x into my project. Maybe a stupid question: what is the technical reason justifying the use of wasmtime ? |
The reason is mainly performance. The boolean conditions in YARA rules are transformed into WASM code, which in turns is transformed into native code by wasmtime. Conditions that rely on heavy loops are much faster with this approach. |
According to bytecodealliance/wasmtime#8897 it doesn't seem obvious to remove that error message ... |
After 6953528 everything should be fine, please check. |
BTW, the pre-built Linux binaries distributed with each release are statically linked and should be portable between different Linux systems, they don't rely on the system's libc. These files are built with:
With |
This solution works when building |
The project fails to build (at least for me) for MUSL target.
OS: Archlinux
Error
Expected behaviour
Being able to compile with MUSL target to create portable binaries (at least on Linux).
Replicate the issue
# assuming you are in yara-x project dir cargo build --target x86_64-unknown-linux-musl --bins
The text was updated successfully, but these errors were encountered: