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

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

我按照mysql给出的指令进行了操作,但是当我想测试它时出现了一个错误。
以下是我的意见:

  1. $ git clone https://github.com/mysql/mysql-connector-cpp.git
  2. $ cd mysql-connector-cpp
  3. $ git checkout 8.0
  4. $ mkdir build
  5. $ cd build
  6. $ cmake ..
  7. $ cmake --build .
  8. $ sudo cmake --build . --target install
  9. $ cmake -DWITH_CONCPP=/usr/local/mysql/connector-c++-8.0 ../testapp

我犯了个错误:

  1. Using dynamic runtime library.
  2. Generationg 64bit code
  3. Looking for connector libraries here: /usr/local/mysql/connector-c++-8.0/lib64
  4. Looking for the main library mysqlcppconn8
  5. CMake Error at CMakeLists.txt:165 (message):
  6. Could not find MySQL Connector/C++ 8.0 library mysqlcppconn8 at specified
  7. location: /usr/local/mysql/connector-c++-8.0/lib64
  8. -- 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#

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

  1. $ git clone https://github.com/mysql/mysql-connector-cpp.git
  2. $ cd mysql-connector-cpp
  3. $ git checkout 8.0
  4. $ mkdir build
  5. $ cd build
  6. # The problem is here: CMAKE_BUILD_TYPE default value is Debug
  7. # so it install .so in WITH_CONCPP/lib64/debug.
  8. $ cmake -DCMAKE_BUILD_TYPE=Release ..
  9. # I don't know why the options "--config Debug( or Release)" is disable.
  10. $ cmake --build .
  11. $ sudo cmake --build . --target install
  12. $ cmake -DWITH_CONCPP=/usr/local/mysql/connector-c++-8.0 ../testapp
展开查看全部

相关问题