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

lldb fails to run properly on macOS #54126

Closed
tromey opened this issue Sep 11, 2018 · 16 comments
Closed

lldb fails to run properly on macOS #54126

tromey opened this issue Sep 11, 2018 · 16 comments
Assignees
Labels
O-macos Operating system: macOS

Comments

@tromey
Copy link
Contributor

tromey commented Sep 11, 2018

I installed the rust-enabled lldb from rustup and tried to run it. It crashes with the mysterious:

(lldb) command script import "/Users/ttromey/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py"
: CommandLine Error: Option 'limited-coverage-experimental' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
Assertion failed: (e == 0), function ~recursive_mutex, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/libcxx/libcxx-400.9/src/mutex.cpp, line 64.
libc++abi.dylib: Pure virtual function called!

This seems to be a known LLVM bug: https://bugs.llvm.org/show_bug.cgi?id=22952. See also https://bugs.llvm.org/show_bug.cgi?id=30587. This is fallout from the switch to a dynamic LLVM, #53245.

I can't reproduce in my Linux build; not sure what is different there.

I'm looking into workarounds. One option might be to hack our clang and lldb builds so that all libraries are marked DISABLE_LLVM_LINK_LLVM_DYLIB.

@tromey tromey self-assigned this Sep 11, 2018
@tromey
Copy link
Contributor Author

tromey commented Sep 11, 2018

Can't reproduce with a local macOS build either. I'm still investigating.

I wonder if it's possible to build clang and lldb out-of-tree as is done for lld.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

If I run the rustup-installed lldb without going through rust-lldb, it works.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

Aha, invoking the command script import ... command that rust-lldb provides is what causes the crash. Which I guess could be apparent from the original failure.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

Just a simple Python file with import lldb makes it crash, so my theory is that something is wrong with our lldb build, causing this to try to load some other liblldb.dylib.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

The bug is that rustup does not preserve symlinks when installing lldb.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

This is strange, though, because rustup and tar seem to have symlink logic.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

The package manifest contains file:.../_lldb.so, so maybe this needs to be extended to allow a symlink somehow.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

I think the answer ends up being that rustup-utils/src/utils.rs should understand how to copy a symlink.

@tromey
Copy link
Contributor Author

tromey commented Sep 13, 2018

I have a rustup patch I will test out tomorrow.

@tromey
Copy link
Contributor Author

tromey commented Sep 14, 2018

rust-lang/rustup#1504

@michaelwoerister
Copy link
Member

Do you think this can be solved without going back to linking to LLVM statically?

@tromey
Copy link
Contributor Author

tromey commented Sep 19, 2018

Yes, see the PR -- once rustup can handle symlinks it should work.

I'm waiting for a new rustup release; then I'll test it again; and then if there aren't any more failures I'll write an announcement.

@michaelwoerister
Copy link
Member

OK, great! So we don't need to revert that.

@vadimcn
Copy link
Contributor

vadimcn commented Sep 24, 2018

I wonder if this would fix it.

@tromey
Copy link
Contributor Author

tromey commented Sep 25, 2018

Thanks, that does seem promising. I've been waiting for a new rustup release, though, since I was able to fix it locally using rust-lang/rustup#1504. But maybe landing that lldb patch would be faster.

@tromey
Copy link
Contributor Author

tromey commented Oct 5, 2018

This is fixed by rustup 1.14.0, which shipped yesterday.

@tromey tromey closed this as completed Oct 5, 2018
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

No branches or pull requests

4 participants