Skip to content

-Z lto requires system-level libraries to be writeable #13779

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

Closed
kornelski opened this issue Apr 26, 2014 · 3 comments
Closed

-Z lto requires system-level libraries to be writeable #13779

kornelski opened this issue Apr 26, 2014 · 3 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries

Comments

@kornelski
Copy link
Contributor

rustc -Z lto test.rs

error: ar d /var/folders/93/w4lcsnb97rgc2yvyltl1vt7r0000gp/T/rs-97669-0-rustc/libnative-83574243-0.11-pre.rlib native.o failed with: exit code: 1
note: stderr ---
ar: /var/folders/93/w4lcsnb97rgc2yvyltl1vt7r0000gp/T/rs-97669-0-rustc/libnative-83574243-0.11-pre.rlib: Permission denied

The permissions of folders are OK:

drwx------ 49 me me 1.6K Apr 26 15:29 /var/folders/93/w4lcsnb97rgc2yvyltl1vt7r0000gp/T
drwxr-xr-x 2 me me 68B Apr 26 15:23 /var/folders/93/w4lcsnb97rgc2yvyltl1vt7r0000gp/T/rs-97636-0-rustc/

The problem seems to be caused by /usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/lib*.rlib being read-only.

If I chmod a+w all *.rlib in /usr/local/, then -Z lto works.


rustc 0.11-pre, host: x86_64-apple-darwin

@kornelski kornelski changed the title ar d fails when using -Z lto on OS X -Z lto requires system-level libraries to be writeable Apr 26, 2014
@zr40
Copy link
Contributor

zr40 commented Apr 26, 2014

a+w permissions are broader than necessary. The rlibs only need to be writable by the file owner for LTO to succeed.

My theory is that when rustc copies the rlibs to a temporary directory, it does not set the appropriate permissions on the copy. Instead, the permissions of the original are used.

@pnkfelix pnkfelix added the A-linkage Area: linking into static, shared libraries and binaries label Jan 12, 2016
@sanxiyn
Copy link
Member

sanxiyn commented Mar 16, 2016

-Z lto changed to -C lto in #17421.

@Mark-Simulacrum
Copy link
Member

The original issue is quite old and I think I can't reproduce, but I'm not quite sure what files I specifically need to mark as read-only, so can't be certain. Going to close since I can't reproduce. Please reopen if this is still an issue.

bors added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2023
Add postfix completion for `unsafe`.

Fix rust-lang#13779.

Hi, this is my first PR. Please tell me if there is anything I should do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries
Projects
None yet
Development

No branches or pull requests

6 participants