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

DWARF debug symbol file is missing on Mac #267

Open
cswinter opened this issue Feb 19, 2020 · 3 comments
Open

DWARF debug symbol file is missing on Mac #267

cswinter opened this issue Feb 19, 2020 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cswinter
Copy link

Maturin fails to include DWARF debug symbol files in pip packages on Mac. This results in backtraces not displaying filenames and line numbers. On (at least some) Mac platforms, cargo will generate the following build artifacts for builds with debuginfo:

target
└── debug
    ├── build
    ├── deps
    │   ├── libpython_cffi.dylib
    │   ├── libpython_cffi.dylib.dSYM
    │   │   └── Contents
    │   │       └── Resources
    │   │           └── DWARF
    │   │               └── libpython_cffi.dylib
    │   └── python_cffi.d
    ├── examples
    ├── incremental
    │   ...
    ├── libpython_cffi.d
    └── libpython_cffi.dylib

Crucially, the target/debug/libpython_cffi.dylib file (which is byte-for-byte identical to target/debug/deps/libpython_cffi.dylib) does not seem to contain symbols which are instead provided by the target/debug/deps/libpython_cffi.dylib.dSYM folder. This folder should be included in the pip wheel to obtain a site-packages structure as below:

/Users/clemens/anaconda3/envs/blobcache/lib/python3.8/site-packages/pyo3_backtrace_repro
├── __init__.py
├── __pycache__
│   └── __init__.cpython-38.pyc
├── libpyo3_backtrace_repro.dylib.dSYM
│   └── Contents
│       ├── Info.plist
│       └── Resources
│           └── DWARF
│               └── libpyo3_backtrace_repro.dylib
└── pyo3_backtrace_repro.cpython-38-darwin.so

Currently, the libpyo3_backtrace_repro.dylib.dSYM folder is missing which prevents backtraces from working properly. I have confirmed that adding this folder manually to site-packages fixes the issue, but still need help with making the necessary changes to maturin to properly include those files in the pip wheel. Some additional context in PyO3/pyo3#766

@konstin
Copy link
Member

konstin commented Feb 20, 2020

Interesting, I wasn't aware that on mac the debug info is an extra directory! Could you copy the last few lines of cargo build --message-format json to see how cargo categorizes the debug symbol file?

@cswinter
Copy link
Author

cswinter commented Feb 20, 2020

Cargo doesn't seem to make any mention of it:

{"reason":"compiler-artifact","package_id":"python_cffi 0.1.0 (path+file:///Users/clemens/openai/python-rust-cffi)","target":{"kind":["cdylib"],"crate_types":["cdylib"],"name":"python_cffi","src_path":"/Users/clemens/openai/python-rust-cffi/src/lib.rs","edition":"2018","doctest":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/Users/clemens/openai/python-rust-cffi/target/debug/libpython_cffi.dylib"],"executable":null,"fresh":false}

@konstin konstin added the bug Something isn't working label Mar 6, 2020
@messense
Copy link
Member

It shouldn't be hard to include the debug symbol file. Do you know any Python C/C++ extension that includes debug symbol files as a reference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants