OpenSfM build unconditionally strips out debug symbols, and makes it hard to put them in
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 899
- PR merge metrics
- No merged PRs in 30d
Description
Hello. When debugging #1118 I REALLY wanted debug symbols so that I could walk around the C code and put some watchpoints in. Since we have make wrapped in cmake wrapped in setuptools, the process is very unclear. I manually added -ggdb3 to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS in opensfm/src/CMakeLists.txt and '-DCMAKE_BUILD_TYPE=Debug', to the cmake_command in setup.py. This kinda sorta made it work, but the python .so files still ended up stripped. I then noticed that there were 3 copies of the .so files sitting in various directories, and one of those copies was unstripped. Replacing the stripped files with the unstripped ones almost made it work. However the unstripped pyrobust.cpython....so copy had a reference to the undefined symbol _ZN10Similarity15MINIMAL_SAMPLESE, while the stripped one did not; I have no idea why. Replacing the .so files except this one finally made it work, and I could then figure out #1118.
Can we please make this less of an adventure?
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with opensfm/src/CMakeLists.txt and setup.py, then reproduce a debug build and inspect the generated Python .so files in their different directories. Done means the documented or normal debug build retains usable debug symbols consistently without manual replacement, and the extension copies no longer differ unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake, cpp, python
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100