Open mkomaiha opened 2 years ago
Update:
I was able to get rid of the undefined reference to 'MNavStealthLink::'
, but not the boost::system::
by replacing -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"
with -DCMAKE_CXX_FLAGS_INIT="-D_GLIBCXX_USE_CXX11_ABI=0"
. I'm unsure if this is the correct way to do things, but seems to not error.
I think here the warning message should be more helpful to how to set the flag or it should actually do it for you https://github.com/PlusToolkit/PlusBuild/blob/d3e43fb5fb6f4472437b0254c6955ec15a6765fd/CMakeLists.txt#L689-L691
Similar to how this portion sets the -fPIC flag https://github.com/PlusToolkit/PlusBuild/blob/d3e43fb5fb6f4472437b0254c6955ec15a6765fd/CMakeLists.txt#L414-L417
The thought process is that the -D_GLIBCXX_USE_CXX11_ABI=0
is passed down to all of the inner cmake files. This gets close to fixing everything I think, but still errors because IGSIO/vtkAddon does not get passed this flag.
I am unsure why boost::system::generic_category()
and system_category()
are still unbound. I have the following files in my STEALTHLINK_INCLUDE_DIRS
libboost_date_time-mt.so.1.49.0
libboost_iostreams-mt.so.1.49.0
libboost_program_options-mt.so.1.49.0
libboost_serialization-mt.so.1.49.0
libboost_system-mt.so.1.49.0
libboost_filesystem-mt.so.1.49.0
libboost_locale-mt.so.1.49.0
libboost_regex-mt.so.1.49.0
libboost_signals-mt.so.1.49.0
libboost_thread-mt.so.1.49.0
In cmake, did you set cxx standard to 98? @lassoan can you confirm which standards are ok for stealthlink?
In cmake, did you set cxx standard to 98? @lassoan can you confirm which standards are ok for stealthlink?
CXX 98 errors with ITK5.
CMake Error at CMakeLists.txt:40 (message):
CMAKE_CXX_STANDARD:STRING=98 is not supported in ITK version 5 and greater.
-- Configuring incomplete, errors occurred!
make[2]: *** [CMakeFiles/itk.dir/build.make:91: itk-prefix/src/itk-stamp/itk-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:123: CMakeFiles/itk.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Setting PLUS_ITK_VERSION=4 causes:
[ 0%] Built target ITKThresholding-all
In file included from /home/mkomaiha/opt/PlusBuild-bin/itk/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_iostream.h:5,
from /home/mkomaiha/opt/PlusBuild-bin/itk/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_deprecated.cxx:4:
/home/mkomaiha/opt/PlusBuild-bin/itk/Modules/ThirdParty/VNL/src/vxl/vcl/vcl_compiler.h:90:4: error: #error "Dunno about this gcc"
90 | # error "Dunno about this gcc"
| ^~~~~
Yes, the stealthlink build is stuck to old versions of libraries, which may not support modern compilers. You may want to find the offending line in itk and bypass the build error.
After looking deeper into the issue I think it is also related to the following commit https://github.com/PlusToolkit/PlusBuild/commit/aa04a2554b56129f338db7f6d08dd6eac7ceb561.
-DSTEALTHLINK_STEALTHLINK_SHARED_LIBRARY
is no longer windows only, but it is not exported for non Win32 here:
https://github.com/PlusToolkit/PlusBuild/blob/d3e43fb5fb6f4472437b0254c6955ec15a6765fd/SuperBuild/External_PlusLib.cmake#L199-L211
The IF should instead look like this:
#PlusBuild/SuperBuild/External_PlusLib.cmake#L199
IF(PLUS_USE_STEALTHLINK)
LIST(APPEND PLUSBUILD_ADDITIONAL_SDK_ARGS
-DSTEALTHLINK_INCLUDE_DIRS:PATH=${STEALTHLINK_INCLUDE_DIRS}
-DSTEALTHLINK_STEALTHLINK_STATIC_LIBRARY:PATH=${STEALTHLINK_STEALTHLINK_STATIC_LIBRARY}
-DSTEALTHLINK_STEALTHLINK_SHARED_LIBRARY:PATH=${STEALTHLINK_STEALTHLINK_SHARED_LIBRARY}
)
IF(WIN32)
LIST(APPEND PLUSBUILD_ADDITIONAL_SDK_ARGS
-DSTEALTHLINK_STEAELTHLINKD_STATIC_LIBRARY:PATH=${STEALTHLINK_STEALTHLINKD_STATIC_LIBRARY}
-DSTEALTHLINK_STEALTHLINKD_SHARED_LIBRARY:PATH=${STEALTHLINK_STEALTHLINKD_SHARED_LIBRARY}
)
ENDIF()
ENDIF()
Also, BOOST should be added as a dependency (maybe UNIX only?) and the ELSE statement should be before LIST(APPEND External_Libraries_Debug
(https://github.com/PlusToolkit/PlusLib/blob/f3dcf47cab4fd1d04cee543163abf4974ef37626/src/PlusDataCollection/CMakeLists.txt)
#PlusLib/PlusDataCollection/CMakeLists.txt#L1420
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
LIST(APPEND ${PROJECT_NAME}_LIBS
${Boost_SYSTEM_LIBRARY}
)
I am now using the updated External_PlusLib.cmake
, PlusLib/PlusDataCollection/CMakeLists.txt
, and the following cmake command for PlusBuild:
ccmake ../PlusBuild \
-DSTEALTHLINK_ROOT_DIR=/home/mkomaiha/pymodules/stealthPyModule/StealthPyCLinkLibs \
-DPLUS_USE_STEALTHLINK=ON \
-DCMAKE_C_FLAGS_INIT="-D_GLIBCXX_USE_CXX11_ABI=0" \
-DCMAKE_CXX_FLAGS_INIT="-D_GLIBCXX_USE_CXX11_ABI=0" \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release
It seems like the ep_common_cxx_flags
is only passed one level down, but ep_common_args
is always forwarded so I used that instead and moved it to be the last thing to be expanded in IGSIO/SuperBuild/External_vtkAddon.
#PlusBuild/CMakeLists.txt#L412
SET(ep_common_args -DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD} -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=ON -Dep_common_args:STRING=-DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0)
This doesn't seem like a great solution at least for an automated way maybe there is something better I can do here?
With this setup I can get StealthLink to build on Linux.
Thank you very much for working on this and sharing the solution. Would you mind creating a pull request with the final working version that contains all the suggested changes?
Yes, of course! They are pretty minimal changes.
However, I'm unsure how to forward the -D_GLIBCXX_USE_CXX11_ABI=0
to ISGIO/vtkAddon
for a complete solution and if setting -D_GLIBCXX_USE_CXX11_ABI=0
should be automatic here https://github.com/PlusToolkit/PlusBuild/blob/d3e43fb5fb6f4472437b0254c6955ec15a6765fd/CMakeLists.txt#L689-L691. Potentially a new option like PLUS_BUILD_ABI=0
or something.
@mkomaiha Was a pull request ever submitted to resolve this issue?
Hi,
I am having issues using PlusBuild. I am using the following cmake settings:
I get these errors:
I think it has to do with "-D_GLIBCXX_USE_CXX11_ABI=0" not getting passed to the PlusLib cmake file. However, when I manually add it to the CXX flags in PlusLib-bin and try to make again I get different issues:
Any help would be much appreciated!