Closed LunNova closed 7 months ago
That'd be great! Switching to iced-x86, which is more actively maintained would also avoid issues we've run into like with slice-pool
Any updates on this? Just ran into an issue where I can't compile my project at all thanks to libudis86-sys
errors.
Same here, libudis86-sys wont compile for me when trying to build for the x86_64-pc-windows-msvc
target from a linux host (something about memset function not found I believe)
Same here, libudis86-sys wont compile for me when trying to build for the
x86_64-pc-windows-msvc
target from a linux host (something about memset function not found I believe)
I can't reproduce the issue on my machine, is there any more information you could provide about libudis86-sys
failing to compile?
Yes of course, this is the error I'm getting
cargo:warning=clang-16: warning: unknown argument ignored in clang-cl: '-includestring.h' [-Wunknown-argument]
cargo:warning=libudis86/udis86.c(47,3): error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
cargo:warning= memset((void*)u, 0, sizeof(struct ud));
cargo:warning= ^
cargo:warning=libudis86/udis86.c(47,3): note: include the header <string.h> or explicitly provide a declaration for 'memset'
cargo:warning=1 error generated.
exit status: 1
I'm crosscompiling from alpine linux to windows msvc target using clang-cl, pretty much following this guide (I've adapted it to my CI workflow): https://jake-shadle.github.io/xwin/
This issue seems to be the exact same error I'm getting: https://github.com/rust-cross/cargo-xwin/issues/60
Right now my workaround is using this patch by placing this into my Cargo.toml
, it works:
[patch.crates-io]
libudis86-sys = { git = 'https://github.com/vars1ty/libudis86-sys.git' }
Ah, I see what's wrong. libudis86-sys
uses a flag -includestring.h
in the build.rs file. Problem is, clang expects --includestring.h
, so it's parsed correctly as an argument. The cc
crate probably adds the additional -
based on target or host machine, so cross compilation confuses it.
I'm going to start working on this issue. @LunNova If you've already began or plan on working on this let me know, and I'll let you finish it.
I have a branch, I'll push it after work tonight. It may have a safety issue because iced-x86's decoder needs a byte slice for the entire range of instructions you're going to decode, more details will be in the draft PR.
iced-x86 is a pure rust disassembler, udis relies on a c compiler.
If you're ok making this replacement I can try to PR it.