无法在我的ubuntu中正确安装mysql connector/c++

6jjcrrmo  于 2021-06-20  发布在  Mysql
关注(0)|答案(1)|浏览(529)

我按照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从源代码安装connector/c++
这是文件的相关部分。
要验证连接器功能,请生成并运行源发行版的testapp目录中包含的一个或多个测试程序。创建一个要使用的目录,并将位置更改为该目录。然后发出以下命令: $ cmake [other_options] -DWITH_CONCPP=concpp_install concpp_source/testapp 其他\u选项包括用于配置connector/c本身的选项(-g、with \u boost、build \u static等等)。concpp\u source是包含connector/c源代码的目录,concpp\u install是安装connector/c++的目录:

chy5wohz

chy5wohz1#

我也发现了你的问题。这是我的解决方案:

$ 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

相关问题