Bug #91939 configure using cmake
Submitted: 8 Aug 2018 22:28 Modified: 10 Aug 2018 6:16
Reporter: Oleksii Dmytriiev Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:8.0.12 OS:Linux (CentOS 7.5)
Assigned to: CPU Architecture:x86

[8 Aug 2018 22:28] Oleksii Dmytriiev
Description:
Hello.

I have already built/installed mysql-server-8.0.12 from the sourcecode.

But now there is a problem while trying to build mysql-connector-odbc-8.0.12 from the source code. 

Is there any workaround?

cmake:
CXX=g++ cmake -G "Unix Makefiles" -D MYSQL_DIR=/usr/local/mysql -DWITH_UNIXODBC=1 ..

-- Configuring to build Unicode driver
-- Configuring to build ANSI driver
-- NUMA library missing or required version not available
-- You will link dynamically to the MySQL client library (set with -DMYSQLCLIENT_STATIC_LINKING=<bool>)
-- Searching for dynamic libraries with the base name(s) "mysqlclient_r mysqlclient"
-- mysql_config was found /usr/local/mysql/bin/mysql_config
-- MYSQL_LIB_DIR_LIST =
-- MySQL client environment/cmake variables set that the user can override
--   MYSQL_DIR                   : /usr/local/mysql
--   MYSQL_INCLUDE_DIR           : /usr/local/mysql/include
--   MYSQL_LIB_DIR               : /usr/local/mysql/lib
--   MYSQL_CONFIG_EXECUTABLE     : /usr/local/mysql/bin/mysql_config
--   MYSQL_CXX_LINKAGE           : 1
--   MYSQL_CFLAGS                : -I/usr/local/mysql/include
--   MYSQL_CXXFLAGS              : -I/usr/local/mysql/include
--   MYSQLCLIENT_STATIC_LINKING  :
--   MYSQLCLIENT_NO_THREADS      :
-- MySQL client optional environment/cmake variables set by the user
--   MYSQL_EXTRA_LIBRARIES       :
--   MYSQL_LINK_FLAGS            :
-- MySQL client settings that the user can't override
--   MYSQL_VERSION               : 8.0.12
--   MYSQL_VERSION_ID            : 80012
--   MYSQL_LIB                   : /usr/local/mysql/lib/libmysqlclient.so
--   MYSQL_LIBRARIES             : mysql_sys;mysql_strings;mysqlclient;pthread;m;rt;ssl;crypto;dl
-- 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
-- Installation library subdir: lib
Setting RPATH for myodbc8w
Setting RPATH for myodbc8a
-- checking for module 'gtk+-2.0'
--   package 'gtk+-2.0' not found
-- checking for module 'gtk+-3.0'
--   package 'gtk+-3.0' not found
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mysql-connector-odbc-8.0.12-src/bld

make:

[  0%] Building CXX object util/CMakeFiles/myodbc-util.dir/stringutil.cc.o
In file included from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:83:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/root/mysql-connector-odbc-8.0.12-src/util/../include/sys_main.h:111:3: error: conflicting declaration ‘typedef struct st_mem_root MEM_ROOT’
 } MEM_ROOT;
   ^
In file included from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:82:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/usr/local/mysql/include/mysql.h:161:8: error: ‘struct MEM_ROOT’ has a previous declaration as ‘struct MEM_ROOT’
 struct MEM_ROOT;
        ^
In file included from /usr/local/mysql/include/mysql.h:80:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:82,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/usr/local/mysql/include/my_list.h:53:14: error: previous declaration of ‘LIST* list_add(LIST*, LIST*)’ with ‘C++’ linkage
 extern LIST *list_add(LIST *root, LIST *element);
              ^
In file included from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:83:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/root/mysql-connector-odbc-8.0.12-src/util/../include/sys_main.h:171:48: error: conflicts with new declaration with ‘C’ linkage
 extern LIST *list_add(LIST *root, LIST *element);
                                                ^
In file included from /usr/local/mysql/include/mysql.h:80:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:82,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/usr/local/mysql/include/my_list.h:54:14: error: previous declaration of ‘LIST* list_delete(LIST*, LIST*)’ with ‘C++’ linkage
 extern LIST *list_delete(LIST *root, LIST *element);
              ^
In file included from /root/mysql-connector-odbc-8.0.12-src/util/../MYODBC_MYSQL.h:83:0,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.h:37,
                 from /root/mysql-connector-odbc-8.0.12-src/util/stringutil.cc:36:
/root/mysql-connector-odbc-8.0.12-src/util/../include/sys_main.h:172:51: error: conflicts with new declaration with ‘C’ linkage
 extern LIST *list_delete(LIST *root, LIST *element);
                                                   ^
/root/mysql-connector-odbc-8.0.12-src/util/../include/sys_main.h:480:3: error: conflicting declaration ‘typedef struct charset_info_st CHARSET_INFO’
 } CHARSET_INFO;
....
....
....

How to repeat:
Execute make again.

Suggested fix:
No solution yet.
[8 Aug 2018 22:30] Oleksii Dmytriiev
full make output

Attachment: make_output.txt (text/plain), 24.00 KiB.

[8 Aug 2018 22:31] Oleksii Dmytriiev
It looks like the same bug:
https://bugs.mysql.com/bug.php?id=90882

But i cannot reopen it.
[9 Aug 2018 0:10] MySQL Verification Team
Please see Bogdan comment. Thanks.
[9 Aug 2018 0:11] MySQL Verification Team
Duplicate of bug: https://bugs.mysql.com/bug.php?id=90882.
[9 Aug 2018 6:39] Oleksii Dmytriiev
Yes. I have seen it. It didn't help.

Look at cmake command line and variables:
cmake:
CXX=g++ cmake -G "Unix Makefiles" -D MYSQL_DIR=/usr/local/mysql -DWITH_UNIXODBC=1 ..

-- Configuring to build Unicode driver
-- Configuring to build ANSI driver
-- NUMA library missing or required version not available
-- You will link dynamically to the MySQL client library (set with -DMYSQLCLIENT_STATIC_LINKING=<bool>)
-- Searching for dynamic libraries with the base name(s) "mysqlclient_r mysqlclient"
-- mysql_config was found /usr/local/mysql/bin/mysql_config
-- MYSQL_LIB_DIR_LIST =
-- MySQL client environment/cmake variables set that the user can override
--   MYSQL_DIR                   : /usr/local/mysql
--   MYSQL_INCLUDE_DIR           : /usr/local/mysql/include
--   MYSQL_LIB_DIR               : /usr/local/mysql/lib
--   MYSQL_CONFIG_EXECUTABLE     : /usr/local/mysql/bin/mysql_config
--   MYSQL_CXX_LINKAGE           : 1
--   MYSQL_CFLAGS                : -I/usr/local/mysql/include
--   MYSQL_CXXFLAGS              : -I/usr/local/mysql/include
--   MYSQLCLIENT_STATIC_LINKING  :
--   MYSQLCLIENT_NO_THREADS      :

g++ is used with MYSQL_CXX_LINKAGE and MYSQL_LIB_DIR which were set by default.
[9 Aug 2018 8:13] MySQL Verification Team
Thank you for the feedback. Re-opening.
[9 Aug 2018 8:40] Bogdan Degtyariov
Hi Oleksii,

Please try setting -DMYSQLCLIENT_STATIC_LINKING:BOOL=true in the cmake command line.
[9 Aug 2018 8:52] Oleksii Dmytriiev
Hi, Miguel!

It worked like a charm. I have been able to compile it. Thank you very much!

But, i had to add "gtk2-devel" package because it was looking for gtk headers for some reason and failed with critical error during make.
[9 Aug 2018 9:02] MySQL Verification Team
Thank you for the feedback and Bogdan's help.
[10 Aug 2018 1:15] Bogdan Degtyariov
Just one little comment: if you do not need the GUI setup dialog just add -DDISABLE_GUI=1 and GTK packages won't be required.
[10 Aug 2018 6:16] Oleksii Dmytriiev
Thanks, Bogdan.