smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

exclude several boost libraries from build #202

Closed smanders closed 6 years ago

smanders commented 6 years ago

boost libraries https://www.boost.org/doc/libs/

  1. atomic - used in Vantage
    • should be removed?

      It implements the interface as defined by the C++11 standard, but makes this feature available for platforms lacking system/compiler support for this particular C++11 feature.

  2. chrono - used in Vantage
  3. container - used in Vantage
  4. context
  5. contract
  6. coroutine/coroutine2
  7. date_time - used in Vantage
  8. exception - used in Vantage
  9. fiber
  10. filesystem - used in Vantage
  11. graph - used in Vantage
  12. graph_parallel
  13. iostreams - used in Vantage
  14. locale
    • currently doesn't build
  15. log - used in mdp
  16. math
    • currently doesn't build with clang
    • math/special_functions - used in Vantage
    • math/constants - used in Vantage
    • math/complex.hpp - used in mdp
  17. mpi
    • currently doesn't build
  18. program_options - used in Vantage
  19. python
  20. random - used in Vantage
  21. regex - used in Vantage
  22. serialization - used in ATT
  23. signals - used in Vantage
  24. stacktrace
  25. system - used in Vantage
  26. test - used in Vantage
  27. thread - used in Vantage
  28. timer - used in Vantage
  29. type_erasure
  30. wave

recommend removing from the default build:

  1. context
  2. contract
  3. coroutine
  4. fiber
  5. graph_parallel
  6. locale (already is)
  7. math (check that nothing requires it)
  8. mpi (already is)
  9. python
  10. serialization (why is ATT using it?)
  11. stacktrace
  12. type_erasure
  13. wave
smanders commented 6 years ago

serialization... ATT should be using boost/optional.hpp not boost/serialization/optional.hpp (in two places)

smanders commented 6 years ago

update boost use script

  set(Boost_LIBS # dependency order
    log_setup  # ldd:log,regex
    log        # ldd/cmake:filesystem,thread cmake:log_setup,regex
    ######
    thread     # ldd/cmake:system cmake:atomic,chrono,date_time
    timer      # ldd/cmake:chrono
    ######
    chrono     # ldd/cmake:system
    filesystem # ldd/cmake:system
    graph      # ldd:regex
    iostreams  # cmake:regex
    random     # ldd/cmake:system
    ######
    atomic
    container
    date_time
    exception
    prg_exec_monitor program_options
    regex
    signals
    system
    test_exec_monitor unit_test_framework
    )
  # NOTE: determined boost library dependency order by building boost on linux
  # with link=shared and runtime-link=shared and using ldd
  # cmake dependencies by examining cmake's Modules/FindBoost.cmake

cmake FindBoost.cmake https://github.com/Kitware/CMake/blob/v3.12.0/Modules/FindBoost.cmake#L828-L844

created a boost.dot

digraph GG {
  node [fontsize=12];
  atomic [shape=diamond];
  chrono [shape=diamond];
  container [shape=diamond];
  date_time [shape=diamond];
  exception [shape=diamond];
  filesystem [shape=diamond];
  grph [label="graph" shape=diamond];
  iostreams [shape=diamond];
  log [shape=diamond];
  log_setup [shape=diamond];
  prg_exec_monitor [shape=diamond];
  program_options [shape=diamond];
  random [shape=diamond];
  regex [shape=diamond];
  signals [shape=diamond];
  system [shape=diamond];
  test_exec_monitor [shape=diamond];
  thread [shape=diamond];
  timer [shape=diamond];
  unit_test_framework [shape=diamond];
  chrono -> system;
  filesystem -> system;
  grph -> regex;
  iostreams -> regex;
  random -> system;
  thread -> atomic;
  thread -> chrono;
  thread -> date_time;
  timer -> chrono;
  log -> filesystem;
  log -> thread;
  log_setup -> log;
  log_setup -> regex;
}

dot -Tpng -oboost.png boost.dot image

removing libraries without dependencies image

smanders commented 6 years ago

completed with commits to dev branch referenced above

smanders commented 6 years ago

with a pre-release version of externpro 18.08.1 and with the changes made to the boost use script I'm seeing link errors on every executable that links boost libraries

/opt/extern/externpro-18.08.1-gcc640-64-Linux/lib/libboost_prg_exec_monitor-gcc64-mt-s-1_63.a(cpp_main.o): In function `main':
cpp_main.cpp:(.text.startup+0x8): undefined reference to `cpp_main(int, char**)'
collect2: error: ld returned 1 exit status

since prg_exec_monitor was excluded from Boost_LIBS prior to these changes (see usexp-boost-config.cmake https://github.com/smanders/externpro/commit/41e103efae7d535156e020f4672046bf5ebce74f), I'm opting to remove it again

it appears the "program execution monitor" is a boost test library (I was only able to find reference to it in old boost docs https://www.boost.org/doc/libs/1_57_0/libs/test/doc/html/prg-exec-monitor.html)

smanders commented 6 years ago

a project (Vantage) that uses externpro (and boost) builds and links fine on linux with gcc, but fails on Windows with MSVC: LNK1104: cannot open file 'libboost_serialization-vc140-mt-s-1_63.lib'

of course boost serialization was one of the libraries excluded because it didn't appear that Vantage used it (outside of a couple of errant includes in Autotest code) -- this failure is quite early in the build (executables that link Sdimage and it's dependencies - MosaicIntegrationTest and SdimageTest)

searching the boost includes (grep -r "include <boost/serialization") it appears that there are other boost libraries (some header-only) included by Vantage that include serialization headers: graph, bimap, units, geometry, numeric

I'm not how to exactly determine which boost library (or something else?) is causing the linker to require boost serialization, but the way boost uses pragma comment lib to specify library dependencies (usually in a boost serialization header, which would make the library required if anything includes a boost serialization header) it's going to be easier to just include boost serialization in the externpro build of boost again...