Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Unable to compile windows wheel with zstd as dependency #2058

Closed
1 of 2 tasks
Owen-CH-Leung opened this issue Apr 25, 2024 · 0 comments
Closed
1 of 2 tasks

Unable to compile windows wheel with zstd as dependency #2058

Owen-CH-Leung opened this issue Apr 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Owen-CH-Leung
Copy link
Contributor

Bug Description

When zstd exists as part of the project dependency, the command maturin build --profile dev --target x86_64-pc-windows-msvc will fail with the following warnings and error:

The following warnings were emitted during compilation:

warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-Brepro'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '--target=x86_64-pc-windows-msvc'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-fuse-ld=lld-link'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-fvisibility=hidden'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: no such file or directory: '/imsvc/root/.cache/cargo-xwin/xwin/crt/include'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: no such file or directory: '/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/ucrt'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: no such file or directory: '/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/um'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: no such file or directory: '/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/shared'

--- stderr


  error occurred: Command "clang-cl" "-nologo" "-MD" "-Z7" "-Brepro" "-m64" "--target=x86_64-pc-windows-msvc" "-Wno-unused-command-line-argument" "-fuse-ld=lld-link" "/imsvc/root/.cache/cargo-xwin/xwin/crt/include" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/ucrt" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/um" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/shared" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DZSTD_DISABLE_ASM=" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-Fo/io/target/x86_64-pc-windows-msvc/debug/build/zstd-sys-96a2e3968fd14727/out/zstd/lib/legacy/zstd_v07.o" "-c" "--" "zstd/lib/legacy/zstd_v07.c" with args "clang-cl" did not execute successfully (status code exit status: 1).

it's incorrectly looking for files at /imsvc/root/.cache/cargo-xwin/, where the correct path should be /root/.cache/cargo-xwin/.

However, even after fixing the path by mkdir -p /imsvc/root/.cache && cp -r /root/.cache/cargo-xwin/ /imsvc/root/.cache/, the following warnings & errors comes out:

warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-Brepro'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '--target=x86_64-pc-windows-msvc'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-fuse-ld=lld-link'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: unknown argument: '-fvisibility=hidden'
warning: zstd-sys@2.0.10+zstd.1.5.6: clang: error: cannot specify '-Fo/io/target/x86_64-pc-windows-msvc/debug/build/zstd-sys-96a2e3968fd14727/out/zstd/lib/common/debug.o' when compiling multiple source files

exit status: 1
  cargo:warning=ToolExecError: Command "clang-cl" "-nologo" "-MD" "-Z7" "-Brepro" "-m64" "--target=x86_64-pc-windows-msvc" "-Wno-unused-command-line-argument" "-fuse-ld=lld-link" "/imsvc/root/.cache/cargo-xwin/xwin/crt/include" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/ucrt" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/um" "/imsvc/root/.cache/cargo-xwin/xwin/sdk/include/shared" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DZSTD_DISABLE_ASM=" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-Fo/io/target/x86_64-pc-windows-msvc/debug/build/zstd-sys-96a2e3968fd14727/out/zstd/lib/legacy/zstd_v03.o" "-c" "--" "zstd/lib/legacy/zstd_v03.c" with args "clang-cl" did not execute successfully (status code exit status: 1).

Clearly, the compilation of the zstd source code failed.

Your maturin version (maturin --version)

0.15.1

Your Python version (python -V)

3.8.18

Your pip version (pip -V)

24.0

What bindings you're using

None

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. On a brand new project folder, create Cargo.toml with just zstd as dependency
[dependencies]
zstd = "*"
  1. create src/main.rs, and put the following into the main function:
fn main() {
    println!("{}", zstd::DEFAULT_COMPRESSION_LEVEL);
}
  1. run a docker container using maturin:v1.5.1 image. docker run -it --rm -v $(pwd):/io --entrypoint /bin/bash ghcr.io/pyo3/maturin:v1.5.1

  2. Inside the terminal, run rustup target add x86_64-pc-windows-msvc, and then yum install clang

  3. Run maturin build --profile dev --target x86_64-pc-windows-msvc. Then you will see the warnings and error I've posted

@Owen-CH-Leung Owen-CH-Leung added the bug Something isn't working label Apr 25, 2024
@PyO3 PyO3 locked and limited conversation to collaborators Apr 25, 2024
@messense messense converted this issue into discussion #2059 Apr 25, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant