Skip to content

build(deb): fix source tree path leaking into package#22

Open
einhander wants to merge 1 commit into
reybits:masterfrom
einhander:master
Open

build(deb): fix source tree path leaking into package#22
einhander wants to merge 1 commit into
reybits:masterfrom
einhander:master

Conversation

@einhander

Copy link
Copy Markdown
Contributor
 - Add -fdebug-prefix-map to debian/rules to remap absolute build
    paths to relative in DWARF debug info
  - Fix configure_file to output Version.cpp into BINARY_DIR instead
    of polluting the source tree
  - Replace global include_directories with target_include_directories
    to scope include paths to the target only
  - Fix Makefile install target: pass DESTDIR as env variable and
    --prefix separately so cmake --install uses correct paths
  - Add override_dh_auto_install with PREFIX=/usr in debian/rules
  - Add CMAKE_*_RPATH options to control rpath behaviour
  - Switch deb target from dpkg-buildpackage -F to debuild -uc -us

     - Add -fdebug-prefix-map to debian/rules to remap absolute build
        paths to relative in DWARF debug info
      - Fix configure_file to output Version.cpp into BINARY_DIR instead
        of polluting the source tree
      - Replace global include_directories with target_include_directories
        to scope include paths to the target only
      - Fix Makefile install target: pass DESTDIR as env variable and
        --prefix separately so cmake --install uses correct paths
      - Add override_dh_auto_install with PREFIX=/usr in debian/rules
      - Add CMAKE_*_RPATH options to control rpath behaviour
      - Switch deb target from dpkg-buildpackage -F to debuild -uc -us
@reybits

reybits commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Thanks for the cleanup - the debug-path remap, scoped target includes, and proper DESTDIR/--prefix split for cmake --install are all good improvements. Two issues need be addressed before this can merge, both around the include/sources changes in CMakeLists.txt:

1. target_include_directories is missing BEFORE - macOS fmt regression

Earlier in the file, directory-scope include_directories(${GLFW3_INCLUDE_DIRS}) (line 117) adds /opt/homebrew/include on macOS. With the old include_directories(BEFORE...) the bundled third-party/fmtlib/include was guaranteed to come first. The new target_include_directories(...PRIVATE...) appends, so on a Homebrew system #include <fmt/format.h> resolves to the system fmt (v12) instead of the bundled one (v10), reintroducing the ABI conflict that the BEFORE keyword was originally added to fix.

  target_include_directories(${APPLICATION_NAME} BEFORE PRIVATE
      ${CMAKE_CURRENT_SOURCE_DIR}/src
      ${CMAKE_CURRENT_SOURCE_DIR}/third-party/fmtlib/include
      ${CMAKE_CURRENT_SOURCE_DIR}/third-party/glad/include
      ${CMAKE_CURRENT_BINARY_DIR}/src
      )

2. Stale src/Version.cpp from prior builds → duplicate-symbol link error

src/Version.cpp is .gitignored, not deleted. Anyone who built before this PR (and CI caches) still has it on disk. file(GLOB_RECURSE SVIEW_SOURCES "src/*.cpp") picks up the stale source-tree copy and the explicit list(APPEND... ${CMAKE_CURRENT_BINARY_DIR}/src/Version.cpp), so the build fails at link time with multiple definition of 'version::getMajor()' (and friends).

Either remove the stale file at configure time:

  file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/src/Version.cpp")
  file(GLOB_RECURSE SVIEW_SOURCES "src/*.cpp")
  list(APPEND SVIEW_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/src/Version.cpp")

or exclude it from the glob with list(FILTER SVIEW_SOURCES EXCLUDE REGEX "src/Version\\.cpp$").

Optional nits (non-blocking)

  • CMAKE_SKIP_BUILD_RPATH=FALSE and CMAKE_BUILD_WITH_INSTALL_RPATH=FALSE in dist/debian/rules are CMake defaults - they can be dropped to keep the diff focused on what actually changes.
  • CMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE will embed the linker search paths into the binary's RUNPATH; expect lintian to flag binary-or-shlib-defines-rpath. Worth confirming it's actually needed.
  • override_dh_auto_install: dh_auto_install -- PREFIX=/usr - cmake --install doesn't honor a PREFIX variable, and debhelper's cmake buildsystem already sets CMAKE_INSTALL_PREFIX=/usr. The override is a no-op; either drop it or add -DCMAKE_INSTALL_PREFIX=/usr to override_dh_auto_configure if the intent was different.
  • Switching from dpkg-buildpackage -F -tc to debuild -uc -us loses the -tc "clean after build" behavior; not critical, just worth noting.

Happy to merge once (1) and (2) are addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants