无法在我的ubuntu中正确安装MySQL Connector / c ++

时间:2018-06-30 18:04:18

标签: c++ mysql mysql-error-1064 connector

我遵循了Mysql给出的说明,但是在测试时出现错误。

这些是我的投入:

$ git clone https://github.com/mysql/mysql-connector-cpp.git
$ cd mysql-connector-cpp
$ git checkout 8.0
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ sudo cmake --build . --target install
$ cmake -DWITH_CONCPP=/usr/local/mysql/connector-c++-8.0 ../testapp

我得到一个错误:

Using dynamic runtime library.
Generationg 64bit code
Looking for connector libraries here: /usr/local/mysql/connector-c++-8.0/lib64
Looking for the main library  mysqlcppconn8
CMake Error at CMakeLists.txt:165 (message):
Could not find MySQL Connector/C++ 8.0 library mysqlcppconn8 at specified
location: /usr/local/mysql/connector-c++-8.0/lib64


-- Configuring incomplete, errors occurred!

这是文档链接: MySql Installing Connector/C++ from Source

这是文档的相关部分。

  

要验证连接器功能,请构建并运行源分发的testapp目录中包含的一个或多个测试程序。创建要使用的目录并在其中更改位置。然后发出以下命令:

$ cmake [other_options] -DWITH_CONCPP=concpp_install concpp_source/testapp

  

other_options包含用于配置的选项   连接器/ C ++本身(-G,WITH_BOOST,BUILD_STATIC等)。   concpp_source是包含Connector / C ++源代码的目录   代码,concpp_install是Connector / C ++所在的目录   已安装:

1 个答案:

答案 0 :(得分:1)

我也出现了您的问题。这是我的解决方案:

$ git clone https://github.com/mysql/mysql-connector-cpp.git
$ cd mysql-connector-cpp
$ git checkout 8.0
$ mkdir build
$ cd build
# The problem is here: CMAKE_BUILD_TYPE default value is Debug
# so it install .so in WITH_CONCPP/lib64/debug. 
$ cmake -DCMAKE_BUILD_TYPE=Release ..
# I don't know why the options "--config Debug( or Release)" is disable.
$ cmake --build .
$ sudo cmake --build . --target install
$ cmake -DWITH_CONCPP=/usr/local/mysql/connector-c++-8.0 ../testapp