Page 1 of 1

mySQL compilation error

Posted: Wed Apr 26, 2017 2:15 am
by boberski
I have strange error on Centos 7 server, It wasynt problem before and now I get it. I have mysql-devel installed.

Code: Select all

Determining if files mysql/mysql.h exist failed with the following output:
Change Dir: /home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/gmake "cmTryCompileExec480702967/fast"
/usr/bin/gmake -f CMakeFiles/cmTryCompileExec480702967.dir/build.make CMakeFiles/cmTryCompileExec480702967.dir/build
gmake[1]: Entering directory `/home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec480702967.dir/CheckIncludeFiles.c.o
/usr/bin/cc    -o CMakeFiles/cmTryCompileExec480702967.dir/CheckIncludeFiles.c.o   -c /home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:25: fatal error: mysql/mysql.h: No such file or directory
 #include <mysql/mysql.h>
                         ^
compilation terminated.
gmake[1]: Leaving directory `/home/ancaria/099-source/pol-core/bin-build/CMakeFiles/CMakeTmp'
gmake[1]: *** [CMakeFiles/cmTryCompileExec480702967.dir/CheckIncludeFiles.c.o] Error 1
gmake: *** [cmTryCompileExec480702967/fast] Error 2

Source:
/* */
#include <mysql/mysql.h>


int main(){return 0;}
Any idea?

Re: mySQL compilation error

Posted: Wed Apr 26, 2017 9:03 am
by RusseL
is DEV package installed? mysql headers are in dev package.
check if your system has dev package and headers

Re: mySQL compilation error

Posted: Wed Apr 26, 2017 9:41 am
by boberski
I wrote that: I have mysql-devel installed.

Re: mySQL compilation error

Posted: Wed Apr 26, 2017 11:40 am
by boberski
Now I get:

Code: Select all

[ 87%] Building CXX object pol-core/pol/CMakeFiles/pol.dir/stackcfg.cpp.o
/home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp: In member function 'bool Pol::Core::BSQLConnection::query(std::string, Pol::Core::QueryParams)':
/home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:360:94: error: no matching function for call to 'regex_replace(std::string&, std::regex&, std::unique_ptr<char []>::pointer, const match_flag_type&)'
                                             REGEX_NSPACE::regex_constants::format_first_only );
                                                                                              ^
/home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:360:94: note: candidates are:
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from /home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:33:
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2162:5: note:   template argument deduction/substitution failed:
/home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:360:94: note:   deduced conflicting types for parameter '_Bi_iter' ('std::basic_regex<char>' and 'char*')
                                             REGEX_NSPACE::regex_constants::format_first_only );
                                                                                              ^
In file included from /usr/include/c++/4.8.2/regex:62:0,
                 from /home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:33:
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note: template<class _Rx_traits, class _Ch_type> std::basic_string<_Ch_type> std::regex_replace(const std::basic_string<_Ch_type>&, const std::basic_regex<_Ch_type, _Rx_traits>&, const std::basic_string<_Ch_type>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type>& __s,
     ^
/usr/include/c++/4.8.2/bits/regex.h:2182:5: note:   template argument deduction/substitution failed:
/home/ancaria/099-source/pol-core/pol/sqlscrobj.cpp:360:94: note:   mismatched types 'const std::basic_string<_Ch_type>' and 'std::unique_ptr<char []>::pointer {aka char*}'
                                             REGEX_NSPACE::regex_constants::format_first_only );
                                                                                              ^
make[2]: *** [pol-core/pol/CMakeFiles/pol.dir/sqlscrobj.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 87%] Building CXX object pol-core/pol/CMakeFiles/pol.dir/startloc.cpp.o
make[1]: *** [pol-core/pol/CMakeFiles/pol.dir/all] Error 2
make: *** [all] Error 2

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 3:14 am
by boberski
Nando, dir sir can you write a word of wisdom here? :)

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 9:25 am
by Turley
From the readme:
Minimum compiler version: GCC 4.9 or LLVM/Clang 3.5. For compiling with GCC 4.7 and 4.8, please see the Advanced Compiling section on how to enable USE_BOOST_REGEX=1

