Skip to content

MAKEFLAGS / MFLAGS env vars are set for nmake.exe which breaks it #4156

Closed
@Arnavion

Description

@Arnavion
Visual Studio 2017 Community Edition
rustc 1.19.0-nightly (3d5b8c626 2017-06-09)
cargo 0.20.0-nightly (bfe80cfa8 2017-06-07)

Running cargo install --force cargo-tree fails with:

error: failed to compile `cargo-tree v0.12.0`, intermediate artifacts can be found at `C:\Users\Arnavion\AppData\Local\Temp\cargo-install.47VUzEoolGS3`

Caused by:
  failed to run custom build command for `libz-sys v1.0.13`
process didn't exit successfully: `C:\Users\Arnavion\AppData\Local\Temp\cargo-install.47VUzEoolGS3\release\build\libz-sys-a0376854548c6a52\build-script-build` (exit code: 101)
--- stdout
running: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.10.25017\\bin\\HostX64\\x64\\nmake.exe" "/nologo" "/f" "C:\\Users\\Arnavion\\AppData\\Local\\Temp\\cargo-install.47VUzEoolGS3\\release\\build\\libz-sys-0598af38eaebd697\\out\\build/win32/Makefile.msc" "zlib.lib"

--- stderr

Microsoft (R) Program Maintenance Utility Version 14.10.25019.0
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1065: invalid option '-'
Stop.

The reason is that cargo sets the following env vars when invoking libz-sys's build-script-build.exe

MAKEFLAGS="--jobserver-fds=__rust_jobserver_semaphore_3996332434 --jobserver-auth=__rust_jobserver_semaphore_3996332434"
MFLAGS="--jobserver-fds=__rust_jobserver_semaphore_3996332434 --jobserver-auth=__rust_jobserver_semaphore_3996332434"

which nmake doesn't understand.

I can repro manually by setting up the environment as cargo sets it and running build-script-build.exe, and if I remove those two env vars then build-script-build.exe runs successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions