Skip to content

Compiling rust on OSX fails with Assertion failed: ((unsigned)Val < Attribute::EndAttrKinds && "Attribute out of range!") #10907

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
xasmx opened this issue Dec 10, 2013 · 5 comments
Labels
O-macos Operating system: macOS

Comments

@xasmx
Copy link

xasmx commented Dec 10, 2013

Trying to compile latest rust (fresh clone from git) from master (487e58c) on OS X 10.8.5.

$ ./configure
...
$ make
...
compile_and_link: x86_64-apple-darwin/stage0/lib/rustc/x86_64-apple-darwin/bin/rustc
cp: x86_64-apple-darwin/stage1/lib/librustrt.a
cp: x86_64-apple-darwin/stage1/lib/libstd.dylib
cp: x86_64-apple-darwin/stage1/lib/libextra.dylib
cp: x86_64-apple-darwin/stage1/lib/librustuv.dylib
cp: x86_64-apple-darwin/stage1/lib/libsyntax.dylib
cp: x86_64-apple-darwin/stage1/lib/librustc.dylib
cp: x86_64-apple-darwin/stage1/bin/rustc
compile: x86_64-apple-darwin/rt/stage1/rust_cxx_glue.o
compile: x86_64-apple-darwin/rt/stage1/rust_builtin.o
compile: x86_64-apple-darwin/rt/stage1/rust_upcall.o
compile: x86_64-apple-darwin/rt/stage1/miniz.o
compile: x86_64-apple-darwin/rt/stage1/rust_android_dummy.o
compile: x86_64-apple-darwin/rt/stage1/rust_test_helpers.o
compile: x86_64-apple-darwin/rt/stage1/arch/x86_64/_context.o
compile: x86_64-apple-darwin/rt/stage1/arch/x86_64/record_sp.o
link: x86_64-apple-darwin/rt/stage1/librustrt.a
/opt/local/bin/ranlib: file: x86_64-apple-darwin/rt/stage1/librustrt.a(rust_android_dummy.o) has no symbols
/opt/local/bin/ranlib: file: x86_64-apple-darwin/rt/stage1/librustrt.a(record_sp.o) has no symbols
cp: x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/librustrt.a
compile: x86_64-apple-darwin/rt/stage1/arch/x86_64/morestack.o
link: x86_64-apple-darwin/rt/stage1/arch/x86_64/libmorestack.a
cp: x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libmorestack.a
compile_and_link: x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libstd.dylib
error: ar r x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libstd-6425b930ca146ae9-0.9-pre.rlib x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/std.bc failed with: exit code: 1
note: stdout ---

note: stderr ---
Assertion failed: ((unsigned)Val < Attribute::EndAttrKinds && "Attribute out of range!"), function addAttribute, file Attributes.cpp, line 948.
ar: fatal error in /opt/local/bin/ranlib

error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /Users/sami/dev/rust/src/libsyntax/diagnostic.rs:102
task '

' failed at 'explicit failure', /Users/sami/dev/rust/src/librustc/lib.rs:394
make: *** [x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libstd.dylib] Error 101

@alexcrichton
Copy link
Member

You see the failed command there:

ar r x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libstd-6425b930ca146ae9-0.9-pre.rlib x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/std.bc

If you run it as:

ar rS x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/libstd-6425b930ca146ae9-0.9-pre.rlib x86_64-apple-darwin/stage1/lib/rustc/x86_64-apple-darwin/lib/std.bc

does it succeed?

@xasmx
Copy link
Author

xasmx commented Dec 10, 2013

Yes, with 'ar rS' the command succeeds. If I try to 'make' after that to continue building, it'll end up failing again at the same line for the same reason, so I guess I need to make the change somewhere in the Makefile to get further.

@alexcrichton
Copy link
Member

Thanks for confirming! I've opened #10908 to always run 'rS' instead of just 'r' in these situations.

bors added a commit that referenced this issue Dec 13, 2013
Turns out that one some platforms the ar/ranlib tool will die with an assertion
if the file being added doesn't actually have any symbols (or if it's just not
an object file presumably).

This functionality is already all exercised on the bots, it just turns out that
the bots don't have an ar tool which dies in this situation, so it's difficult
for me to add a test.

Closes #10907
@dymk
Copy link

dymk commented Jan 12, 2014

This issue still persists on OSX 10.9 at HEAD on ~master (commit 54a85d4d675a7129087a2c342ac09a14d446c5cc as of right now):

llvm[5]: ======= Finished Linking Release+Asserts Executable Sample (without symbols)
make[2]: Nothing to be done for `all'.
llvm[1]: ***** Completed Release+Asserts Build
compile: x86_64-apple-darwin/rt/stage0/arch/x86_64/_context.o
compile: x86_64-apple-darwin/rt/stage0/arch/x86_64/record_sp.o
compile: x86_64-apple-darwin/rt/stage0/rust_try.o
link: x86_64-apple-darwin/rt/stage0/librustrt.a
/opt/local/bin/ranlib: file: x86_64-apple-darwin/rt/stage0/librustrt.a(rust_android_dummy.o) has no symbols
/opt/local/bin/ranlib: file: x86_64-apple-darwin/rt/stage0/librustrt.a(record_sp.o) has no symbols
cp: x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/librustrt.a
compile: x86_64-apple-darwin/rt/stage0/arch/x86_64/morestack.o
link: x86_64-apple-darwin/rt/stage0/arch/x86_64/libmorestack.a
cp: x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a
compile_and_link: x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/libstd.dylib
error: ar s x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/libstd-3e5aeb83-0.9.rlib failed with: exit code: 1
note: stdout ---

note: stderr ---
Assertion failed: ((unsigned)Val < Attribute::EndAttrKinds && "Attribute out of range!"), function addAttribute, file Attributes.cpp, line 948.
ar: fatal error in /opt/local/bin/ranlib

error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /Users/rustbuild/src/rust-buildbot/slave/snap3-mac/build/src/libsyntax/diagnostic.rs:75
task '<main>' failed at 'explicit failure', /Users/rustbuild/src/rust-buildbot/slave/snap3-mac/build/src/librustc/lib.rs:453
make: *** [x86_64-apple-darwin/stage0/lib/rustlib/x86_64-apple-darwin/lib/libstd.dylib] Error 101

@huonw huonw reopened this Jan 12, 2014
@alexcrichton
Copy link
Member

Closing as a dupe of #11162

flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 30, 2023
…=Jarcho

Direct towards late passes in `cargo dev new_lint`

changelog: none

This would be the tooling part of rust-lang#9311

- `--pass late` is now the default
- It prints a message recommending the use of a late pass if you choose `--pass early`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-macos Operating system: macOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants