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

build-wheel sets _PYTHON_HOST_PLATFORM with incorrect format #1141

Closed
hongpingwei opened this issue Apr 21, 2024 · 5 comments · Fixed by #1261
Closed

build-wheel sets _PYTHON_HOST_PLATFORM with incorrect format #1141

hongpingwei opened this issue Apr 21, 2024 · 5 comments · Fixed by #1261

Comments

@hongpingwei
Copy link

hongpingwei commented Apr 21, 2024

/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --crate-name cryptography_rust --edition=2021 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=233 --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="extension-module"' -C metadata=6a2eca71f96f7f26 --out-dir /root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps -C strip=debuginfo -L dependency=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps --extern asn1=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libasn1-3cbd8c400f93aebb.rlib --extern cfg_if=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcfg_if-aaad75c953799a78.rlib --extern cryptography_cffi=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcryptography_cffi-f6d1f53d4b4eba67.rlib --extern cryptography_key_parsing=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcryptography_key_parsing-bf3a06dc4569f3b6.rlib --extern cryptography_openssl=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcryptography_openssl-7ea2495f600dab58.rlib --extern cryptography_x509=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcryptography_x509-dcfd9e64a59670f0.rlib --extern cryptography_x509_verification=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libcryptography_x509_verification-b4fcd3ced752b1c7.rlib --extern foreign_types_shared=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libforeign_types_shared-b4c802ac253d35ff.rlib --extern once_cell=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libonce_cell-92ab50a58aad97d5.rlib --extern openssl=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libopenssl-a842c4610fd1f319.rlib --extern openssl_sys=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libopenssl_sys-194f651fc41ddae3.rlib --extern pem=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libpem-c4abfd424caba6e8.rlib --extern pyo3=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libpyo3-8f6b6dac58ebb9e5.rlib --extern self_cell=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/deps/libself_cell-a6952d443b37ada8.rlib -L native=/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/src/src/rust/target/release/build/cryptography-cffi-7a83c08114839c33/out -L native=/usr/local/openssl/lib --cfg 'CRYPTOGRAPHY_OSSLCONF="OPENSSL_NO_SSL3_METHOD"'`
warning: unused import: `crate::error::CryptographyResult`
 --> src/lib.rs:7:5
  |
7 | use crate::error::CryptographyResult;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `std::env`
  --> src/lib.rs:10:5
   |
10 | use std::env;
   |     ^^^^^^^^

warning: unused variable: `cipher_name`
   --> src/backend/aead.rs:548:13
    |
548 |         let cipher_name = match key.as_bytes().len() {
    |             ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_cipher_name`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: `cryptography-rust` (lib) generated 3 warnings (run `cargo fix --lib -p cryptography-rust` to apply 3 suggestions)
    Finished release [optimized] target(s) in 35.28s
Traceback (most recent call last):
  File "/root/miniconda3/envs/build-wheel/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/root/miniconda3/envs/build-wheel/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/root/miniconda3/envs/build-wheel/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
    return _build_backend().build_wheel(wheel_directory, config_settings,
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/build_meta.py", line 410, in build_wheel
    return self._build_with_temp_dir(
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
    self.run_setup()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
    return distutils.core.setup(**attrs)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 184, in setup
    return run_commands(dist)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
    dist.run_commands()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
    super().run_command(command)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 368, in run
    self.run_command("build")
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
    super().run_command(command)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 132, in run
    self.run_command(cmd_name)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
    self.distribution.run_command(command)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/dist.py", line 967, in run_command
    super().run_command(command)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/setuptools_ext.py", line 160, in run
    super().run()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/setuptools_ext.py", line 168, in run
    build_rust.run()
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/command.py", line 100, in run
    self.run_for_extension(ext)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/build.py", line 137, in run_for_extension
    self.install_extension(ext, dylib_paths)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/build.py", line 373, in install_extension
    ext_path = self.get_dylib_ext_path(ext, module_name)
  File "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/build.py", line 460, in get_dylib_ext_path
    host_arch = host_platform.rsplit("-", 1)[1]
IndexError: list index out of range
build-wheel: Error: Backend subprocess exited when trying to invoke build_wheel
(build-wheel) [root@ecs-weichain pypi]# IndexError: list index out of range
@mhsmith
Copy link
Member

mhsmith commented Apr 23, 2024

Sorry, I don't have time to help building Rust-based packages at the moment. But there are some pre-built wheels for Cryptography 39 linked from #657 (comment). I haven't tested these wheels myself, so you should only use them for sensitive work if you trust @emanuele-f.

When creating issues in the future, please provide more context , including:

  • What you're trying to achieve
  • What command you ran
  • The content of the recipe you're using

@mhsmith mhsmith closed this as completed Apr 23, 2024
@vmitro
Copy link

vmitro commented Apr 23, 2024

Sorry for commenting on a closed issue, but I think I know what's wrong here. The rsplit('-') method in "/root/chaquopy/server/pypi/packages/cryptography/build/42.0.5/cp310-cp310-android_21_arm64_v8a/env/lib/python3.10/site-packages/setuptools_rust/build.py returns the whole string when called on host_platform.

You can use an ugly hack, change the file in question at line 460 to rsplit('_') - that is, underscore instead of a dash. It should work then.

P.S. run the build wheel command with --no-unpack to preserve the change.

@mhsmith mhsmith changed the title host_arch = host_platform.rsplit("-", 1)[1] IndexError: list index out of range build-wheel sets _PYTHON_HOST_PLATFORM with incorrect format Apr 23, 2024
@mhsmith
Copy link
Member

mhsmith commented Apr 23, 2024

Thanks very much – this looks like the same problem as #607 (comment): build-wheel's override of _PYTHON_HOST_PLATFORM should use a dash rather than an underscore.

@mhsmith mhsmith reopened this Apr 23, 2024
@vmitro
Copy link

vmitro commented Apr 27, 2024

No problem. Is just changing the way platform string is being composed going to break the existing build scripts?

@mhsmith
Copy link
Member

mhsmith commented Apr 27, 2024

I don't think so, but as I said in the other comment, you might get a clearer answer by finding when the variable was added in the Git history.

emanuele-f added a commit to emanuele-f/chaquopy that referenced this issue Oct 9, 2024
setuptools_rust/build.py", line 470, in get_dylib_ext_path
host_arch = host_platform.rsplit("-", 1)[1]
IndexError: list index out of range

Closes chaquo#1141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants