Giter VIP home page Giter VIP logo

Comments (9)

tgross35 avatar tgross35 commented on July 26, 2024

Do you know the most recent version this worked with, was it 1.78? And can you test with nightly?

Per the docs you will need to build with -Z build-std, but the compiler forbidding the target is weird https://doc.rust-lang.org/beta/rustc/platform-support/win7-windows-msvc.html. Unless maybe we only enable it for nightly.

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

Cc @roblabla who is listed as the target maintainer, if you know anything more.

from rust.

linuxlin365 avatar linuxlin365 commented on July 26, 2024

您知道最新版本是否适用吗?是 1.78 吗?您可以使用 Nightly 进行测试吗?

根据文档,您需要使用 进行构建-Z build-std,但编译器禁止目标很奇怪https://doc.rust-lang.org/beta/rustc/platform-support/win7-windows-msvc.html。除非我们只在夜间启用它。

@tgross35 Use x86 64-win7-windows-msvc only at night, right?

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

I think maybe. Could you try the following?

rustup update nightly

# Only need one of these, but I don't know which one will work
cargo +nightly build --target x86_64-win7-windows-msvc
cargo +nightly build --target x86_64-win7-windows-msvc -Zbuild-std

The cargo command might tell you to run a rustup command, do that if it asks.

from rust.

linuxlin365 avatar linuxlin365 commented on July 26, 2024
rustup update nightly

# Only need one of these, but I don't know which one will work
cargo +nightly build --target x86_64-win7-windows-msvc
cargo +nightly build --target x86_64-win7-windows-msvc -Zbuild-std

I tried to run the command you said

cargo +nightly build --target x86_64-win7-windows-msvc --release

