Skip to content
  • Rashad Kanavath's avatar
    COMP: fix linker option for otb and other projects · 51904271
    Rashad Kanavath authored
    GNU ld now enables -Wl,-as-needed by default. This cause issue on
    our side in the final package.
    ITK: we link with ITK_LIBRARIES which includes, itknetlib and was not
    linked with any of OTB module. This bug was seen in windows package
    testing.
    https://dash.orfeo-toolbox.org/testDetails.php?test=59861738&build=287155
    
    Shark: This is another example where wl,-as-needed is causing trouble
    shark link with a couple of boost libraries but no of them are linked
    into libshark.so due to default -Wl,-as-needed. With this option, the
    linker will drop an lib or .so on command line if none of it's symbols
    are used by the project.
    
    In both cases (ITK and Shark), there are upstream issues. Shark should
    not add boost_system to link flags if it is not used in sharklib. Maybe
    this boost component is used in examples. I don't know much. It is
    really an upstream issue.
    Same case with ITK, if itknetlib is built by default, and is not
    necessary for the activated itk modules, it should skip that.
    
    To get back old behaviour, we have to use -Wl,no-as-needed.
    The other option; Wl-no-undefined is to trigger a link error if an
    undefined reference is found.
    
    The exact behaviour of as-needed and no-undefined can be found on GNU LD
    man pages (man ld).
    51904271