Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Peillet
otb
Commits
3d6a28b3
Commit
3d6a28b3
authored
7 years ago
by
Rashad Kanavath
Browse files
Options
Downloads
Patches
Plain Diff
COMP: use -Wl,no-as-needed for a single test exe
parent
13ac8caa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Modules/IO/TestKernel/test/CMakeLists.txt
+33
-0
33 additions, 0 deletions
Modules/IO/TestKernel/test/CMakeLists.txt
with
33 additions
and
0 deletions
Modules/IO/TestKernel/test/CMakeLists.txt
+
33
−
0
View file @
3d6a28b3
...
...
@@ -32,6 +32,39 @@ set(OTBTestKernelTests
add_executable
(
otbTestKernelTestDriver
${
OTBTestKernelTests
}
)
target_link_libraries
(
otbTestKernelTestDriver
${
OTBTestKernel-Test_LIBRARIES
}
)
So the story here is that -Wl,-no-needed is a default linker flag on only on Ubuntu
(
debian or archlinux does not use this
)
. This will exclude a lot of libraries from linking into
executable.
# #ITK_LIBRARIES in a superbuild now contains the following libraries.
# "itkdouble-conversion itksys itkvcl itknetlib itkv3p_netlib itkvnl itkvnl_algo
# ITKVNLInstantiation ITKCommon itkNetlibSlatec ITKStatistics ITKTransform ITKLabelMap
# ITKMesh ITKMetaIO ITKSpatialObjects ITKPath ITKQuadEdgeMesh ITKIOImageBase ITKOptimizers
# ITKPolynomials ITKBiasCorrection ITKFFT ITKKLMRegionGrowing ITKOptimizersv4 ITKWatersheds"
# OTBITK module will find all of these components in Modules/ThirdParty/ITK/otb-module-init.cmake
# But due to default -Wl,-as-needed flag many of them are ignored.
# see the documentation of GNU ld -as-needed for details on this behaviour.
# Our problem is that we need these ignored ones in the some header-only modules.
# Eg: Modules/Core/LabelMap
# This module depends on ITKLabelMap but does not link with it as it doesn't create any module (lib, exe)
# All it use is a couple of headers from ITKLabelMap. So removing that dependency is out of question.
# At this point, possible solution are follows:
# 1. use -Wl,-as-no-needed to CMAKE_LINKER FLAGS and be done with it. (all executable contains many used libs)
# 2. glob all libITK*, libitk* in the package script. (ugly and I don't agree)
# 3. make a dummy executable and link that with all of OTB libs and use -Wl,-no-as-needed in that
# 4. pick one of the random test executable and only add -Wl,-no-as-needed to it. (still a hack)
# ..
# ...
# RK: I finally decided to go with 4th option.
# Take an existing test executable otbTestKernelTestDriver and force -Wl,-no-as-needed.
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Linux"
)
set_target_properties
(
otbTestKernelTestDriver PROPERTIES LINK_FLAGS
"-Wl,-no-as-needed"
)
endif
()
otb_module_target_label
(
otbTestKernelTestDriver
)
otb_add_test
(
NAME tsTvCompareAscii2 COMMAND otbTestKernelTestDriver
--compare-ascii
${
NOTOL
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment