-C link-args and -C llvm-args can't pass arguments with spaces

9facc57
Opened by Zoxc at 2025-03-01 11:59:23

The arguments passed in -C link-args and -C llvm-args is split by spaces making it impossible to pass along paths with spaces in them.

  1. Quoth he. ;)

    Taylor Trump at 2016-01-16 03:55:02

  2. Yes, you need quotes.

    Steve Klabnik at 2016-01-26 15:38:53

  3. What kind of quotes? Also that should be documented somewhere

    Zoxc at 2016-01-26 15:56:30

  4. Ah this is actually an issue about if you want to pass the argument "foo bar" down to the linker you can't do that, for example rustc -C link-args="foo bar" will pass two arguments down to the linker, first foo then bar.

    I'm going to reopen this for now, but there may not be a whole lot we can do here, as inventing our own syntax for escaping spaces is both onerous and unfortunately backwards incompatible.

    Alex Crichton at 2016-01-26 15:58:13

  5. This is also an issue when using the MSVC linker and passing /manifestdependency flags which always contain spaces such as (for example):

    /manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'

    This is currently impossible.

    l0calh05t at 2016-02-19 21:08:31

  6. ~~Could we accept multiple occurrences of -C link-args=... and then accumulate them all into one space-separated collection of arguments?~~

    (oops, I misunderstood the problem that @alexcrichton described; my suggestion won't address that.)

    Felix S Klock II at 2016-04-28 11:33:59

  7. Triage: I agree with @alexcrichton , I'm not sure what we can do here :(

    Steve Klabnik at 2018-10-31 16:32:41

  8. Switch to -Clink-arg and -Cllvm-arg which take only a single argument which can contain spaces. If they don't exist then they need to be implemented.

    Peter Atashian at 2018-11-01 05:55:38

  9. @retep998 Seems like -Cllvm-arg has dissapeared? Only -Cllvm-args exists which has the space issue (in my case I am looking to omit frame pointers with --frame-pointer none)

    Scott Mabin at 2019-08-26 12:13:17

  10. It didn't disappear. It simply never existed in the first place and still needs to be implemented.

    Peter Atashian at 2019-08-28 06:15:50