swiss-seismological-service / scdetect

A computationally efficient earthquake detection module for SeisComP
https://scdetect.readthedocs.io
GNU Affero General Public License v3.0
15 stars 6 forks source link

sqlite3 linking error #114

Closed damb closed 2 years ago

damb commented 2 years ago

The continuation from #112.

/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::open()':
sqlite.cpp:(.text+0x354): undefined reference to `sqlite3_open'
/usr/bin/ld: sqlite.cpp:(.text+0x413): undefined reference to `sqlite3_close'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::disconnect()':
sqlite.cpp:(.text+0x4f1): undefined reference to `sqlite3_close'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::execute(char const*)':
sqlite.cpp:(.text+0x63e): undefined reference to `sqlite3_exec'
/usr/bin/ld: sqlite.cpp:(.text+0x6fb): undefined reference to `sqlite3_free'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::beginQuery(char const*)':
sqlite.cpp:(.text+0x85b): undefined reference to `sqlite3_prepare'
/usr/bin/ld: sqlite.cpp:(.text+0x895): undefined reference to `sqlite3_column_count'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::endQuery()':
sqlite.cpp:(.text+0x8e9): undefined reference to `sqlite3_finalize'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::lastInsertId(char const*)':
sqlite.cpp:(.text+0x93f): undefined reference to `sqlite3_last_insert_rowid'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::numberOfAffectedRows()':
sqlite.cpp:(.text+0x97b): undefined reference to `sqlite3_changes'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::fetchRow()':
sqlite.cpp:(.text+0x9b3): undefined reference to `sqlite3_step'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::findColumn(char const*)':
sqlite.cpp:(.text+0x9ed): undefined reference to `sqlite3_column_name'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::getRowFieldName(int)':
sqlite.cpp:(.text+0xa63): undefined reference to `sqlite3_column_name'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::getRowField(int)':
sqlite.cpp:(.text+0xa8d): undefined reference to `sqlite3_column_blob'
/usr/bin/ld: CMakeFiles/test_scdetect_cc_integration.dir/__/detail/sqlite.cpp.o: in function `Seiscomp::detect::detail::SQLiteDatabase::getRowFieldSize(int)':
sqlite.cpp:(.text+0xab7): undefined reference to `sqlite3_column_bytes'
collect2: error: ld returned 1 exit status
make[2]: *** [src/extras/scdetect/src/apps/cc/test/CMakeFiles/test_scdetect_cc_integration.dir/build.make:984: bin/test_scdetect_cc_integration] Error 1
make[1]: *** [CMakeFiles/Makefile2:10329: src/extras/scdetect/src/apps/cc/test/CMakeFiles/test_scdetect_cc_integration.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

I use sqlite 3.39.0

morealaz commented 2 years ago

I test it under Debian 11 and got same linking error

damb commented 2 years ago

Again, thanks for reporting @morealaz.

Most probably, I simply forgot to link the library where it would have been required. As a workaround enabling SQLite support globally (i.e. when configuring the SeisComP build) should work as well.

I'll look into into it and will come back.

damb commented 2 years ago

Does #115 solve the linking issue on your side?

morealaz commented 2 years ago

As a workaround enabling SQLite support globally (i.e. when configuring the SeisComP build) should work as well.

I did this and it worked but test_scdetect_cc_integration test failed.

Does #115 solve the linking issue on your side?

It worked but Without enabling SQLite support globally, 7 test failed, including

with enabling SQLite support globally only test_scdetect_cc_integration test failed.

damb commented 2 years ago

AFAIU, running SeisComP tests for some modules (e.g. fdsnws) requires to enable SQLite3 support globally.

ctest -V -R '^test_scdetect_cc.*'

executed from within the build directory.

morealaz commented 2 years ago

AFAIU, running SeisComP tests for some modules (e.g. fdsnws) requires to enable SQLite3 support globally.

Probably that explain other failed tests

Does Link against libsqlite3 #115 solve the linking issue on your side, as well (i.e. without enabling SQLite support globally)? (I tested on archlinx, already, though it would be good to have the confirmation from your side, as well.)

Yes it fixed linking issue.

Regarding the failing test_scdetect_cc_integration tests: could you please open another issue with more details? Particularly, I'm interested in the output of the command

ctest -V -R '^test_scdetect_cc.*'

executed from within the build directory.

Ok, I've done it in #116 .