SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

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

Open triplq opened 4 weeks ago

triplq commented 4 weeks ago

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.```