Project-10 / DGM

Direct Graphical Models (DGM) C++ library, a cross-platform Conditional Random Fields library, which is optimized for parallel computing and includes modules for feature extraction, classification and visualization.
http://research.project-10.de/dgm/
Other
188 stars 41 forks source link

missing symbol visibility #30

Closed christian-rauch closed 3 years ago

christian-rauch commented 3 years ago

System information (version):

Describe the bug Compiling the library via the standard CMake procedure (mkdir build && cd build && cmake .. && make -j) fails due to the missing visibility of some symbols, e.g. DirectGraphicalModels::fex::CCoordinate::get(cv::Mat const&, DirectGraphicalModels::fex::coordinateType).

CI would probably help to catch these problems early.

Steps To Reproduce

  1. mkdir build && cd build && cmake .. && make -j
  2. error message:
    /usr/bin/ld: CMakeFiles/Demo_FEX.dir/Demo_FEX.cpp.o: in function `main':
    Demo FEX.cpp:(.text+0x118): undefined reference to `DirectGraphicalModels::fex::CCoordinate::get(cv::Mat const&, DirectGraphicalModels::fex::coordinateType)'
    /usr/bin/ld: Demo FEX.cpp:(.text+0x229): undefined reference to `DirectGraphicalModels::fex::CCommonFeatureExtractor::invert() const'
    /usr/bin/ld: CMakeFiles/Demo_FEX.dir/Demo_FEX.cpp.o: in function `DirectGraphicalModels::fex::CCommonFeatureExtractor::getIntensity(cv::Scalar_<double>) const':
    Demo FEX.cpp:(.text._ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor12getIntensityEN2cv7Scalar_IdEE[_ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor12getIntensityEN2cv7Scalar_IdEE]+0x6a): undefined reference to `DirectGraphicalModels::fex::CIntensity::get(cv::Mat const&, cv::Scalar_<double>)'
    /usr/bin/ld: CMakeFiles/Demo_FEX.dir/Demo_FEX.cpp.o: in function `DirectGraphicalModels::fex::CCommonFeatureExtractor::getSaturation() const':
    Demo FEX.cpp:(.text._ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor13getSaturationEv[_ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor13getSaturationEv]+0x46): undefined reference to `DirectGraphicalModels::fex::CHSV::get(cv::Mat const&)'
    /usr/bin/ld: Demo FEX.cpp:(.text._ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor13getSaturationEv[_ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor13getSaturationEv]+0x77): undefined reference to `DirectGraphicalModels::fex::CCommonFeatureExtractor::getChannel(int) const'
    /usr/bin/ld: CMakeFiles/Demo_FEX.dir/Demo_FEX.cpp.o: in function `DirectGraphicalModels::fex::CCommonFeatureExtractor::getNDVI(unsigned char) const':
    Demo FEX.cpp:(.text._ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor7getNDVIEh[_ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor7getNDVIEh]+0x52): undefined reference to `DirectGraphicalModels::fex::CNDVI::get(cv::Mat const&, unsigned char)'
    /usr/bin/ld: CMakeFiles/Demo_FEX.dir/Demo_FEX.cpp.o: in function `DirectGraphicalModels::fex::CCommonFeatureExtractor::getVariance(DirectGraphicalModels::fex::SqNeighbourhood) const':
    Demo FEX.cpp:(.text._ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor11getVarianceENS0_15SqNeighbourhoodE[_ZNK21DirectGraphicalModels3fex23CCommonFeatureExtractor11getVarianceENS0_15SqNeighbourhoodE]+0x5f): undefined reference to `DirectGraphicalModels::fex::CVariance::get(cv::Mat const&, DirectGraphicalModels::fex::SqNeighbourhood)'
    collect2: error: ld returned 1 exit status
    make[2]: *** [demos/CMakeFiles/Demo_FEX.dir/build.make:92: bin/Demo FEX] Error 1
    make[1]: *** [CMakeFiles/Makefile2:413: demos/CMakeFiles/Demo_FEX.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....

Expected behavior The library does compile without errors.

Additional context Add any other context about the problem here.

ereator commented 3 years ago

Please try the following installation sequence according to the installation guide:

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local
make
make install
make clean

By another words, please try cmake .. -DCMAKE_BUILD_TYPE=RELEASE instead of simple cmake ..

christian-rauch commented 3 years ago

Building in release mode (-DCMAKE_BUILD_TYPE=RELEASE) works.

christian-rauch commented 3 years ago

Well, is there a reason why it should not build in Debug mode?