MySQL Forums
Forum List  »  Connector/C++

cmake errors 8.0.7 when enabling legacy connector
Posted by: Royce Kemp
Date: April 11, 2018 11:35AM

I am trying to build from source and encounter errors from cmake when enabling the legacy connector (-DWITH_JDBC=ON).

I run this cmake command:

cmake3 -DWITH_BOOST:FILEPATH=/data/cmNFS2/scm/share/v1/thirdparty/boost/1.66.0/devtoolset-7 -DCMAKE_INSTALL_PREFIX=/data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/devtoolset-7 -DMYSQL_CONFIG_EXECUTABLE:FILEPATH=/data/cmNFS2/scm/share/v1/thirdparty/mysqlclient/6.1.11/devtoolset-7/bin/mysql_config -DMYSQL_LIB=/data/cmNFS2/scm/share/v1/thirdparty/mysqlclient/6.1.11/devtoolset-7/lib/libmysqlclient.so -DWITH_SSL=system -DWITH_JDBC=ON .


Here is a sampling of the error output, though many files fail to compile, but they all relate to this same error:

4 Run Build Command:"/opt/rh/devtoolset-7/root/usr/bin/gmake" "cmTC_0e8ab/fast"
5 /opt/rh/devtoolset-7/root/usr/bin/gmake -f CMakeFiles/cmTC_0e8ab.dir/build.make CMakeFiles/cmTC_0e8ab.dir/build
6 gmake[1]: Entering directory '/data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp'
7 Building CXX object CMakeFiles/cmTC_0e8ab.dir/src.cxx.o
8 /opt/rh/devtoolset-7/root/usr/bin/c++ -std=c++11 -std=c++11 -DHAVE_IS_SAME -std=c++11 -fPIE -o CMakeFiles/cmTC_0e8ab.dir/src.cxx.o -c /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/my
9 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:11: error: ‘::main’ must return ‘int’
10 void main() { return is_same<bool,char>::value; }
11 ^
12 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
13 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:22: error: ‘is_same’ was not declared in this scope
14 void main() { return is_same<bool,char>::value; }
15 ^~~~~~~
16 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:30: error: expected primary-expression before ‘bool’
17 void main() { return is_same<bool,char>::value; }
18 ^~~~
19 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:30: error: expected ‘;’ before ‘bool’
20 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:34: error: expected unqualified-id before ‘,’ token
21 void main() { return is_same<bool,char>::value; }
22 ^
23 /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp/src.cxx:1:35: error: expected unqualified-id before ‘char’
24 void main() { return is_same<bool,char>::value; }
25 ^~~~
26 gmake[1]: *** [CMakeFiles/cmTC_0e8ab.dir/build.make:66: CMakeFiles/cmTC_0e8ab.dir/src.cxx.o] Error 1
27 gmake[1]: Leaving directory '/data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp'
28 gmake: *** [Makefile:126: cmTC_0e8ab/fast] Error 2
29
30 Source file was:
31 void main() { return is_same<bool,char>::value; }
32 Determining if the include file sys/endian.h exists failed with the following output:
33 Change Dir: /data/cmNFS2/scm/share/v1/thirdparty/mysqlcppconn/8.0.7-rc/archive/mysql-connector-c++-8.0.7-rc-src/CMakeFiles/CMakeTmp

Note, I had to fix a bug in jdbc.cmake, line 81, added -DMYSQL_CONFIG_EXECUTABLE=${MYSQL_CONFIG_EXECUTABLE} so that it would properly accept the value from the CLI.

There seems to be another bug as well when it's trying to determine if the compilers for the C driver and the current compiler are the same, it's doing a regex on the mysql_config output, but mysql_config never outputs the compiler used, so this is a bug in the cmake script, but I believe it only emits a warning so I am ignoring it for now.

My question is to the forum, why is the compilation errors happening? Is it because I'm using a non-standard location for my toolchain perhaps? I'm using latest toolchain from redhat devtools-7.

1 Information about the build environment:
2
3 OS information : Linux-3.10.0-327.4.5.el7.x86_64
4 C compiler : GNU 7.3.1
5 C++ compiler : GNU 7.3.1
6 GLIBC version : (GNU libc) 2.17

Options: ReplyQuote


Subject
Views
Written By
Posted
cmake errors 8.0.7 when enabling legacy connector
1612
April 11, 2018 11:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.