Skip to content

Fix two Linux build failures: shared StealthLink library and unused vtkImageViewer2 include - #1292

Open
mkomaiha wants to merge 2 commits into
PlusToolkit:masterfrom
mkomaiha:linux-stealthlink-build-fixes
Open

Fix two Linux build failures: shared StealthLink library and unused vtkImageViewer2 include#1292
mkomaiha wants to merge 2 commits into
PlusToolkit:masterfrom
mkomaiha:linux-stealthlink-build-fixes

Conversation

@mkomaiha

Copy link
Copy Markdown

Two independent build fixes found while building PlusLib with PLUS_USE_STEALTHLINK=ON on Linux. They are in separate commits and touch different parts of src/PlusDataCollection/CMakeLists.txt, so either can be cherry-picked on its own.


1. Link the shared StealthLink library on Linux — BUG: commit

Addresses part of #957.

On Linux PlusDataCollection linked libStealthLink.a. A static archive records no dependencies of its own, so the boost symbols the SDK references are never resolved and linking PlusLib fails:

undefined reference to `boost::system::system_category()'
undefined reference to `boost::system::generic_category()'

The SDK ships its own boost 1.49 beside the library, but nothing tells the linker to pull it in. libStealthLink.so records them as DT_NEEDED:

$ objdump -p libStealthLink.so | grep NEEDED | grep boost
  NEEDED  libboost_signals-mt.so.1.49.0
  NEEDED  libboost_system-mt.so.1.49.0
  NEEDED  libboost_thread-mt.so.1.49.0

so linking the shared library resolves them without enumerating the bundled boost in CMake and hardcoding versions that would go stale with the next SDK drop.

The shared library is also added to External_Libraries_Install, matching what the WIN32 branch already did. Both platforms now install the same file, so that call is hoisted out of the conditional and only the genuinely platform-specific part — which library to link, plus the Windows-only debug variant — stays inside it.

This does not close #957 by itself. The remaining errors in that issue are ABI mismatches (std::__cxx11::basic_string vs std::string) caused by -D_GLIBCXX_USE_CXX11_ABI=0 not reaching the external projects. The SDK is built against the pre-GCC5 libstdc++ ABI, and VTK, ITK, IGSIO and OpenIGTLink all have to agree with it. That fix belongs in PlusBuild and is filed separately; this change is independent of it and correct on its own.

2. Remove unused vtkImageViewer2 include from ViewSequenceFile — COMP: commit

Unrelated to StealthLink; it just happens to block the same build.

Tools/ViewSequenceFile.cxx includes vtkImageViewer2.h but never uses vtkImageViewer2. The include is the only mention of the name in the file, and always has been — no commit in the file's history has ever referenced the type. The tool builds its display from vtkImageActor, vtkRenderer and vtkRenderWindow instead.

The header belongs to VTK's InteractionImage module, which ViewSequenceFile does not link, so the include only resolves if that module's include directory happens to arrive through some other VTK target. When it doesn't, the build fails:

ViewSequenceFile.cxx:17:10: fatal error: vtkImageViewer2.h: No such file or directory

This shows up with VTK 9.1.0 used from a build tree, where include directories come only from the modules actually linked.

Deleting the include is the fix. Linking InteractionImage would also make it compile, but the binary references no symbol from that module — --as-needed drops it right back out, and the executable is byte-for-byte identical either way.

For contrast, the 14 files that genuinely use this class (all under Testing/) include it, declare a vtkImageViewer2*, and construct one — and Testing/CMakeLists.txt links InteractionImage for exactly those targets. ViewSequenceFile has only the include.


Testing

Ubuntu 21.04, GCC 10, VTK 9.1.0 and ITK 5.4.4 from a PlusBuild superbuild, StealthLink SDK 2.4, PLUSBUILD_BUILD_PlusLib_TOOLS=ON.

Each failure reproduces without its commit, and each commit was verified on its own. With both applied the build completes and the device is available at runtime:

$ objdump -p libvtkPlusDataCollection.so | grep NEEDED | grep -i stealth
  NEEDED   libStealthLink.so.2.4.20150414

$ PlusVersion | grep -i stealth
  - StealthLinkTracker (ver: Plus-2.9.0)

(The StealthLink half additionally requires the PlusBuild ABI fix mentioned above to reach a successful link.)

On Linux PlusDataCollection linked libStealthLink.a. The static archive
carries none of the SDK's own dependencies, so the boost symbols it
references are left unresolved and linking PlusLib fails with:

  undefined reference to `boost::system::system_category()'
  undefined reference to `boost::system::generic_category()'

libStealthLink.so records those as DT_NEEDED, so linking the shared
library instead resolves them without having to enumerate the SDK's
bundled boost by hand.

Also install the shared library alongside the executables, matching what
the WIN32 branch already does. Since both branches install the same file
it is hoisted out of the platform conditional.
ViewSequenceFile.cxx includes vtkImageViewer2.h but never uses
vtkImageViewer2; the include line is the only occurrence of the name in
the file, and it is the only occurrence in the file's entire history.

It is also the only thing in the target that reaches into VTK's
InteractionImage module, which ViewSequenceFile does not link, so it
compiles only when that module's include directory happens to arrive
transitively. Where it does not, the build fails with:

  ViewSequenceFile.cxx:17:10: fatal error: vtkImageViewer2.h: No such file or directory

Removing the include drops the undeclared dependency rather than linking
a module whose symbols are never referenced.
@mkomaiha
mkomaiha force-pushed the linux-stealthlink-build-fixes branch from 5bfeec4 to a521b8e Compare August 26, 2026 21:21
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.

PlusLib build issues with StealthLink

1 participant