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

Reading rlib on macOS #6

Closed
RazrFalcon opened this issue Jan 15, 2018 · 7 comments
Closed

Reading rlib on macOS #6

RazrFalcon opened this issue Jan 15, 2018 · 7 comments

Comments

@RazrFalcon
Copy link

I'm using ar to read rust libraries (.rlib). Under Linux everything is fine, but I got an error under macOS:

Error { repr: Custom(Custom { kind: InvalidData, error: StringError("Invalid file size field in entry header (\"    644   \")") }) }

Is it possible to read rlib?

@mdsteele
Copy link
Owner

Hmm, that's odd. I just tried it on a couple .rlib files generated on my OS X machine, and it worked fine. Can you attach an example of an .rlib file that doesn't work?

@RazrFalcon
Copy link
Author

I got this error on any rlib from macOS.

libatty.zip

@mdsteele
Copy link
Owner

Thanks for the file. Strangely, running cargo run --example extract -- libatty-d1be7f28c1fcb94e.rlib still works fine for me, though. Does that command give an error for you?

What version of the ar crate are you using? Also, what version of rustc?

@RazrFalcon
Copy link
Author

RazrFalcon commented Jan 21, 2018

I'm using 0.5 tag archive and run the rlib trough the symbols example.

The extract example works fine.

@mdsteele
Copy link
Owner

Ah, thanks! I'm able to reproduce the issue now.

I'll take a look and try to figure out what's going wrong.

@mdsteele
Copy link
Owner

Okay, the error should be fixed by commit e593551 -- I'm now able to run that .rlib through the symbols example without getting an error, and also now there are some new regression tests for that bug.

Separately, however, there's the issue that the library doesn't yet support reading symbol tables from BSD-variant archives (which is the format variant typically used by Mac, as opposed to the GNU variant typically used by Linux), so although the symbols example shouldn't crash anymore, it'll just give you an empty list of symbols, which isn't very helpful.

I'll see about getting BSD-variant symbol table support added.

@mdsteele
Copy link
Owner

Just pushed commit d43c201, which adds initial support for reading BSD-variant symbol tables. The symbols example should hopefully now give useful output for .rlib files on Mac.

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

2 participants