Gcc 4.7 and 4.8 had a bug in their c++11 regex implementation. I would recommend to update your compiler, only if this is not possible use the mentioned workaround.

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 10:53 am
by boberski
It helped but:

Code: Select all

Linking CXX executable ../../../bin/pol
/usr/bin/ld: cannot find -lmysqlclient
collect2: error: ld returned 1 exit status
make[2]: *** [../bin/pol] Error 1
make[1]: *** [pol-core/pol/CMakeFiles/pol.dir/all] Error 2
make: *** [all] Error 2
Also:

Code: Select all

[root@uo ~]# yum install mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.icm.edu.pl
 * epel: ftp.icm.edu.pl
 * extras: ftp.icm.edu.pl
 * ius: lon.mirror.rackspace.com
 * updates: centos2.hti.pl
 * webtatic: uk.repo.webtatic.com
Package mysql-community-devel-5.6.36-2.el7.x86_64 already installed and latest version
Nothing to do
Any more ideas?

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 11:04 am
by Turley
I think that's the wrong package you installed.
mysql-client libmysqlclient-dev
Is atleast what we added to the prepareMachine.sh for vagrant

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 12:08 pm
by boberski

Code: Select all

[root@uo ~]# yum list installed | grep mysql
mysql-community-client.x86_64          5.6.36-2.el7           @mysql56-community
mysql-community-common.x86_64          5.6.36-2.el7           @mysql56-community
mysql-community-devel.x86_64           5.6.36-2.el7           @mysql56-community
mysql-community-embedded.x86_64        5.6.36-2.el7           @mysql56-community
mysql-community-embedded-devel.x86_64  5.6.36-2.el7           @mysql56-community
mysql-community-libs.x86_64            5.6.36-2.el7           @mysql56-community
mysql-community-server.x86_64          5.6.36-2.el7           @mysql56-community
php70u-mysqlnd.x86_64                  7.0.17-1.ius.centos7   @ius
I have got this libs instaled.

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 12:24 pm
by Turley
Mmmh check if you compile the 64bit Version of the core. If you would compile the 32bit version this would fail since you only have 64bit installed.
And initially cmake failed to find the include, what did you change?

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 12:31 pm
by boberski
I use:

./build_linux_release.sh

to compile, before I have isntalled all the libs you see, update gcc and cleat cmake cache. Minute before I delete all SQL Libs and install one more time:

Code: Select all

[root@uo ~]# yum list installed | grep mysql                                    mysql-community-client.x86_64          5.6.36-2.el7           @mysql56-community
mysql-community-common.x86_64          5.6.36-2.el7           @mysql56-community
mysql-community-devel.x86_64           5.6.36-2.el7           @mysql56-community
mysql-community-libs.x86_64            5.6.36-2.el7           @mysql56-community
mysql-community-release.noarch         el7-5                  installed
mysql-community-server.x86_64          5.6.36-2.el7           @mysql56-community

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 12:38 pm
by Turley
Please clean the cmake cache again and post the complete log of the building process.

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 1:01 pm
by boberski

Re: mySQL compilation error

Posted: Fri Apr 28, 2017 1:34 pm
by Skinny
Maybe this solution can help:
http://stackoverflow.com/a/21647591

Re: mySQL compilation error

Posted: Sat Apr 29, 2017 10:49 am
by boberski
I will look into that. Turley what you think about log?

Re: mySQL compilation error

Posted: Sat Apr 29, 2017 11:02 am
by boberski
I think I fixed it, I needed to add:

LIBRARY_PATH="/usr/lib64/mysql"
LD_LIBRARY_PATH="/usr/lib64/mysql"