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

fatal error: 'mysql.h' file not found #1152

Open
triplq opened this issue Jun 5, 2024 · 22 comments · May be fixed by #1118
Open

fatal error: 'mysql.h' file not found #1152

triplq opened this issue Jun 5, 2024 · 22 comments · May be fixed by #1118
Labels

Comments

@triplq
Copy link

triplq commented Jun 5, 2024

clone soci into /Users/alexey/CLionProjects/untitled1/lib/soci with terminal git clone and write a CMakeLists.txt as in example/subdir-include/CMakeLists.txt

Here is my CMakeLists.txt:

project(untitled1)

set(CMAKE_CXX_STANDARD 17)
set(SOCI_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/soci)

find_package(Soci REQUIRED)

option(SOCI_MYSQL "Build the sample backend called MySQL" ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/soci ${SOCI_BINARY_DIR})

add_executable(untitled1 untitled1.cpp)

target_link_libraries(untitled1 soci_core soci_mysql)

Here is my error:

/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake --build /Users/alexey/CLionProjects/untitled1/cmake-build-debug --target untitled1 -j 6
[0/1] Re-running CMake...
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found version "1.85.0")  
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.85.0/BoostConfig.cmake (found suitable version "1.85.0", minimum required is "1.55.0") found components: system filesystem 
-- gcc / clang visibility enabled
-- Configuring SOCI: 
-- SOCI_VERSION                             = 4.1.0 
-- SOCI_ABI_VERSION                         = 4.1 
-- SOCI_SHARED                              = ON 
-- SOCI_STATIC                              = ON 
-- SOCI_TESTS                               = ON 
-- SOCI_ASAN                                = OFF 
-- LIB_SUFFIX                               =  
-- Looking for SOCI dependencies: 
-- Threads: 
-- CMAKE_THREAD_LIBS_INIT                   =  
-- Boost: 
-- BOOST_RELEASE_VERSION                    =  
-- BOOST_INCLUDE_DIR                        =  
-- BOOST_LIBRARIES                          =  
-- MySQL: 
-- Found MySQL: /opt/homebrew/include/mysql, /opt/homebrew/lib/libmysqlclient.dylib
-- MYSQL_INCLUDE_DIR                        = /opt/homebrew/include/mysql 
-- MYSQL_LIBRARIES                          = /opt/homebrew/lib/libmysqlclient.dylib 
-- ODBC: 
-- WARNING: ODBC libraries not found, some features will be disabled. 
-- Oracle: 
-- ORACLE_HOME=
-- None of the supported Oracle versions (21;20;19;18;12;11;10) could be found, consider updating ORACLE_VERSIONS if the version you use is not among them.
-- WARNING: Oracle libraries not found, some features will be disabled. 
-- PostgreSQL: 
-- WARNING: PostgreSQL libraries not found, some features will be disabled. 
-- SQLite3: 
-- SQLITE3_INCLUDE_DIR                      = /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include 
-- SQLITE3_LIBRARIES                        = /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libsqlite3.tbd 
-- Firebird: 
-- SOCI_FIREBIRD_EMBEDDED                   = OFF 
-- WARNING: Firebird libraries not found, some features will be disabled. 
-- DB2: 
-- WARNING: DB2 libraries not found, some features will be disabled. 
-- Configuring SOCI core library: 
-- SOCI_CORE_TARGET                         = soci_core 
-- SOCI_CORE_TARGET_OUTPUT_NAME             = soci_core 
-- SOCI_CORE_DEPS_LIBS                      = /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libdl.tbd Boost::date_time 
-- SOCI_CORE_INCLUDE_DIRS                   = /Users/alexey/CLionProjects/untitled1/lib/soci/cmake /opt/homebrew/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci /Users/alexey/CLionProjects/untitled1/lib/soci/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/include /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/src/core 
-- WITH_BOOST                               = ON 
-- COMPILE_DEFINITIONS                      = SOCI_ABI_VERSION="4.1" HAVE_DL=1 BOOST_ALL_NO_LIB SOCI_LIB_PREFIX="libsoci_" SOCI_LIB_SUFFIX=".dylib" SOCI_DEBUG_POSTFIX="" 
-- 
-- Configuring SOCI backend libraries: 
-- Found MySQL: /opt/homebrew/include/mysql, /opt/homebrew/lib/libmysqlclient.dylib
-- ORACLE_HOME=
-- None of the supported Oracle versions (21;20;19;18;12;11;10) could be found, consider updating ORACLE_VERSIONS if the version you use is not among them.
-- Empty - SOCI backend skeleton for new backends development 
-- SOCI_EMPTY                               = ON 
-- SOCI_EMPTY_TARGET                        = soci_empty 
-- SOCI_EMPTY_OUTPUT_NAME                   = soci_empty 
-- SOCI_EMPTY_COMPILE_DEFINITIONS           = SOCI_ABI_VERSION="4.1" HAVE_DL=1 BOOST_ALL_NO_LIB 
-- SOCI_EMPTY_INCLUDE_DIRECTORIES           = /Users/alexey/CLionProjects/untitled1/lib/soci/cmake /opt/homebrew/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci /Users/alexey/CLionProjects/untitled1/lib/soci/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/include /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /Users/alexey/CLionProjects/untitled1/lib/soci/include/private 
-- MySQL - SOCI backend for MySQL 
-- SOCI_MYSQL                               = ON 
-- SOCI_MYSQL_TARGET                        = soci_mysql 
-- SOCI_MYSQL_OUTPUT_NAME                   = soci_mysql 
-- SOCI_MYSQL_COMPILE_DEFINITIONS           = SOCI_ABI_VERSION="4.1" HAVE_DL=1 BOOST_ALL_NO_LIB 
-- SOCI_MYSQL_INCLUDE_DIRECTORIES           = /Users/alexey/CLionProjects/untitled1/lib/soci/cmake /opt/homebrew/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci /Users/alexey/CLionProjects/untitled1/lib/soci/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/include /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /opt/homebrew/include/mysql 
-- SQLite3 - SOCI backend for SQLite 3 
-- SOCI_SQLITE3                             = ON 
-- SOCI_SQLITE3_TARGET                      = soci_sqlite3 
-- SOCI_SQLITE3_OUTPUT_NAME                 = soci_sqlite3 
-- SOCI_SQLITE3_COMPILE_DEFINITIONS         = SOCI_ABI_VERSION="4.1" HAVE_DL=1 BOOST_ALL_NO_LIB 
-- SOCI_SQLITE3_INCLUDE_DIRECTORIES         = /Users/alexey/CLionProjects/untitled1/lib/soci/cmake /opt/homebrew/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci /Users/alexey/CLionProjects/untitled1/lib/soci/include /Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/include /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /Users/alexey/CLionProjects/untitled1/lib/soci/include/private /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include 
-- 
-- Configuring SOCI tests: 
-- SOCI_EMPTY_TEST_CONNSTR                  = dummy
-- SOCI_MYSQL_TEST_CONNSTR                  = db=soci_test
-- MS Access test disabled on non-Windows platform
-- ODBC DB2 test disabled.
-- SOCI_SQLITE3_TEST_CONNSTR                = :memory:
-- 
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/alexey/CLionProjects/untitled1/cmake-build-debug
[2/6] Linking CXX shared library lib/libsoci_mysql.4.1.0.dylib
ld: warning: -undefined suppress is deprecated
[4/6] Building CXX object CMakeFiles/untitled1.dir/untitled1.cpp.o
FAILED: CMakeFiles/untitled1.dir/untitled1.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DBOOST_DATE_TIME_DYN_LINK -DBOOST_DATE_TIME_NO_LIB -I/Users/alexey/CLionProjects/untitled1/lib/soci/cmake -I/Users/alexey/CLionProjects/untitled1/lib/soci/src/core/../../include -I/Users/alexey/CLionProjects/untitled1/cmake-build-debug/soci/src/core/../../include -isystem /opt/homebrew/include -g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -fcolor-diagnostics -MD -MT CMakeFiles/untitled1.dir/untitled1.cpp.o -MF CMakeFiles/untitled1.dir/untitled1.cpp.o.d -o CMakeFiles/untitled1.dir/untitled1.cpp.o -c /Users/alexey/CLionProjects/untitled1/untitled1.cpp
In file included from /Users/alexey/CLionProjects/untitled1/untitled1.cpp:2:
/Users/alexey/CLionProjects/untitled1/lib/soci/src/core/../../include/soci/mysql/soci-mysql.h:38:10: fatal error: 'mysql.h' file not found
#include <mysql.h> // MySQL Client
         ^~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.```
@vadz vadz added the CMake label Jun 8, 2024
@papoteur-mga
Copy link

I have the same problem trying to build xeus-sql 0.2.1 with soci 4.0.3

[ 25%] Building CXX object CMakeFiles/xeus-sql.dir/src/xeus_sql_interpreter.cpp.o
/usr/bin/g++ -DGUID_LIBUUID -DUSE_MYSQL=1 -DUSE_POSTGRE_SQL=1 -DUSE_SQLITE3=1 -DXEUS_SQL_EXPORTS -DXVEGA_EXPORTS -Dxeus_sql_EXPORTS -I/builddir/build/BUILD/xeus-sql-0.2.1/include -O2 -g -pipe -Wformat -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -m64 -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection=full -DNDEBUG -fPIC -Wunused-parameter -Wextra -Wreorder -march=native -MD -MT CMakeFiles/xeus-sql.dir/src/xeus_sql_interpreter.cpp.o -MF CMakeFiles/xeus-sql.dir/src/xeus_sql_interpreter.cpp.o.d -o CMakeFiles/xeus-sql.dir/src/xeus_sql_interpreter.cpp.o -c /builddir/build/BUILD/xeus-sql-0.2.1/src/xeus_sql_interpreter.cpp
In file included from /builddir/build/BUILD/xeus-sql-0.2.1/src/xeus_sql_interpreter.cpp:33:
/usr/include/soci/mysql/soci-mysql.h:24:10: fatal error: mysql.h: No such file or directory
   24 | #include <mysql.h> // MySQL Client
      |          ^~~~~~~~~
compilation terminated.

@vadz
Copy link
Member

vadz commented Jul 17, 2024

This seems rather different because I'd expect mysql.h to exist in /opt/homebrew/include, which is used for the include files search in the original report, while in your case there doesn't seem any appropriate -I option at all.

You will need to check how/where does CMake find this header.

@papoteur-mga
Copy link

This seems rather different because I'd expect mysql.h to exist in /opt/homebrew/include, which is used for the include files search in the original report, while in your case there doesn't seem any appropriate -I option at all.

You will need to check how/where does CMake find this header.

Yes, you're right. I don't know how this instruction is coming for you and not for me.
https://github.com/jupyter-xeus/xeus-sql/blob/main/CMakeLists.txt

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Aug 31, 2024

This is likely an issue with the SOCI-provided FindMySQL module (https://github.com/SOCI/soci/blob/master/cmake/modules/FindMySQL.cmake)

In #1118 I have improved the find-module.
@papoteur-mga would you be able to test whether the issue keeps appearing when building SOCI from the branch of my PR?
(Until proven otherwise, I'll assume the issue to be resolved in my revamped cmake version)

@Krzmbrzl Krzmbrzl linked a pull request Aug 31, 2024 that will close this issue
@papoteur-mga
Copy link

papoteur-mga commented Sep 1, 2024

In #1118 I have improved the find-module. @papoteur-mga would you be able to test whether the issue keeps appearing when building SOCI from the branch of my PR? (Until proven otherwise, I'll assume the issue to be resolved in my revamped cmake version)

Hi @Krzmbrzl
Thanks for you work. I tried to build soci from your repo. I encounter a problem that libraries are installed in /usr/lib64/soci/ directory, when they was previously in /usr/lib64/

Build instruction was:

/usr/bin/cmake -Wno-dev -S . -B build -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-DNDEBUG -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_INSTALL_LIBDIR:PATH=lib64 -DCMAKE_INSTALL_LIBEXECDIR:PATH=libexec -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_RUNSTATEDIR:PATH=/run -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLIB_SUFFIX=64 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-O1 -Wl,--build-id=sha1 -Wl,--enable-new-dtags -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -GNinja -DSOCI_STATIC=OFF -DSOCI_SHARED=ON -DSOCI_CXX11=ON -DSOCI_ASAN=OFF -DSOCI_EMPTY=ON -DSOCI_SQLITE3=ON -DSOCI_POSTGRESQL=ON -DSOCI_MYSQL=ON -DSOCI_ODBC=ON -DWITH_ORACLE=OFF -DBUILD_TESTS=NONE

@papoteur-mga
Copy link

Another problem is that /usr/lib64/libsoci_mysql.so is the library instead of being a link to the library, which have to be /usr/lib64/libsoci_mysql.so.4.1.0

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 1, 2024

I encounter a problem that libraries are installed in /usr/lib64/soci/ directory, when they was previously in /usr/lib64/

why is this a problem?

Another problem is that /usr/lib64/libsoci_mysql.so is the library instead of being a link to the library, which have to be /usr/lib64/libsoci_mysql.so.4.1.0

Yeah, I can reproduce that. It seems that this only affects MySQL though - I get

    └── soci
        ├── libsoci_core.so -> libsoci_core.so.4
        ├── libsoci_core.so.4 -> libsoci_core.so.4.1.0
        ├── libsoci_core.so.4.1.0
        ├── libsoci_empty.so -> libsoci_empty.so.4
        ├── libsoci_empty.so.4 -> libsoci_empty.so.4.1.0
        ├── libsoci_empty.so.4.1.0
        ├── libsoci_firebird.so -> libsoci_firebird.so.4
        ├── libsoci_firebird.so.4 -> libsoci_firebird.so.4.1.0
        ├── libsoci_firebird.so.4.1.0
        ├── libsoci_mysql.so
        ├── libsoci_odbc.so -> libsoci_odbc.so.4
        ├── libsoci_odbc.so.4 -> libsoci_odbc.so.4.1.0
        ├── libsoci_odbc.so.4.1.0
        ├── libsoci_postgresql.so -> libsoci_postgresql.so.4
        ├── libsoci_postgresql.so.4 -> libsoci_postgresql.so.4.1.0
        ├── libsoci_postgresql.so.4.1.0
        ├── libsoci_sqlite3.so -> libsoci_sqlite3.so.4
        ├── libsoci_sqlite3.so.4 -> libsoci_sqlite3.so.4.1.0
        └── libsoci_sqlite3.so.4.1.0

so for the other backends things seem to work as expected. I'll look into that

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 1, 2024

Okay that was easy. It's fixed already:

    └── soci
        ├── libsoci_core.so -> libsoci_core.so.4
        ├── libsoci_core.so.4 -> libsoci_core.so.4.1.0
        ├── libsoci_core.so.4.1.0
        ├── libsoci_empty.so -> libsoci_empty.so.4
        ├── libsoci_empty.so.4 -> libsoci_empty.so.4.1.0
        ├── libsoci_empty.so.4.1.0
        ├── libsoci_firebird.so -> libsoci_firebird.so.4
        ├── libsoci_firebird.so.4 -> libsoci_firebird.so.4.1.0
        ├── libsoci_firebird.so.4.1.0
        ├── libsoci_mysql.so -> libsoci_mysql.so.4
        ├── libsoci_mysql.so.4 -> libsoci_mysql.so.4.1.0
        ├── libsoci_mysql.so.4.1.0
        ├── libsoci_odbc.so -> libsoci_odbc.so.4
        ├── libsoci_odbc.so.4 -> libsoci_odbc.so.4.1.0
        ├── libsoci_odbc.so.4.1.0
        ├── libsoci_postgresql.so -> libsoci_postgresql.so.4
        ├── libsoci_postgresql.so.4 -> libsoci_postgresql.so.4.1.0
        ├── libsoci_postgresql.so.4.1.0
        ├── libsoci_sqlite3.so -> libsoci_sqlite3.so.4
        ├── libsoci_sqlite3.so.4 -> libsoci_sqlite3.so.4.1.0
        └── libsoci_sqlite3.so.4.1.0

(not that I force-pushed my PR branch, so you'd have to do a hard reset to get the latest changes without merge conflicts)

@papoteur-mga
Copy link

Okay that was easy. It's fixed already:

Fine, this is fixed.
Now I'm facing another problem. Header files are installed in /usr/include/soci/soci. I don't think it is expected.

@papoteur-mga
Copy link

I encounter a problem that libraries are installed in /usr/lib64/soci/ directory, when they was previously in /usr/lib64/

why is this a problem?

I don't know yet, but I wonder if the change is wanted, and why.

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 1, 2024

Now I'm facing another problem. Header files are installed in /usr/include/soci/soci. I don't think it is expected.

Oh, right. 👀
Should be fixed with my next commit.

I don't know yet, but I wonder if the change is wanted, and why.

I made this choice deliberately because I think it's more organized than every project just blindly installing into /usr/lib64/ directly and looking in that directory on my system, there doesn't seem to be any standard to which one should conform 🤷

@papoteur-mga
Copy link

After applying your last fix, I think not all header files are installed. This was already the case before the fix.

fatal error: soci/is-detected.h: No such file or directory

I had previously header files in soci/empty/ soci/sqlite3/ soci/mysql/ soci/postgresql/ soci/odbc/ soci/oracle/, but this is no more the case.

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 1, 2024

Indeed. I missed the is-detected.h one and also forgot to declare the backend-specific headers. Both issues should be remedied now.

@papoteur-mga
Copy link

I have now these header files:

   /usr/include/soci/mysql/soci-mysql.h
   /usr/include/soci/odbc/soci-odbc.h
   /usr/include/soci/postgresql/soci-postgresql.h
   /usr/include/soci/sqlite3/soci-sqlite3.h

The bad news is that xeus-sql doesn't recognize SOCI.

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find Soci (missing: SOCI_LIBRARY)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindSoci.cmake:97 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:69 (find_package)

@papoteur-mga
Copy link

Now I'm facing another problem. Header files are installed in /usr/include/soci/soci. I don't think it is expected.

Oh, right. 👀 Should be fixed with my next commit.

I don't know yet, but I wonder if the change is wanted, and why.

I made this choice deliberately because I think it's more organized than every project just blindly installing into /usr/lib64/ directly and looking in that directory on my system, there doesn't seem to be any standard to which one should conform 🤷

Now, I have an argument for the "why not": The change breaks the detection of soci in xeus-sql.
See https://github.com/jupyter-xeus/xeus-sql/blob/4189a98992195f7021aab9bc07aeb9227d8b8a33/cmake/FindSoci.cmake#L47-L52 and https://github.com/jupyter-xeus/xeus-sql/blob/4189a98992195f7021aab9bc07aeb9227d8b8a33/cmake/FindSoci.cmake#L65-L70

@papoteur-mga
Copy link

papoteur-mga commented Sep 2, 2024

And I still have this:
usr/include/soci/mysql/soci-mysql.h:21:10: fatal error: private/soci-trivial-blob-backend.h: No such file or directory

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 2, 2024

And I still have this:
usr/include/soci/mysql/soci-mysql.h:21:10: fatal error: private/soci-trivial-blob-backend.h: No such file or directory

That is addressed in a different PR

Now, I have an argument for the "why not": The change breaks the detection of soci in xeus-sql.

You shouldn't be using a FindSOCI module anymore. With the cmake revamp, SOCI supports cmake natively (that is, you can search for it in config mode of find_package).

@papoteur-mga
Copy link

And I still have this:
usr/include/soci/mysql/soci-mysql.h:21:10: fatal error: private/soci-trivial-blob-backend.h: No such file or directory

That is addressed in a different PR

But trivial-blob-backend.h is not listed here:

FILES
"${PROJECT_SOURCE_DIR}/include/soci/backend-loader.h"
"${PROJECT_SOURCE_DIR}/include/soci/bind-values.h"
"${PROJECT_SOURCE_DIR}/include/soci/blob-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/blob.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-fusion.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-gregorian-date.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-optional.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-tuple.h"
"${PROJECT_SOURCE_DIR}/include/soci/callbacks.h"
"${PROJECT_SOURCE_DIR}/include/soci/column-info.h"
"${PROJECT_SOURCE_DIR}/include/soci/connection-parameters.h"
"${PROJECT_SOURCE_DIR}/include/soci/connection-pool.h"
"${PROJECT_SOURCE_DIR}/include/soci/error.h"
"${PROJECT_SOURCE_DIR}/include/soci/exchange-traits.h"
"${PROJECT_SOURCE_DIR}/include/soci/fixed-size-ints.h"
"${PROJECT_SOURCE_DIR}/include/soci/into-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/into.h"
"${PROJECT_SOURCE_DIR}/include/soci/is-detected.h"
"${PROJECT_SOURCE_DIR}/include/soci/logger.h"
"${PROJECT_SOURCE_DIR}/include/soci/noreturn.h"
"${PROJECT_SOURCE_DIR}/include/soci/once-temp-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/prepare-temp-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/procedure.h"
"${PROJECT_SOURCE_DIR}/include/soci/query_transformation.h"
"${PROJECT_SOURCE_DIR}/include/soci/ref-counted-prepare-info.h"
"${PROJECT_SOURCE_DIR}/include/soci/ref-counted-statement.h"
"${PROJECT_SOURCE_DIR}/include/soci/row-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/row.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowid-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowid.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowset.h"
"${PROJECT_SOURCE_DIR}/include/soci/session.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-backend.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-platform.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-simple.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-types.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci.h"
"${PROJECT_SOURCE_DIR}/include/soci/statement.h"
"${PROJECT_SOURCE_DIR}/include/soci/std-optional.h"
"${PROJECT_SOURCE_DIR}/include/soci/transaction.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-conversion-traits.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-conversion.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-holder.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-ptr.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-wrappers.h"
"${PROJECT_SOURCE_DIR}/include/soci/use-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/use.h"
"${PROJECT_SOURCE_DIR}/include/soci/values-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/values.h"
"${PROJECT_SOURCE_DIR}/include/soci/version.h"
)

Now, I have an argument for the "why not": The change breaks the detection of soci in xeus-sql.

You shouldn't be using a FindSOCI module anymore. With the cmake revamp, SOCI supports cmake natively (that is, you can search for it in config mode of find_package).

I will try that.

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 2, 2024

But trivial-blob-backend.h is not listed here: 

FILES
"${PROJECT_SOURCE_DIR}/include/soci/backend-loader.h"
"${PROJECT_SOURCE_DIR}/include/soci/bind-values.h"
"${PROJECT_SOURCE_DIR}/include/soci/blob-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/blob.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-fusion.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-gregorian-date.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-optional.h"
"${PROJECT_SOURCE_DIR}/include/soci/boost-tuple.h"
"${PROJECT_SOURCE_DIR}/include/soci/callbacks.h"
"${PROJECT_SOURCE_DIR}/include/soci/column-info.h"
"${PROJECT_SOURCE_DIR}/include/soci/connection-parameters.h"
"${PROJECT_SOURCE_DIR}/include/soci/connection-pool.h"
"${PROJECT_SOURCE_DIR}/include/soci/error.h"
"${PROJECT_SOURCE_DIR}/include/soci/exchange-traits.h"
"${PROJECT_SOURCE_DIR}/include/soci/fixed-size-ints.h"
"${PROJECT_SOURCE_DIR}/include/soci/into-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/into.h"
"${PROJECT_SOURCE_DIR}/include/soci/is-detected.h"
"${PROJECT_SOURCE_DIR}/include/soci/logger.h"
"${PROJECT_SOURCE_DIR}/include/soci/noreturn.h"
"${PROJECT_SOURCE_DIR}/include/soci/once-temp-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/prepare-temp-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/procedure.h"
"${PROJECT_SOURCE_DIR}/include/soci/query_transformation.h"
"${PROJECT_SOURCE_DIR}/include/soci/ref-counted-prepare-info.h"
"${PROJECT_SOURCE_DIR}/include/soci/ref-counted-statement.h"
"${PROJECT_SOURCE_DIR}/include/soci/row-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/row.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowid-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowid.h"
"${PROJECT_SOURCE_DIR}/include/soci/rowset.h"
"${PROJECT_SOURCE_DIR}/include/soci/session.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-backend.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-platform.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-simple.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci-types.h"
"${PROJECT_SOURCE_DIR}/include/soci/soci.h"
"${PROJECT_SOURCE_DIR}/include/soci/statement.h"
"${PROJECT_SOURCE_DIR}/include/soci/std-optional.h"
"${PROJECT_SOURCE_DIR}/include/soci/transaction.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-conversion-traits.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-conversion.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-holder.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-ptr.h"
"${PROJECT_SOURCE_DIR}/include/soci/type-wrappers.h"
"${PROJECT_SOURCE_DIR}/include/soci/use-type.h"
"${PROJECT_SOURCE_DIR}/include/soci/use.h"
"${PROJECT_SOURCE_DIR}/include/soci/values-exchange.h"
"${PROJECT_SOURCE_DIR}/include/soci/values.h"
"${PROJECT_SOURCE_DIR}/include/soci/version.h"
)

Yes, because it is currently a private header (which it shouldn't be). I'll add it once the PR putting it into the private includes is merged.

@papoteur-mga
Copy link

papoteur-mga commented Sep 2, 2024

You shouldn't be using a FindSOCI module anymore. With the cmake revamp, SOCI supports cmake natively (that is, you can search for it in config mode of find_package).

OK, I removed FindSOCI, used find_package(SOCI REQUIRED) in CMakeLists.txt of xeus-sql.
It now takes SOCIConfigSOCI.make from SOCI project, but fails.

CMake Error at CMakeLists.txt:69 (find_package):
  Found package configuration file:

    /usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake

  but it set SOCI_FOUND to FALSE so package "SOCI" is considered to be NOT
  FOUND.  Reason given by package:

  Unmet dependency 'MySQL' for SOCI component 'MySQL'

Note that previously package to find was Soci, but I have to use SOCI in upper case.

@Krzmbrzl
Copy link
Contributor

Krzmbrzl commented Sep 2, 2024

Hm. Maybe we have to install the FindMySQL module along with SOCI in order for it to find that 🤔

Note that previously package to find was Soci, but I have to use SOCI in upper case.

Yeah, SOCI is the correct name and case-sensitive filesystems this becomes important. This was an oversight of the previous cmake implementation.

@papoteur-mga
Copy link

OK, I removed FindSOCI, used find_package(SOCI REQUIRED) in CMakeLists.txt of xeus-sql. It now takes SOCIConfigSOCI.make from SOCI project, but fails.

Hello,
I try again, now with adding some verbosity:

-- Found Boost: /usr/lib64/cmake/Boost-1.86.0/BoostConfig.cmake (found version "1.86.0") found components: date_time
-- Found MySQL: /usr/lib64/libmysqlclient.so
-- Found ODBC: /usr/lib64/libodbc.so
-- Found PostgreSQL: /usr/lib64/libpq.so (found version "17.0")
-- Found SQLite3: /usr/include (found version "3.46.1")
[...]
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(98):  if(TARGET MySQL::MySQL )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(100):  else()
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(101):  set(__already_found OFF )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(102):  break()
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(106):  if(__already_found )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(110):  if(__components )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(114):  if(SOCI_FIND_QUIETLY )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(116):  else()
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(117):  set(__quiet  )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(120):  find_package(MySQL   )
-- Found MySQL: /usr/lib64/libmysqlclient.so
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(126):  if(NOT MySQL_FOUND )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(127):  if(__required )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(128):  set(SOCI_FOUND FALSE )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(129):  set(SOCI_NOT_FOUND_MESSAGE Unmet dependency 'MySQL' for SOCI component 'MySQL' )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(130):  set(__skip_dependency TRUE )
/usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake(132):  continue()
[...]
CMake Error at CMakeLists.txt:69 (find_package):
  Found package configuration file:
    /usr/lib64/cmake/soci-4.1.0/SOCIConfig.cmake
  but it set SOCI_FOUND to FALSE so package "SOCI" is considered to be NOT
  FOUND.  Reason given by package:
  Unmet dependency 'MySQL' for SOCI component 'MySQL'

MySQL is said found, but the variable MySQL_FOUND is false or not set.

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

Successfully merging a pull request may close this issue.

4 participants