Skip to content

problems with -C link-args that have arguments with spaces #45

@japaric

Description

@japaric

If you use something like this:

[ build]
rustflags = [
  "-C",
  "link-args=-Tlayout.ld -nostartfiles"
]

in your .cargo/config, the executable with fail to link because three arguments will be passed to rustc: -C, -link-args=-Tlayout.ld and -nostartfiles. This a problem with Xargo because it uses RUSTFLAGS to pass these (and --sysroot) as a string to Cargo and then Cargo parses RUSTFLAGS by splitting it at whitespaces.

There is no real solution for this other than to use -C link-arg (rust-lang/rust#36574) multiple times instead of -C link-args.

Once that PR lands in rust-lang/rust, let's have Cargo print a warning about this problem and also suggest using -C link-arg instead of -C link-args.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions