Skip to content

ENH: Remove unused ctkBinaryFileDescriptor class - #1454

Merged
jcfr merged 1 commit into
commontk:masterfrom
lassoan:remove-ctkbinaryfiledescriptor
Aug 31, 2026
Merged

ENH: Remove unused ctkBinaryFileDescriptor class#1454
jcfr merged 1 commit into
commontk:masterfrom
lassoan:remove-ctkbinaryfiledescriptor

Conversation

@lassoan

@lassoan lassoan commented Aug 30, 2026

Copy link
Copy Markdown
Member

Removing unused class that prevents Debian packaging of CTK (https://dfsg-new-queue.debian.org/reviews/ctk).


The ctkBinaryFileDescriptor class wrapped the GNU BFD library (libbfd from binutils) to resolve global symbols in an executable without running it, on unix-like systems only.

It was ported to CTK in 2010 from Slicer3's ModuleDescriptionParser library (BinaryFileDescriptor, added in 2007), where it was used by ModuleFactory::ScanForCommandLineModulesByPeeking() to speed up CLI module discovery at application startup: instead of launching each CLI executable with the "--xml" argument, the factory "peeked" into the binary to read the XMLModuleDescription global symbol (and the module logo symbols) directly.

The class was added to CTK in anticipation of the Qt-based CLI module machinery being migrated from Slicer, but that "peeking" approach was abandoned (Slicer's qCTKSymbolResolver experiment was retired to the Attic in June 2010, and Slicer 4 CLI factories run executables with "--xml" instead), so nothing in CTK, Slicer, or MITK ever used it.

The feature was disabled by default anyway (the WITH_BFD_SHARED and WITH_BFD_STATIC library options were OFF), but it is now removed entirely to avoid licensing complications: libbfd is GPL-licensed, which conflicts with CTK's permissive Apache 2.0 license when linked in.

@lassoan
lassoan requested review from jcfr and pieper August 30, 2026 02:33
@lassoan lassoan self-assigned this Aug 30, 2026
The ctkBinaryFileDescriptor class wrapped the GNU BFD library (libbfd
from binutils) to resolve global symbols in an executable without
running it, on unix-like systems only.

It was ported to CTK in 2010 from Slicer3's ModuleDescriptionParser
library (BinaryFileDescriptor, added in 2007), where it was used by
ModuleFactory::ScanForCommandLineModulesByPeeking() to speed up CLI
module discovery at application startup: instead of launching each CLI
executable with the "--xml" argument, the factory "peeked" into the
binary to read the XMLModuleDescription global symbol (and the module
logo symbols) directly.

The class was added to CTK in anticipation of the Qt-based CLI module
machinery being migrated from Slicer, but that "peeking" approach was
abandoned (Slicer's qCTKSymbolResolver experiment was retired to the
Attic in June 2010, and Slicer 4 CLI factories run executables with
"--xml" instead), so nothing in CTK, Slicer, or MITK ever used it.

The feature was disabled by default anyway (the WITH_BFD_SHARED and
WITH_BFD_STATIC library options were OFF), but it is now removed
entirely to avoid licensing complications: libbfd is GPL-licensed,
which conflicts with CTK's permissive Apache 2.0 license when linked
in.
@lassoan
lassoan force-pushed the remove-ctkbinaryfiledescriptor branch from 2bacdb4 to 8477243 Compare August 30, 2026 02:33
@jcfr
jcfr requested a lite review from Copilot August 31, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the unused ctkBinaryFileDescriptor (libbfd-based) feature and its related CMake detection/options and tests from CTKCore, primarily to avoid GPL licensing complications and unblock Debian packaging.

Changes:

  • Removed ctkBinaryFileDescriptor implementation and public header from Libs/Core.
  • Removed BFD-related build options / detection (including ctkMacroBFDCheck.cmake and the TestBFD try-compile project).
  • Removed BFD-related tests and their CMake wiring in Libs/Core/Testing/Cpp.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Libs/Core/Testing/Cpp/ctkBinaryFileDescriptorTestHelper.cpp Deleted BFD test helper executable source.
Libs/Core/Testing/Cpp/ctkBinaryFileDescriptorTest1.cpp Deleted BFD unit test source.
Libs/Core/Testing/Cpp/CMakeLists.txt Removed BFD-conditional test sources, helper target, and test registration.
Libs/Core/target_libraries.cmake Removed BFD_LIBRARIES from CTKCore link list (now empty, consistent with other libs).
Libs/Core/ctkBinaryFileDescriptor.h Deleted unused public API header.
Libs/Core/ctkBinaryFileDescriptor.cpp Deleted unused libbfd-backed implementation.
Libs/Core/ctk_library_options.cmake Deleted Core library options file that only defined BFD options.
Libs/Core/CMakeLists.txt Removed inclusion of the BFD check macro and conditional compilation of BFD sources.
Libs/Core/CMake/TestBFD/TestBFD.cpp Deleted libbfd compile/link probe source.
Libs/Core/CMake/TestBFD/CMakeLists.txt Deleted libbfd try-compile project CMake.
Libs/Core/CMake/ctkMacroBFDCheck.cmake Deleted BFD availability/options macro and related configuration logic.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jcfr
jcfr merged commit 71a668a into commontk:master Aug 31, 2026
5 checks passed
@ferdymercury

Copy link
Copy Markdown

Thanks a lot!! @lassoan ideally a new tag release would be welcome

@lassoan
lassoan deleted the remove-ctkbinaryfiledescriptor branch August 31, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants