[MDEV-4147] Cannot build with include files from binary tarballs (fatal error: mysql/plugin.h: No such file or directory) Created: 2013-02-07  Updated: 2013-04-07  Resolved: 2013-04-07

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.1, 5.5.29, 5.2.14, 5.3.12
Fix Version/s: 10.0.2, 5.5.31, 5.2.15, 5.3.13

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: packaging

Issue Links:
Relates

 Description   

An attempt to build e.g MySQL ODBC connector with include files from MariaDB binary tarball ends with a failure:

[elenst@fedora17-64 mysql-connector-odbc-5.2.3-src]$ make 
[  1%] Building C object util/CMakeFiles/myodbc3u.dir/stringutil.c.o
In file included from /data/releases/mariadb-5.5.29-linux-x86_64/include/mysql/my_valgrind.h:18:0,
                 from /data/releases/mariadb-5.5.29-linux-x86_64/include/mysql/my_sys.h:31,
                 from /home/elenst/Downloads/mysql-connector-odbc-5.2.3-src/util/../MYODBC_MYSQL.h:30,
                 from /home/elenst/Downloads/mysql-connector-odbc-5.2.3-src/util/stringutil.h:37,
                 from /home/elenst/Downloads/mysql-connector-odbc-5.2.3-src/util/stringutil.c:32:
/data/releases/mariadb-5.5.29-linux-x86_64/include/mysql/m_string.h:204:26: fatal error: mysql/plugin.h: No such file or directory
compilation terminated.
make[2]: *** [util/CMakeFiles/myodbc3u.dir/stringutil.c.o] Error 1
make[1]: *** [util/CMakeFiles/myodbc3u.dir/all] Error 2
make: *** [all] Error 2

Indeed, the file structure in the tarball is such that m_string.h and plugin.h are on the same level in include/mysql, while m_string.h wants mysql/plugin.h.

cmake command and log:

[elenst@fedora17-64 mysql-connector-odbc-5.2.3-src]$ ODBC_PATH=/home/elenst/mysql-connector-odbc-5.1.12-src cmake -G "Unix Makefiles" -DWITH_UNIXODBC=1 -DMYSQL_INCLUDE_DIR=/data/releases/mariadb-5.5.25-linux-x86_64/include/ -DMYSQL_INCLUDE_DIR=/data/releases/mariadb-5.5.29-linux-x86_64/include/mysql/ -DMYSQL_LIB_DIR=/data/releases/mariadb-5.5.29-linux-x86_64/lib/
-- Configuring to build Unicode driver
-- MySQL Include dir: /data/releases/mariadb-5.5.29-linux-x86_64/include/mysql  library dir: /data/releases/mariadb-5.5.29-linux-x86_64/lib/
-- MySQL client libraries: mysqlclient_r;-lpthread
-- unixODBC: Found odbc_config in /usr/bin/odbc_config
-- Checking if LPCWSTR type is present - TRUE
-- Checking if SQLColAttribute last arg is compatible with SQLLEN* - TRUE
-- Checking if SQLParamOptions() 2nd and 3rd arg is compatible with SQLULEN - TRUE
-- Enabling threads support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/elenst/Downloads/mysql-connector-odbc-5.2.3-src
[elenst@fedora17-64 mysql-connector-odbc-5.2.3-src]$ make clean
[elenst@fedora17-64 mysql-connector-odbc-5.2.3-src]$ rm CMakeCache.txt 
[elenst@fedora17-64 mysql-connector-odbc-5.2.3-src]$ ODBC_PATH=/home/elenst/mysql-connector-odbc-5.1.12-src cmake -G "Unix Makefiles" -DWITH_UNIXODBC=1 -DMYSQL_INCLUDE_DIR=/data/releases/mariadb-5.5.25-linux-x86_64/include/ -DMYSQL_INCLUDE_DIR=/data/releases/mariadb-5.5.29-linux-x86_64/include/mysql/ -DMYSQL_LIB_DIR=/data/releases/mariadb-5.5.29-linux-x86_64/lib/
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring to build Unicode driver
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found.
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- MySQL Include dir: /data/releases/mariadb-5.5.29-linux-x86_64/include/mysql  library dir: /data/releases/mariadb-5.5.29-linux-x86_64/lib/
-- MySQL client libraries: mysqlclient_r;-lpthread
-- unixODBC: Found odbc_config in /usr/bin/odbc_config
-- Checking if LPCWSTR type is present - TRUE
-- Looking for dlopen
-- Looking for dlopen - not found
-- Checking if SQLColAttribute last arg is compatible with SQLLEN* - TRUE
-- Checking if SQLParamOptions() 2nd and 3rd arg is compatible with SQLULEN - TRUE
-- Enabling threads support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/elenst/Downloads/mysql-connector-odbc-5.2.3-src

The workaround is creating include/mysql/mysql link pointing at include/mysql.



 Comments   
Comment by Sergei Golubchik [ 2013-02-07 ]

MariaDB/MySQL clients are supposed to use mysql_config script to get the include paths. Did you try that?

Comment by Elena Stepanova [ 2013-02-07 ]

On 5.2/5.3, bin/mysql_config --include returns
-I<basedir>/include/mysql/

On 5.5/10.0, it returns
-I<basedir>/include/mysql/ -I<basedir>/include/mysql/..

But in any case you are right, if one uses C_FLAGS instead of special cmake variables like the connector's MYSQL_INCLUDE_DIR, one can provide more than one include directory and the problem is solved much better than by creating a link. Maybe it's even possible with MYSQL_INCLUDE_DIR, I just haven't found how.

For a note, I don't think that these tweaks need necessarily be treated in the code, I'm creating the reports mainly to be aware of possible problems users might encounter while building, and either point them at the JIRA entries or maybe document some of them as questions/answers or building advice.

Comment by Sergei Golubchik [ 2013-04-07 ]

One is supposed to use mysql_config tool to get the correct values for C include paths, etc.

Generated at Thu Feb 08 06:54:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.