mimalloc_rust icon indicating copy to clipboard operation
mimalloc_rust copied to clipboard

Building with `cargo-xwin` fails to link: `lld-link: error: undefined symbol: __movsb`

Open s1341 opened this issue 2 years ago • 7 comments

When trying to build for windows on a linux host, mimalloc fails to link with the following error:

  = note: lld-link: error: undefined symbol: __movsb
          >>> referenced by /src/mimalloc_rust/libmimalloc-sys/c_src/mimalloc/include/mimalloc/internal.h:926
          >>>               liblibmimalloc_sys-087f9fdc909808e0.rlib(static.o):(_mi_memcpy)

I'm using cargo-xwin to cross compile.

s1341 avatar Oct 09 '23 05:10 s1341

I could successfully build with below command in ubuntu for msvc,

rustup component add llvm-tools-preview
rustup target add x86_64-pc-windows-msvc
rustup update

cargo xwin check --target x86_64-pc-windows-msvc --xwin-arch x86_64 --xwin-version 17 --tests
// you can run `build` instead of `check`

namse avatar Mar 27 '24 17:03 namse

I'm still getting an error, using clang/lld-link 17 and rustc 1.77.1

s1341 avatar Apr 02 '24 12:04 s1341

Could you show me the command you tried? Are you sure the same command with my suggestion?

namse avatar Apr 02 '24 15:04 namse

Here is my command:

cargo xwin build  --target x86_64-pc-windows-msvc --release --xwin-version 17 --xwin-arch x86_64

Note that I am building a project which relies on mimalloc, not mimalloc directly.

s1341 avatar Apr 03 '24 04:04 s1341

If your project is open source, may I check it directly? or would you make a minimal reproducible example?

namse avatar Apr 08 '24 05:04 namse

https://github.com/AFLplusplus/LibAFL/pull/1607 build fuzzers/frida_gdiplus with cargo xwin. Make sure to switch from dlmalloc to mimalloc in fuzzers/frida_gdiplus/src/lib.rs....

s1341 avatar May 12 '24 07:05 s1341

It has been merged to main, so it should be easier to check now.

s1341 avatar May 15 '24 04:05 s1341