[ODBC-265] Does not compile without patched CMakeList.txt Created: 2019-09-20  Updated: 2019-09-20  Resolved: 2019-09-20

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Joe Searle Assignee: Lawrin Novitsky
Resolution: Not a Bug Votes: 0
Labels: packaging
Environment:

Alpine Linux



 Description   

Does not compile without patching CMakeList.txt to include /usr/include/mysql

Patch here:

--- mariadb-connector-odbc-3.1.3-ga-src/CMakeLists.txt
+++ mariadb-connector-odbc-3.1.3-ga-src-patched/CMakeLists.txt
@@ -144,6 +144,7 @@
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/libmariadb/include)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/libmariadb/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} /usr/include/mysql)
 
 IF(WIN32)
   INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/dsn)

Build error when not using patch:

In file included from /home/joe/aports/testing/mariadb-connector-odbc/src/mariadb-connector-odbc-3.1.4/odbc_3_api.c:21:                                                                                                                                                          
/home/joe/aports/testing/mariadb-connector-odbc/src/mariadb-connector-odbc-3.1.4/ma_odbc.h:32:10: fatal error: mysql.h: No such file or directory                                                                                                                                
 #include <mysql.h>                                                                                                                                                                                                                                                              
          ^~~~~~~~~                                                                                                                                                                                                                                                              
compilation terminated.                                                                                                                                                                                                                                                          
make[2]: *** [CMakeFiles/maodbc.dir/build.make:63: CMakeFiles/maodbc.dir/odbc_3_api.c.o] Error 1                                                                                                                                                                                 
make[2]: *** Waiting for unfinished jobs....                                                                                                                                                                                                                                     
In file included from /home/joe/aports/testing/mariadb-connector-odbc/src/mariadb-connector-odbc-3.1.4/ma_error.c:19:                                                                                                                                                            
/home/joe/aports/testing/mariadb-connector-odbc/src/mariadb-connector-odbc-3.1.4/ma_odbc.h:32:10: fatal error: mysql.h: No such file or directory                                                                                                                                
 #include <mysql.h>                                                                                                                                                                                                                                                              
          ^~~~~~~~~                                                                                                                                                                                                                                                              
compilation terminated.     



 Comments   
Comment by Lawrin Novitsky [ 2019-09-20 ]

Thank you for your report.
I assume you were building using source package.
We usually build and encourage people to build with Connector/C as a sub-project. i.e. if you put Connector/C sources into libmariadb subdirectory of the root of Connector/ODBC source tree.
If you use C/ODBC git checkout for that, it will work automatically. You can look into BUILD.md file for build instructions.
If you still want to build from source package using installed in the system C/C libraries and headers, then should point somehow to compiler and linker to their location. e.g. you can do something like cmake -DCMAKE_C_FLAGS_RELWITHDEBINFO="-I/usr/include/mysql" .
Please feel free to re-open the issue report if you still think there is something for us to fix here.

Generated at Thu Feb 08 03:27:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.