warning: `C:\Users\GL\.cargo\config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
    Blocking waiting for file lock on package cache
    Updating `aliyun` index
  Downloaded memoffset v0.8.0 (registry `aliyun`)
  Downloaded stable_deref_trait v1.2.0 (registry `aliyun`)
  Downloaded universal-hash v0.5.1 (registry `aliyun`)
  Downloaded poly1305 v0.8.0 (registry `aliyun`)
  Downloaded untrusted v0.9.0 (registry `aliyun`)
  Downloaded pyo3-asyncio v0.18.0 (registry `aliyun`)
  Downloaded lazy_static v1.4.0 (registry `aliyun`)
  Downloaded semver v1.0.18 (registry `aliyun`)
  Downloaded thiserror v1.0.43 (registry `aliyun`)
  Downloaded smoltcp v0.10.0 (registry `aliyun`)
  Downloaded serde v1.0.171 (registry `aliyun`)
  Downloaded tracing v0.1.37 (registry `aliyun`)
  Downloaded heapless v0.7.16 (registry `aliyun`)
  Downloaded flume v0.10.14 (registry `aliyun`)
  Downloaded serde_derive v1.0.171 (registry `aliyun`)
  Downloaded rayon v1.7.0 (registry `aliyun`)
  Downloaded qoi v0.4.1 (registry `aliyun`)
  Downloaded petgraph v0.6.3 (registry `aliyun`)
  Downloaded futures-util v0.3.28 (registry `aliyun`)
  Downloaded miniz_oxide v0.7.1 (registry `aliyun`)
  Downloaded flate2 v1.0.26 (registry `aliyun`)
  Downloaded syn v2.0.26 (registry `aliyun`)
  Downloaded regex v1.9.1 (registry `aliyun`)
  Downloaded pyo3 v0.18.3 (registry `aliyun`)
  Downloaded parking_lot_core v0.9.8 (registry `aliyun`)
  Downloaded tempfile v3.6.0 (registry `aliyun`)
  Downloaded smallvec v1.11.0 (registry `aliyun`)
  Downloaded pyo3-build-config v0.18.3 (registry `aliyun`)
  Downloaded pin-project-internal v1.1.2 (registry `aliyun`)
  Downloaded defmt v0.3.5 (registry `aliyun`)
  Downloaded data-encoding v2.4.0 (registry `aliyun`)
  Downloaded tiff v0.8.1 (registry `aliyun`)
  Downloaded num-integer v0.1.45 (registry `aliyun`)
  Downloaded regex-automata v0.3.3 (registry `aliyun`)
  Downloaded itertools v0.10.5 (registry `aliyun`)
  Downloaded cfg-if v1.0.0 (registry `aliyun`)
  Downloaded untrusted v0.7.1 (registry `aliyun`)
  Downloaded unindent v0.1.11 (registry `aliyun`)
  Downloaded typenum v1.16.0 (registry `aliyun`)
  Downloaded libc v0.2.147 (registry `aliyun`)
  Downloaded thiserror-impl v1.0.43 (registry `aliyun`)
  Downloaded rustc-demangle v0.1.23 (registry `aliyun`)
  Downloaded prost-build v0.11.9 (registry `aliyun`)
  Downloaded pin-project-lite v0.2.10 (registry `aliyun`)
  Downloaded object v0.31.1 (registry `aliyun`)
  Downloaded opaque-debug v0.3.0 (registry `aliyun`)
  Downloaded num-rational v0.4.1 (registry `aliyun`)
  Downloaded multimap v0.8.3 (registry `aliyun`)
  Downloaded winapi v0.3.9 (registry `aliyun`)
  Downloaded 49 crates (7.2 MB) in 15.88s (largest was `tiff` at 1.4 MB)
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.66
   Compiling unicode-ident v1.0.11
   Compiling cfg-if v1.0.0
   Compiling windows_x86_64_msvc v0.48.0
   Compiling scopeguard v1.2.0
   Compiling libc v0.2.147
   Compiling version_check v0.9.4
   Compiling typenum v1.16.0
   Compiling syn v1.0.109
   Compiling simd-adler32 v0.3.5
   Compiling once_cell v1.18.0
error[E0463]: can't find crate for `core`
  |
  = note: the `x86_64-win7-windows-msvc` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-win7-windows-msvc`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-win7-windows-msvc` target may not be installed
  = help: consider downloading the target with `rustup target add x86_64-win7-windows-msvc`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

error: could not compile `simd-adler32` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `scopeguard` (lib) due to 1 previous error
error: could not compile `cfg-if` (lib) due to 1 previous error



rustup target add x86_64-win7-windows-msvc

error: toolchain 'nightly-x86_64-pc-windows-msvc' does not support target 'x86_64-win7-windows-msvc'
note: you can see a list of supported targets with `rustc --print=target-list`
note: if you are adding support for a new target to rustc itself, see https://rustc-dev-guide.rust-lang.org/building/new-target.html

The compilation succeeded, but the linking failed:

cargo +nightly build --target x86_64-win7-windows-msvc -Zbuild-std --release

   Compiling pyo3-asyncio v0.18.0
error: linking with `link.exe` failed: exit code: 1181
  |
  = note: "D:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\link.exe" "/DEF:C:\\Users\\GL\\AppData\\Local\\Temp\\rustc1w6Mnw\\lib.def" "/NOLOGO" "C:\\Users\\GL\\AppData\\Local\\Temp\\rustc1w6Mnw\\symbols.o" "D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\deps\\mitmproxy_rs.mitmproxy_rs.a05f9abf469ef553-cgu.0.rcgu.o" "/LIBPATH:D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\deps" "/LIBPATH:D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\release\\deps" "/LIBPATH:D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\build\\ring-35f8b0ce549f7d6d\\out" "/LIBPATH:C:\\Users\\GL\\AppData\\Local\\Programs\\Python\\Python311\\libs" "/LIBPATH:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-win7-windows-msvc\\lib" "C:\\Users\\GL\\AppData\\Local\\Temp\\rustc1w6Mnw\\libring-8f3c9fe5a7f78c50.rlib" "D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\deps\\libcompiler_builtins-043e6885e8ec3f1f.rlib" "bcrypt.lib" "advapi32.lib" "windows.0.48.0.lib" "advapi32.lib" "cfgmgr32.lib" "credui.lib" "fwpuclnt.lib" "kernel32.lib" "ntdll.lib" "secur32.lib" "user32.lib" "ws2_32.lib" "ntdll.lib" "windows.0.48.0.lib" "kernel32.lib" "windows.0.48.0.lib" "python3.lib" "legacy_stdio_definitions.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-win7-windows-msvc\\lib" "/OUT:D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\deps\\mitmproxy_rs.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:D:\\code\\py\\mitmproxy_rs-0.2.2\\target\\x86_64-win7-windows-msvc\\release\\deps\\mitmproxy_rs.dll.lib" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\GL\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: LINK : fatal error LNK1181: 无法打开输入文件“windows.0.48.0.lib”␍


from rust.

tgross35 avatar tgross35 commented on July 26, 2024

Ok, the second result is more like what is expected. However, I have no clue whether or not Microsoft's more recent link.exe is supposed to work for windows 7 targets. Maybe you can try following the cross compilation steps at https://doc.rust-lang.org/beta/rustc/platform-support/win7-windows-msvc.html#cross-compilation-toolchains-and-c-code?

from rust.

linuxlin365 avatar linuxlin365 commented on July 26, 2024

@tgross35 thank you

I have successfully compiled and linked but it won't work under Windows 7

image

image

IsProcessCritical Function Minimum support Windows 8.1
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocesscritical

I don't quite understand the reason for the rust compiler, will I not be able to run in win7 after I set the win7 target?

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

Windows 7 reached its EOL in 2020 and its end of extended support in early 2023. After that happened, it was demoted to a tier3 target.

Tier3 means that the Rust compiler knows about it, but it is not really officially supported. Meaning it is not tested in CI, and things may break. Fixes are always welcome from anyone who uses the target, it's just unlikely that anybody who doesn't use windows 7 will pick it up.

Some more info: https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3.

I don't know what the fix is here, but if you figure out exactly where the requirement for IsProcessCritical comes from, it might be possible to fix. (Doesn't seem to be mentioned in the Rust codebase).

from rust.

tgross35 avatar tgross35 commented on July 26, 2024

Hm actually - could you try compiling a simple Hello World with no dependencies? Maybe only one of the deps needs it but std doesn't.

from rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.