自己编译mysql5.7的源代码:mysql-test 报错问题的解决

现象:

-- INSTALL mysqlclient.pc lib/pkgconfig
CMake Error at CMakeLists.txt:732 (ADD_SUBDIRECTORY):
  add_subdirectory given source "mysql-test" which is not an existing
  directory.


CMake Error at CMakeLists.txt:733 (ADD_SUBDIRECTORY):
  add_subdirectory given source "mysql-test/lib/My/SafeProcess" which is not
  an existing directory.


-- Skipping deb packaging on unsupported platform .

 

 

 

解决方法:

方法二:如果你不需要测试套件,强行跳过

如果你只是想编译客户端库,坚持使用当前这份源码,可以通过欺骗 CMake 的方式跳过这个检查。

    step 1:创建空目录来骗过 CMake 的检查:

    mkdir -p mysql-test/lib/My/SafeProcess

    step 2:修改源码根目录下的Cmake配置 CMakeLists.txt(因为即便有了目录,里面缺少 CMakeLists.txt 还是会报错):
    找到源码根目录下的 CMakeLists.txt 文件,找到第 732 行附近:

    ADD_SUBDIRECTORY(mysql-test)
    ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)

     将这两行注释掉(在行首加 #):

    # ADD_SUBDIRECTORY(mysql-test)
    # ADD_SUBDIRECTORY(mysql-test/lib/My/SafeProcess)

    step3:再次运行 cmake 和 make 即可

 

posted on 2026-08-20 14:05  jinzhenshui  阅读(3)  评论(0)    收藏  举报