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

Could not cross-compile to Windows from ubuntu #19

Closed
sztomi opened this issue Mar 30, 2022 · 2 comments · Fixed by #23
Closed

Could not cross-compile to Windows from ubuntu #19

sztomi opened this issue Mar 30, 2022 · 2 comments · Fixed by #23
Labels
help wanted Extra attention is needed

Comments

@sztomi
Copy link
Contributor

sztomi commented Mar 30, 2022

# sudo apt install gcc-mingw-w64-x86-64-posix 
rustup target add x86_64-pc-windows-gnu
cargo build --release --target=x86_64-pc-windows-gnu

Yields

   Compiling jemallocator v0.3.2
     Running `rustc --crate-name jemallocator /home/tamas/.cargo/registry/src/github.com-1ecc6299db9ec823/jemallocator-0.3.2/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="background_threads_runtime_support"' --cfg 'feature="default"' -C metadata=c1aa0409bbfdcf4d -C extra-filename=-c1aa0409bbfdcf4d --out-dir /home/tamas/src/n2/target/x86_64-pc-windows-gnu/debug/deps --target x86_64-pc-windows-gnu -L dependency=/home/tamas/src/n2/target/x86_64-pc-windows-gnu/debug/deps -L dependency=/home/tamas/src/n2/target/debug/deps --extern jemalloc_sys=/home/tamas/src/n2/target/x86_64-pc-windows-gnu/debug/deps/libjemalloc_sys-f9a3d890e565352c.rmeta --extern libc=/home/tamas/src/n2/target/x86_64-pc-windows-gnu/debug/deps/liblibc-d6282ed627c45757.rmeta --cap-lints allow -L native=/home/tamas/src/n2/target/x86_64-pc-windows-gnu/debug/build/jemalloc-sys-caac9a3b2c7387ed/out/build/lib`
error: could not find native static library `jemalloc`, perhaps an -L flag is missing?

error: could not compile `jemalloc-sys` due to previous error

It looks like this is an issue with the jemallocator crate. The crate does seem to build all the way but perhaps the linker path is not set correctly when linking to the C library.

I don't really know if this is easily solvable on the n2 side (apart from switching to a different allocator).

gnzlbg/jemallocator#165
gnzlbg/jemallocator#153

@evmar evmar added the help wanted Extra attention is needed label Mar 30, 2022
@evmar
Copy link
Owner

evmar commented Mar 30, 2022

I don't really understand this area of Rust builds, so if anyone else would like to figure this out I welcome it.

I had introduced jemalloc earlier because it was a big performance win, but since then I have been a bit more careful about memory allocation so it's possible it's not as important anymore.

@evmar
Copy link
Owner

evmar commented Mar 31, 2022

I think the intent of this code (which is copy-pasted from the jemalloc instructions) is to not use jemalloc on Windows, so maybe that logic just needs to be adjusted to cover this case.

sztomi added a commit to sztomi/n2 that referenced this issue Apr 1, 2022
sztomi added a commit to sztomi/n2 that referenced this issue Apr 1, 2022
@evmar evmar closed this as completed in #23 Apr 2, 2022
evmar pushed a commit that referenced this issue Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants