- CMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic" when links are messed up
- Ubuntu may make $PREFIX/lib
- CMAKE_INSTALL_LIBDIR:PATH=lib64
- or just local/global symbol
- For library files like
$ nm libvtkCommonDataModel-9.1.so
.... T _Zn17vtkXMLData ...
.... U _Z.....
.... t _Z....
- T means global symbol
- U means undefined (wouldbe defined in other library file)
- t means local symbol
- gcc8.4 yields library with T, global symbol but gcc10.3 yielded with t, local
- Now linker with other source code yields undefined reference message
- How to enforce T, not t, in the library?
- In Cmake files, add_library(someLib SHARED IMPORTED GLOBAL) will enforce global symbol -> but not working?
- Comparing CMakeCache.txt by gcc8.4 vs 10.3, COMPILER_HAS_DEPRECATED:INTERNAL=1 is found at gcc8.4. 10.3 has no value.
- ~~Needs newer version of cmake? This is 3.20.5
- Tried vtk 9.1 and worked OK. But this will need the higher version of CMake (> 3.12)
- In ExternalProject_Add ()
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E env TMPDIR=/tmp mkdir myfolder && cmake --prefix=/opt/myapps
- Hangs at FindMPI()
- Check through
cmake --trace-expand
- ROI: execute_process(mpicxx -showme:compile ...)
- Actually this was not the cause. The real issue was that MPI_CXX_WORKS failed (FALSE found. Must be TRUE)
- Failing from mpicxx -mkl=sequential test_mpi.cpp
- Check through
- Intel cpu seems OK
- Found at 3.11, 3.28, 3.29, ...
- Alternative solution
- Instead of mpicxx, use icpc and provide -DCMAKE_CXX_FLAGS="..."
- The contents can be found from
mpicxx -show
- Might not work on building external projects
- The cause was the failure of try_compile(...) at FindMPI.cmake
- Test test_mpi.c from FindMPI folder
- MKL library was not found from linking
- Added -DCMAKE_CXX_FLAGS="-L${MKLROOT}/lib/intel64" resolved the isue
- Adding dependencies on external projects
ExternalProject_Add(
AAA_PROJECT
...
)
ExternalProject_Add(
BBB_PROJECT
DEPENDS AAA_PROJECT
...
)
- At ExternalProject_Add()
- Ref: https://stackoverflow.com/questions/56986726/cmake-externalproject-add-rebuilds-every-time
- Use
UPDATE_COMMAND ""
- ? May not work
- If the location of external project is determined by CMAKE_BINARY_DIR, CMakeCache.txt of the external packages might be re-written when a new build is requested
- CMakeCache.txt is re-written, recompiling all source codes
- Use CMAKE_SOURCE_DIR instead
- When old CMakeCache.txt survives, compilation will skip as Make command will compile any changed code only
- Once built, recompiling source package will not rebuild external packages
- If external packages need recompiling - due to any source code change - then use BUILD_ALWAYS 1
- This will compile any changed code only - not building from scratch
- If external packages need recompiling - due to any source code change - then use BUILD_ALWAYS 1