Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-C rpath generates bad options for paths with commas #38795

Closed
jsgf opened this issue Jan 3, 2017 · 1 comment
Closed

-C rpath generates bad options for paths with commas #38795

jsgf opened this issue Jan 3, 2017 · 1 comment

Comments

@jsgf
Copy link
Contributor

jsgf commented Jan 3, 2017

-C rpath generates linker options of the form -Wl,-rpath,<path>. This fails if <path> contains commas, because -Wl, separates options on commas, so the linker ends up getting a bad path and spurious extra parameters.

The solution is to use -Xlinker which passes the next option through literally, so the full rpath can be specified with -Wl,-rpath -Xlinker <path,with,commas>. The -Xlinker form is fairly verbose, and only needed when there are commas.

(This comes up when building with Buck, because it generates paths of the form base/path/file.o#flavor1,flavor2 where "flavors" are things like "shared", "static", "pic", etc.)

jsgf added a commit to jsgf/rust that referenced this issue Jan 3, 2017
The `-Wl` option splits its parameters on commas, so if rustc specifies
`-Wl,-rpath,<path>` when `<path>` contains commas, the path gets split up
and the linker gets a partial path and spurious extra parameters.

Gcc/clang support the more verbose `-Xlinker` option to pass options
to the linker directly, so use it for comma-containing paths.

Fixes rust issue rust-lang#38795.
bors added a commit that referenced this issue Jan 8, 2017
rustc: use -Xlinker when specifying an rpath with ',' in it

The `-Wl` option splits its parameters on commas, so if rustc specifies
`-Wl,-rpath,<path>` when `<path>` contains commas, the path gets split up
and the linker gets a partial path and spurious extra parameters.

Gcc/clang support the more verbose `-Xlinker` option to pass options to the linker directly, so use it for comma-containing paths.

Fixes issue #38795.
frewsxcv pushed a commit to frewsxcv/rust that referenced this issue Jan 9, 2017
The `-Wl` option splits its parameters on commas, so if rustc specifies
`-Wl,-rpath,<path>` when `<path>` contains commas, the path gets split up
and the linker gets a partial path and spurious extra parameters.

Gcc/clang support the more verbose `-Xlinker` option to pass options
to the linker directly, so use it for comma-containing paths.

Fixes rust issue rust-lang#38795.
@jsgf
Copy link
Contributor Author

jsgf commented Apr 10, 2017

Fixed in 1.16

@jsgf jsgf closed this as completed Apr 10, 2017
eric-wieser added a commit to eric-wieser/numpy that referenced this issue Jan 31, 2019
After the recent patch to CCompiler.spawn, the file-paths no longer need manual quoting - that's handled as needed within subprocess.

This also states our assumption that our paths do not contain commas.
If we care about this, we could adopt the approach used by rust-lang/rust#38795.

Tested for gcc locally by looking at the error messages of `subprocess.check_call(["gcc", r'-Wl,spaces and no quotes'])`

Other fortran compiler changes not tested, but assumed to be broken in the same way.

Fixes numpy#12882
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant