mapillary / mapillary/OpenSfM

OpenSfM build unconditionally strips out debug symbols, and makes it hard to put them in

Open
#1,119 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.