Giter Club home page Giter Club logo

Comments (5)

calavera avatar calavera commented on May 25, 2024

Oh, nevermind, I thought this would solve the problems I'm seeing on Windows, but Rust is already using a response file for the arguments, and the linker is still failing:

,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "C:\\Users\\David\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-unknown-linux-gnu\\lib" "-o" "C:\\Users\\David\\src\\test\\target\\x86_64-unknown-linux-gnu\\debug\\deps\\test-6ca95f64dc56860f" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs"
  = note: warning: unsupported linker arg: -znoexecstack
          warning: unsupported linker arg: -zrelro
          warning: unsupported linker arg: -znow
          error(link): unable to spawn C:\Users\David\scoop\apps\zig\current\zig.exe: Unexpected
          error: UnableToSpawnSelf

          C:\Users\David\src\test>C:\Users\David\.cargo\bin\cargo-lambda.exe zig cc -- -target x86_64-linux-gnu -g -Wl,--version-script=C:\Users\David\AppData\Local\cargo-zigbuild\0.10.3\fcntl.map -include C:\Users\David\AppData\Local\cargo-zigbuild\0.10.3\fcntl.h @C:\Users\David\AppData\Local\Temp\rustcU4efEe\linker-arguments

😔

from cargo-zigbuild.

messense avatar messense commented on May 25, 2024

Unfortunately we will need to wait for a fix for ziglang/zig#10881

from cargo-zigbuild.

calavera avatar calavera commented on May 25, 2024

yeah, I thought there could be a way to work around that issue but it's tricky. I just wrote a workaround for cargo-lambda because in that case, it only happens in debug mode, and debug symbols are already useless on lambda, so I'm forcing windows builds to release mode until that gets sorted out.

from cargo-zigbuild.

calavera avatar calavera commented on May 25, 2024

I'm closing this since the issue is in upstream and there is no much we can do here.

from cargo-zigbuild.

Gankra avatar Gankra commented on May 25, 2024

Updating this with context/keywords (NameTooLong) for people hitting this in 2023. The issue now looks like:

   Compiling reqwest v0.11.18                                                                                                                                             
   Compiling axoasset v0.5.0
   Compiling cargo-dist v0.1.0 (C:\Users\ninte\dev\cargo-dist\cargo-dist)
error: linking with `C:\Users\ninte\AppData\Local\cargo-zigbuild\0.17.0\zigcc-aarch64-unknown-linux-gnu.bat` failed: exit code: 1
  |
  = note: "cmd" "/c" "C:\\Users\\ninte\\AppData\\Local\\cargo-zigbuild\\0.17.0\\zigcc-aarch64-unknown-linux-gnu.bat" "C:\\Users\\ninte\\AppData\\Local\\Temp\\rustcFXcXzF\
  ****** A MILLION ARGUMENTS OMITTED FOR BREVITY ******
  = note: error(link): unable to spawn C:\ProgramData\chocolatey\lib\zig\tools\zig-windows-x86_64-0.10.1\zig.exe: NameTooLong
          error: UnableToSpawnSelf

          C:\Users\ninte\dev\cargo-dist>C:\Users\ninte\.cargo\bin\cargo-zigbuild.exe zig cc -- -target aarch64-linux-gnu  -g -Wl,--version-script=C:\Users\ninte\AppData\Local\cargo-zigbuild\0.17.0\fcntl.map -include C:\Users\ninte\AppData\Local\cargo-zigbuild\0.17.0\fcntl.h @C:\Users\ninte\AppData\Local\Temp\rustcFXcXzF\linker-arguments  


error: could not compile `cargo-dist` (bin "cargo-dist") due to previous error

I think you can potentially partially mitigate this by setting codegen-units=1 in your build profile, as it can reduce the number of things that need to be linked (at the cost of slower builds).

Unfortunately this workaround doesn't help the hefty 356-package cargo-dist, as it still fails to build (without cgu=1 the invocation is over 180k chars and exceeds my terminal's backscroll, with cgu=1 it's "merely" 47k chars).

On the same machine, the slimmer example application of axolotlsay builds fine.

For context I'm running:

Microsoft Windows 11 Home 10.0.22621 Build 22621
powershell 5.1.22621.1778 (BuildVersion 10.0.22621.1778)
cargo 1.71.1 (7f1d04c00 2023-07-29)
cargo-zigbuild 0.17.0
zig 0.10.1

from cargo-zigbuild.

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.