Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDAL doesn't build the 3Di driver on Ubuntu 22.04 #466

Open
elisalle opened this issue Aug 24, 2023 · 3 comments
Open

MDAL doesn't build the 3Di driver on Ubuntu 22.04 #466

elisalle opened this issue Aug 24, 2023 · 3 comments
Labels

Comments

@elisalle
Copy link

elisalle commented Aug 24, 2023

I noticed that when compiling MDAL on Ubuntu 22.04, the 3Di driver is not built.

tl;dr: the 3Di driver depends on SQLite3, which isn't found with the included FindSQLite3.cmake even when correctly installed; removing it to use the default FindSQLite3.cmake fixes that issue, but then the linker fails on mdal_unittests with an SQLite3 symbol error.

Full details are as follows:

The 3Di driver can only be built when the NetCDF and SQLite3 drivers are found:

#if defined HAVE_SQLITE3 && defined HAVE_NETCDF
#include "frmts/mdal_3di.hpp"
#endif

#if defined HAVE_SQLITE3 && defined HAVE_NETCDF
mDrivers.push_back( std::make_shared<MDAL::Driver3Di>() );
#endif

and when running cmake I get the following output:

$ cmake -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7")  
-- HDF5 VERSION 1.10.7
-- HDF5 ADD_DEFINITIONS 
-- Found GDAL: /usr/lib/libgdal.so (found version "3.4.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Found NetCDF: /usr/lib/x86_64-linux-gnu/libnetcdf.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (SQLITE3)
  does not match the name of the calling package (SQLite3).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  cmake/FindSQLite3.cmake:26 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:105 (FIND_PACKAGE)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find SQLITE3 (missing: SQLITE3_LIBRARY) 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
CMake Deprecation Warning at CMakeLists.txt:3 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/eli/Programs/MDAL/build/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at e2239ee6 Googletest export
[ 33%] Performing update step for 'googletest'
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
-- Found Python: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eli/Programs/MDAL/build

Consequently, as SQLite3 is not found, the mdal_3di driver is not built afterwards when running make.
SQLite3 is correctly installed, though:

$ apt list libsqlite3-dev
Listing... Done
libsqlite3-dev/jammy-updates,jammy-security,now 3.37.2-2ubuntu0.1 amd64 [installed,automatic]
libsqlite3-dev/jammy-updates,jammy-security 3.37.2-2ubuntu0.1 i386

Removing the custom FindSQLite3.cmake file from the project cmake directory to rely on the default cmake implementation of FindSQLite3.cmake fixes that problem, insofar that SQLite3 is now found:

$ cmake -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7")  
-- HDF5 VERSION 1.10.7
-- HDF5 ADD_DEFINITIONS 
-- Found GDAL: /usr/lib/libgdal.so (found version "3.4.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Found NetCDF: /usr/lib/x86_64-linux-gnu/libnetcdf.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
-- Found SQLite3: /usr/include (found version "3.37.2") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
CMake Deprecation Warning at CMakeLists.txt:3 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/eli/Programs/MDAL/build/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at e2239ee6 Googletest export
[ 33%] Performing update step for 'googletest'
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
-- Found Python: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/eli/Programs/MDAL/build

but now, when running make, although the mdal_3di driver is now successfully built, the build fails at the end when linking mdal_unittests:

$ make
[  0%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal.cpp.o
[  1%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_utils.cpp.o
[  2%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_driver_manager.cpp.o
[  3%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_data_model.cpp.o
[  4%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_datetime.cpp.o
[  4%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_logger.cpp.o
[  5%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_memory_data_model.cpp.o
[  6%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_driver.cpp.o
[  7%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_dynamic_driver.cpp.o
[  7%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_2dm.cpp.o
[  8%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xms_tin.cpp.o
[  9%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ascii_dat.cpp.o
[ 10%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_binary_dat.cpp.o
[ 10%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_selafin.cpp.o
[ 11%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_esri_tin.cpp.o
[ 12%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ply.cpp.o
[ 13%] Building CXX object mdal/CMakeFiles/mdal_a.dir/3rdparty/libplyxx/libplyxx.cpp.o
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:54: warning: "BIG_ENDIAN" redefined
   54 | #define BIG_ENDIAN 1
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:28: note: this is the location of the previous definition
   28 | # define BIG_ENDIAN     __BIG_ENDIAN
      | 
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:55: warning: "LITTLE_ENDIAN" redefined
   55 | #define LITTLE_ENDIAN 0
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:27: note: this is the location of the previous definition
   27 | # define LITTLE_ENDIAN  __LITTLE_ENDIAN
      | 
[ 14%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xmdf.cpp.o
[ 14%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_hdf5.cpp.o
[ 15%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_flo2d.cpp.o
[ 16%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_hec2d.cpp.o
[ 17%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal.cpp.o
[ 17%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal_grib.cpp.o
[ 18%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_h2i.cpp.o
[ 19%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_cf.cpp.o
[ 20%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ugrid.cpp.o
[ 20%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_netcdf.cpp.o
[ 21%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_sww.cpp.o
[ 22%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_tuflowfv.cpp.o
[ 23%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal_netcdf.cpp.o
[ 25%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xml.cpp.o
[ 25%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xdmf.cpp.o
[ 26%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_sqlite3.cpp.o
[ 27%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_3di.cpp.o
[ 28%] Linking CXX static library libmdal_a.a
[ 28%] Built target mdal_a
[ 28%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal.cpp.o
[ 29%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_utils.cpp.o
[ 30%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_driver_manager.cpp.o
[ 31%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_data_model.cpp.o
[ 32%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_datetime.cpp.o
[ 32%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_logger.cpp.o
[ 33%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_memory_data_model.cpp.o
[ 34%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_driver.cpp.o
[ 35%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_dynamic_driver.cpp.o
[ 35%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_2dm.cpp.o
[ 36%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xms_tin.cpp.o
[ 37%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ascii_dat.cpp.o
[ 38%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_binary_dat.cpp.o
[ 38%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_selafin.cpp.o
[ 39%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_esri_tin.cpp.o
[ 40%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ply.cpp.o
[ 41%] Building CXX object mdal/CMakeFiles/mdal.dir/3rdparty/libplyxx/libplyxx.cpp.o
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:54: warning: "BIG_ENDIAN" redefined
   54 | #define BIG_ENDIAN 1
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:28: note: this is the location of the previous definition
   28 | # define BIG_ENDIAN     __BIG_ENDIAN
      | 
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:55: warning: "LITTLE_ENDIAN" redefined
   55 | #define LITTLE_ENDIAN 0
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:27: note: this is the location of the previous definition
   27 | # define LITTLE_ENDIAN  __LITTLE_ENDIAN
      | 
[ 42%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xmdf.cpp.o
[ 42%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_hdf5.cpp.o
[ 43%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_flo2d.cpp.o
[ 44%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_hec2d.cpp.o
[ 45%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal.cpp.o
[ 45%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal_grib.cpp.o
[ 46%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_h2i.cpp.o
[ 47%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_cf.cpp.o
[ 48%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ugrid.cpp.o
[ 48%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_netcdf.cpp.o
[ 50%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_sww.cpp.o
[ 51%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_tuflowfv.cpp.o
[ 52%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal_netcdf.cpp.o
[ 53%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xml.cpp.o
[ 53%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xdmf.cpp.o
[ 54%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_sqlite3.cpp.o
[ 55%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_3di.cpp.o
[ 56%] Linking CXX shared library libmdal.so
[ 56%] Built target mdal
[ 57%] Building CXX object tools/CMakeFiles/mdalinfo.dir/mdalinfo.cpp.o
[ 58%] Linking CXX executable mdalinfo
[ 58%] Built target mdalinfo
[ 59%] Building CXX object tools/CMakeFiles/mdal_translate.dir/mdal_translate.cpp.o
[ 60%] Linking CXX executable mdal_translate
[ 60%] Built target mdal_translate
[ 61%] Building CXX object tests/CMakeFiles/mdaltestutils.dir/mdal_testutils.cpp.o
[ 61%] Built target mdaltestutils
[ 61%] Building CXX object googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 62%] Linking CXX static library ../../lib/libgtest.a
[ 62%] Built target gtest
[ 62%] Building CXX object googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 63%] Linking CXX static library ../../lib/libgmock.a
[ 63%] Built target gmock
[ 63%] Building CXX object tests/CMakeFiles/mdal_2dm_test.dir/test_2dm.cpp.o
[ 64%] Linking CXX executable mdal_2dm_test
[ 64%] Built target mdal_2dm_test
[ 64%] Building CXX object tests/CMakeFiles/mdal_xms_tin_test.dir/test_xms_tin.cpp.o
[ 65%] Linking CXX executable mdal_xms_tin_test
[ 65%] Built target mdal_xms_tin_test
[ 65%] Building CXX object tests/CMakeFiles/mdal_api_test.dir/test_api.cpp.o
[ 66%] Linking CXX executable mdal_api_test
[ 66%] Built target mdal_api_test
[ 67%] Building CXX object tests/CMakeFiles/mdal_ascii_dat_test.dir/test_ascii_dat.cpp.o
[ 68%] Linking CXX executable mdal_ascii_dat_test
[ 68%] Built target mdal_ascii_dat_test
[ 68%] Building CXX object tests/CMakeFiles/mdal_binary_dat_test.dir/test_binary_dat.cpp.o
[ 69%] Linking CXX executable mdal_binary_dat_test
[ 69%] Built target mdal_binary_dat_test
[ 70%] Building CXX object tests/CMakeFiles/mdal_selafin_test.dir/test_selafin.cpp.o
[ 71%] Linking CXX executable mdal_selafin_test
[ 71%] Built target mdal_selafin_test
[ 72%] Building CXX object tests/CMakeFiles/mdal_esri_tin_test.dir/test_esri_tin.cpp.o
[ 73%] Linking CXX executable mdal_esri_tin_test
[ 73%] Built target mdal_esri_tin_test
[ 75%] Building CXX object tests/CMakeFiles/mdal_h2i_test.dir/test_h2i.cpp.o
[ 76%] Linking CXX executable mdal_h2i_test
[ 76%] Built target mdal_h2i_test
[ 76%] Building CXX object tests/CMakeFiles/mdal_ply_test.dir/test_ply.cpp.o
[ 77%] Linking CXX executable mdal_ply_test
[ 77%] Built target mdal_ply_test
[ 78%] Building CXX object tests/CMakeFiles/mdal_xmdf_test.dir/test_xmdf.cpp.o
[ 79%] Linking CXX executable mdal_xmdf_test
[ 79%] Built target mdal_xmdf_test
[ 80%] Building CXX object tests/CMakeFiles/mdal_flo2d_test.dir/test_flo2d.cpp.o
[ 80%] Linking CXX executable mdal_flo2d_test
[ 80%] Built target mdal_flo2d_test
[ 81%] Building CXX object tests/CMakeFiles/mdal_hec2d_test.dir/test_hec2d.cpp.o
[ 82%] Linking CXX executable mdal_hec2d_test
[ 82%] Built target mdal_hec2d_test
[ 83%] Building CXX object tests/CMakeFiles/mdal_gdal_grib_test.dir/test_gdal_grib.cpp.o
[ 84%] Linking CXX executable mdal_gdal_grib_test
[ 84%] Built target mdal_gdal_grib_test
[ 84%] Building CXX object tests/CMakeFiles/mdal_sww_test.dir/test_sww.cpp.o
[ 85%] Linking CXX executable mdal_sww_test
[ 85%] Built target mdal_sww_test
[ 86%] Building CXX object tests/CMakeFiles/mdal_ugrid_test.dir/test_ugrid.cpp.o
[ 87%] Linking CXX executable mdal_ugrid_test
[ 87%] Built target mdal_ugrid_test
[ 87%] Building CXX object tests/CMakeFiles/mdal_tuflowfv_test.dir/test_tuflowfv.cpp.o
[ 88%] Linking CXX executable mdal_tuflowfv_test
[ 88%] Built target mdal_tuflowfv_test
[ 89%] Building CXX object tests/CMakeFiles/mdal_3di_test.dir/test_3di.cpp.o
[ 90%] Linking CXX executable mdal_3di_test
[ 90%] Built target mdal_3di_test
[ 91%] Building CXX object tests/CMakeFiles/mdal_gdal_netcdf_test.dir/test_gdal_netcdf.cpp.o
[ 91%] Linking CXX executable mdal_gdal_netcdf_test
[ 91%] Built target mdal_gdal_netcdf_test
[ 91%] Building CXX object tests/CMakeFiles/mdal_xdmf_test.dir/test_xdmf.cpp.o
[ 92%] Linking CXX executable mdal_xdmf_test
[ 92%] Built target mdal_xdmf_test
[ 93%] Building CXX object tests/CMakeFiles/mdal_dynamic_driver_test.dir/test_dynamic_driver.cpp.o
[ 93%] Linking CXX executable mdal_dynamic_driver_test
[ 93%] Built target mdal_dynamic_driver_test
[ 94%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/mdal_unittests.cpp.o
[ 94%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/test_mdal_utils.cpp.o
[ 95%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/test_mdal_datetime.cpp.o
[ 96%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/mdal_testutils.cpp.o
[ 97%] Linking CXX executable mdal_unittests
/usr/bin/ld: ../mdal/libmdal_a.a(mdal_sqlite3.cpp.o): undefined reference to symbol 'sqlite3_column_count'
/usr/bin/ld: /lib/x86_64-linux-gnu/libsqlite3.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/mdal_unittests.dir/build.make:160: tests/mdal_unittests] Error 1
make[1]: *** [CMakeFiles/Makefile2:1733: tests/CMakeFiles/mdal_unittests.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
@elisalle elisalle changed the title MDAL doesn't build the 3Di driver MDAL doesn't build the 3Di driver on Ubuntu 22.04 Aug 24, 2023
@PeterPetrik
Copy link
Contributor

specify correct SQLITE3 on command line

cmake -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON -DSQLITE3_INCLUDE_DIR=<your_sqlite3_incl_dir> -D SQLITE3_LIBRARY=<your_sqlite3_lib_full_path>

also when you run the executable, make sure that sqlite3 library is on your LD_LIBRARY_PATH. when you use different one it crashes

@elisalle
Copy link
Author

elisalle commented Aug 24, 2023

I tried specifying the SQLite3 driver explicitly, but that made no difference:

$ cmake .. -DSQLITE3_INCLUDE_DIR=/usr/include -DSQLITE3_LIBRARY=/usr/lib/x86_64-linux-gnu/libsqlite3.so -DCMAKE_BUILD_TYPE=Rel -DENABLE_TESTS=ON
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7")  
-- HDF5 VERSION 1.10.7
-- HDF5 ADD_DEFINITIONS 
-- Found GDAL: /usr/lib/libgdal.so (found version "3.4.1") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Found NetCDF: /usr/lib/x86_64-linux-gnu/libnetcdf.so  
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.13") 
-- Found SQLite3: /usr/include (found version "3.37.2") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
CMake Deprecation Warning at CMakeLists.txt:3 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/eli/Programs/MDAL/build/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
HEAD is now at e2239ee6 Googletest export
[ 33%] Performing update step for 'googletest'
[ 44%] No patch step for 'googletest'
[ 55%] No configure step for 'googletest'
[ 66%] No build step for 'googletest'
[ 77%] No install step for 'googletest'
[ 88%] No test step for 'googletest'
[100%] Completed 'googletest'
[100%] Built target googletest
-- Found Python: /usr/bin/python3.10 (found version "3.10.12") found components: Interpreter 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    SQLITE3_LIBRARY


-- Build files have been written to: /home/eli/Programs/MDAL/build

When running make afterwards, the result was exactly the same:

$ make
[  0%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal.cpp.o
[  1%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_utils.cpp.o
[  2%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_driver_manager.cpp.o
[  3%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_data_model.cpp.o
[  4%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_datetime.cpp.o
[  4%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_logger.cpp.o
[  5%] Building CXX object mdal/CMakeFiles/mdal_a.dir/mdal_memory_data_model.cpp.o
[  6%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_driver.cpp.o
[  7%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_dynamic_driver.cpp.o
[  7%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_2dm.cpp.o
[  8%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xms_tin.cpp.o
[  9%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ascii_dat.cpp.o
[ 10%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_binary_dat.cpp.o
[ 10%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_selafin.cpp.o
[ 11%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_esri_tin.cpp.o
[ 12%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ply.cpp.o
[ 13%] Building CXX object mdal/CMakeFiles/mdal_a.dir/3rdparty/libplyxx/libplyxx.cpp.o
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:54: warning: "BIG_ENDIAN" redefined
   54 | #define BIG_ENDIAN 1
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:28: note: this is the location of the previous definition
   28 | # define BIG_ENDIAN     __BIG_ENDIAN
      | 
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:55: warning: "LITTLE_ENDIAN" redefined
   55 | #define LITTLE_ENDIAN 0
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:27: note: this is the location of the previous definition
   27 | # define LITTLE_ENDIAN  __LITTLE_ENDIAN
      | 
[ 14%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xmdf.cpp.o
[ 14%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_hdf5.cpp.o
[ 15%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_flo2d.cpp.o
[ 16%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_hec2d.cpp.o
[ 17%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal.cpp.o
[ 17%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal_grib.cpp.o
[ 18%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_h2i.cpp.o
[ 19%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_cf.cpp.o
[ 20%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_ugrid.cpp.o
[ 20%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_netcdf.cpp.o
[ 21%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_sww.cpp.o
[ 22%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_tuflowfv.cpp.o
[ 23%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_gdal_netcdf.cpp.o
[ 25%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xml.cpp.o
[ 25%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_xdmf.cpp.o
[ 26%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_sqlite3.cpp.o
[ 27%] Building CXX object mdal/CMakeFiles/mdal_a.dir/frmts/mdal_3di.cpp.o
[ 28%] Linking CXX static library libmdal_a.a
[ 28%] Built target mdal_a
[ 28%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal.cpp.o
[ 29%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_utils.cpp.o
[ 30%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_driver_manager.cpp.o
[ 31%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_data_model.cpp.o
[ 32%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_datetime.cpp.o
[ 32%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_logger.cpp.o
[ 33%] Building CXX object mdal/CMakeFiles/mdal.dir/mdal_memory_data_model.cpp.o
[ 34%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_driver.cpp.o
[ 35%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_dynamic_driver.cpp.o
[ 35%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_2dm.cpp.o
[ 36%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xms_tin.cpp.o
[ 37%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ascii_dat.cpp.o
[ 38%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_binary_dat.cpp.o
[ 38%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_selafin.cpp.o
[ 39%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_esri_tin.cpp.o
[ 40%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ply.cpp.o
[ 41%] Building CXX object mdal/CMakeFiles/mdal.dir/3rdparty/libplyxx/libplyxx.cpp.o
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:54: warning: "BIG_ENDIAN" redefined
   54 | #define BIG_ENDIAN 1
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:28: note: this is the location of the previous definition
   28 | # define BIG_ENDIAN     __BIG_ENDIAN
      | 
/home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:55: warning: "LITTLE_ENDIAN" redefined
   55 | #define LITTLE_ENDIAN 0
      | 
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:176,
                 from /usr/include/stdlib.h:395,
                 from /usr/include/c++/11/cstdlib:75,
                 from /usr/include/c++/11/bits/stl_algo.h:59,
                 from /usr/include/c++/11/functional:65,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx.h:55,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx_internal.h:48,
                 from /home/eli/Programs/MDAL/mdal/3rdparty/libplyxx/libplyxx.cpp:47:
/usr/include/endian.h:27: note: this is the location of the previous definition
   27 | # define LITTLE_ENDIAN  __LITTLE_ENDIAN
      | 
[ 42%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xmdf.cpp.o
[ 42%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_hdf5.cpp.o
[ 43%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_flo2d.cpp.o
[ 44%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_hec2d.cpp.o
[ 45%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal.cpp.o
[ 45%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal_grib.cpp.o
[ 46%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_h2i.cpp.o
[ 47%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_cf.cpp.o
[ 48%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_ugrid.cpp.o
[ 48%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_netcdf.cpp.o
[ 50%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_sww.cpp.o
[ 51%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_tuflowfv.cpp.o
[ 52%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_gdal_netcdf.cpp.o
[ 53%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xml.cpp.o
[ 53%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_xdmf.cpp.o
[ 54%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_sqlite3.cpp.o
[ 55%] Building CXX object mdal/CMakeFiles/mdal.dir/frmts/mdal_3di.cpp.o
[ 56%] Linking CXX shared library libmdal.so
[ 56%] Built target mdal
[ 57%] Building CXX object tools/CMakeFiles/mdalinfo.dir/mdalinfo.cpp.o
[ 58%] Linking CXX executable mdalinfo
[ 58%] Built target mdalinfo
[ 59%] Building CXX object tools/CMakeFiles/mdal_translate.dir/mdal_translate.cpp.o
[ 60%] Linking CXX executable mdal_translate
[ 60%] Built target mdal_translate
[ 61%] Building CXX object tests/CMakeFiles/mdaltestutils.dir/mdal_testutils.cpp.o
[ 61%] Built target mdaltestutils
[ 61%] Building CXX object googletest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 62%] Linking CXX static library ../../lib/libgtest.a
[ 62%] Built target gtest
[ 62%] Building CXX object googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o
[ 63%] Linking CXX static library ../../lib/libgmock.a
[ 63%] Built target gmock
[ 63%] Building CXX object tests/CMakeFiles/mdal_2dm_test.dir/test_2dm.cpp.o
[ 64%] Linking CXX executable mdal_2dm_test
[ 64%] Built target mdal_2dm_test
[ 64%] Building CXX object tests/CMakeFiles/mdal_xms_tin_test.dir/test_xms_tin.cpp.o
[ 65%] Linking CXX executable mdal_xms_tin_test
[ 65%] Built target mdal_xms_tin_test
[ 65%] Building CXX object tests/CMakeFiles/mdal_api_test.dir/test_api.cpp.o
[ 66%] Linking CXX executable mdal_api_test
[ 66%] Built target mdal_api_test
[ 67%] Building CXX object tests/CMakeFiles/mdal_ascii_dat_test.dir/test_ascii_dat.cpp.o
[ 68%] Linking CXX executable mdal_ascii_dat_test
[ 68%] Built target mdal_ascii_dat_test
[ 68%] Building CXX object tests/CMakeFiles/mdal_binary_dat_test.dir/test_binary_dat.cpp.o
[ 69%] Linking CXX executable mdal_binary_dat_test
[ 69%] Built target mdal_binary_dat_test
[ 70%] Building CXX object tests/CMakeFiles/mdal_selafin_test.dir/test_selafin.cpp.o
[ 71%] Linking CXX executable mdal_selafin_test
[ 71%] Built target mdal_selafin_test
[ 72%] Building CXX object tests/CMakeFiles/mdal_esri_tin_test.dir/test_esri_tin.cpp.o
[ 73%] Linking CXX executable mdal_esri_tin_test
[ 73%] Built target mdal_esri_tin_test
[ 75%] Building CXX object tests/CMakeFiles/mdal_h2i_test.dir/test_h2i.cpp.o
[ 76%] Linking CXX executable mdal_h2i_test
[ 76%] Built target mdal_h2i_test
[ 76%] Building CXX object tests/CMakeFiles/mdal_ply_test.dir/test_ply.cpp.o
[ 77%] Linking CXX executable mdal_ply_test
[ 77%] Built target mdal_ply_test
[ 78%] Building CXX object tests/CMakeFiles/mdal_xmdf_test.dir/test_xmdf.cpp.o
[ 79%] Linking CXX executable mdal_xmdf_test
[ 79%] Built target mdal_xmdf_test
[ 80%] Building CXX object tests/CMakeFiles/mdal_flo2d_test.dir/test_flo2d.cpp.o
[ 80%] Linking CXX executable mdal_flo2d_test
[ 80%] Built target mdal_flo2d_test
[ 81%] Building CXX object tests/CMakeFiles/mdal_hec2d_test.dir/test_hec2d.cpp.o
[ 82%] Linking CXX executable mdal_hec2d_test
[ 82%] Built target mdal_hec2d_test
[ 83%] Building CXX object tests/CMakeFiles/mdal_gdal_grib_test.dir/test_gdal_grib.cpp.o
[ 84%] Linking CXX executable mdal_gdal_grib_test
[ 84%] Built target mdal_gdal_grib_test
[ 84%] Building CXX object tests/CMakeFiles/mdal_sww_test.dir/test_sww.cpp.o
[ 85%] Linking CXX executable mdal_sww_test
[ 85%] Built target mdal_sww_test
[ 86%] Building CXX object tests/CMakeFiles/mdal_ugrid_test.dir/test_ugrid.cpp.o
[ 87%] Linking CXX executable mdal_ugrid_test
[ 87%] Built target mdal_ugrid_test
[ 87%] Building CXX object tests/CMakeFiles/mdal_tuflowfv_test.dir/test_tuflowfv.cpp.o
[ 88%] Linking CXX executable mdal_tuflowfv_test
[ 88%] Built target mdal_tuflowfv_test
[ 89%] Building CXX object tests/CMakeFiles/mdal_3di_test.dir/test_3di.cpp.o
[ 90%] Linking CXX executable mdal_3di_test
[ 90%] Built target mdal_3di_test
[ 91%] Building CXX object tests/CMakeFiles/mdal_gdal_netcdf_test.dir/test_gdal_netcdf.cpp.o
[ 91%] Linking CXX executable mdal_gdal_netcdf_test
[ 91%] Built target mdal_gdal_netcdf_test
[ 91%] Building CXX object tests/CMakeFiles/mdal_xdmf_test.dir/test_xdmf.cpp.o
[ 92%] Linking CXX executable mdal_xdmf_test
[ 92%] Built target mdal_xdmf_test
[ 93%] Building CXX object tests/CMakeFiles/mdal_dynamic_driver_test.dir/test_dynamic_driver.cpp.o
[ 93%] Linking CXX executable mdal_dynamic_driver_test
[ 93%] Built target mdal_dynamic_driver_test
[ 94%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/mdal_unittests.cpp.o
[ 94%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/test_mdal_utils.cpp.o
[ 95%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/unittests/test_mdal_datetime.cpp.o
[ 96%] Building CXX object tests/CMakeFiles/mdal_unittests.dir/mdal_testutils.cpp.o
[ 97%] Linking CXX executable mdal_unittests
/usr/bin/ld: ../mdal/libmdal_a.a(mdal_sqlite3.cpp.o): undefined reference to symbol 'sqlite3_column_count'
/usr/bin/ld: /lib/x86_64-linux-gnu/libsqlite3.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [tests/CMakeFiles/mdal_unittests.dir/build.make:160: tests/mdal_unittests] Error 1
make[1]: *** [CMakeFiles/Makefile2:1733: tests/CMakeFiles/mdal_unittests.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

@elisalle
Copy link
Author

elisalle commented Aug 29, 2023

update: I forgot to add the custom FindSQLite3.cmake file back. When I use the custom FindSQLite3.cmake from this repo and pass in the SQLite3 library paths by hand, it works.

So in summary:
The repo's custom FindSQLite3.cmake cannot discover the SQLite3 libraries, but links them correctly if they are found.
CMake's default FindSQLite3.cmake correctly autodiscovers the SQLite3 libraries, but doesn't link them in a way recognised by the project.
Using the custom FindSQLite3.cmake but manually passing in the library paths circumvents the autodiscovery issue allows the libraries to be properly linked, meaning that the 3Di driver is built.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants