makefile - 从源代码构建 mysql-workbench 时无法访问 jarfile ANTLR_JAR_PATH-NOTFOUND
问题描述
我正在尝试从源代码构建 mysql-workbench。我遵循了 INSTALL 文件中给出的这些步骤。
脚步:
1- $> cd wb-build
2- $> cmake ..
3- $> 使-j4
4- $> sudo make install
在第 2 步
root@Ahsan:~/Downloads/mysql-workbench-community-8.0.19-src/wb-build# cmake ..
ANTLR4 INCLUDE DIR: /usr/local/include/antlr4-runtime
ANTLR4 LIB DIR: -L/usr/local/lib -lantlr4-runtime
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/FindOpenGL.cmake:275 (message):
Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
available. Run "cmake --help-policy CMP0072" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
FindOpenGL found both a legacy GL library:
OPENGL_gl_LIBRARY: /usr/lib/x86_64-linux-gnu/libGL.so
and GLVND libraries for OpenGL and GLX:
OPENGL_opengl_LIBRARY: /usr/lib/x86_64-linux-gnu/libOpenGL.so
OPENGL_glx_LIBRARY: /usr/lib/x86_64-linux-gnu/libGLX.so
OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
CMakeLists.txt:77 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
VSQLITE INCLUDE DIR: /usr/include
VSQLITE LIB DIR: -L/usr/lib/x86_64-linux-gnu -lvsqlitepp
Found unixodbc, using it as ODBC library.
CMake Warning at CMakeLists.txt:153 (message):
antlr-4.7.1-complete.jar or java runtime wasn't found which is required if
you'd like to rebuild Lexer and Parser files
Found Scintilla Version: 4.1.5
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/UseSWIG.cmake:607 (message):
Policy CMP0078 is not set: UseSWIG generates standard target names. Run
"cmake --help-policy CMP0078" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
library/forms/swig/CMakeLists.txt:64 (swig_add_library)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/UseSWIG.cmake:460 (message):
Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
flag. Run "cmake --help-policy CMP0086" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
library/forms/swig/CMakeLists.txt:64 (swig_add_library)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/UseSWIG.cmake:607 (message):
Policy CMP0078 is not set: UseSWIG generates standard target names. Run
"cmake --help-policy CMP0078" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
Call Stack (most recent call first):
library/forms/swig/CMakeLists.txt:96 (swig_add_library)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at /usr/share/cmake-3.16/Modules/UseSWIG.cmake:460 (message):
Policy CMP0086 is not set: UseSWIG honors SWIG_MODULE_NAME via -module
flag. Run "cmake --help-policy CMP0086" for policy details. Use the
cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
/usr/share/cmake-3.16/Modules/UseSWIG.cmake:702 (SWIG_ADD_SOURCE_TO_MODULE)
library/forms/swig/CMakeLists.txt:96 (swig_add_library)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
-- Generating done
-- Build files have been written to: /root/Downloads/mysql-workbench-community-8.0.19-src/wb-build
在第 3 步
root@Ahsan:~/Downloads/mysql-workbench-community-8.0.19-src/wb-build# make -j4
[ 0%] [mysql] Generating parser files...
Error: Unable to access jarfile ANTLR_JAR_PATH-NOTFOUND
make[2]: *** [library/parsers/CMakeFiles/generate_parser_mysql.dir/build.make:75: ../library/parsers/mysql/MySQLLexer.h] Error 1
make[1]: *** [CMakeFiles/Makefile2:2260: library/parsers/CMakeFiles/generate_parser_mysql.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 1%] Built target cdbc
[ 3%] Built target wbbase
[ 24%] Built target wbscintilla
make: *** [Makefile:130: all] Error 2
关于 ANTLR 的注意事项:
- 为 MySQL Parser 生成文件需要 ANTLR 4.7。从http://www.antlr.org/download.html下载 antlr-4.7.2-complete.jar 。然后你需要将它作为 cmake 参数传递: -DWITH_ANTLR_JAR=path_to_your_antlr_complete_file
注意: 我已经在 /root/Downloads/ 中下载了 Antlr-4.7.2-complete.jar 文件
我应该把它放在哪里。
解决方案
我有同样的问题。我的解决方案(在安装文件中有部分描述):
添加 wb-build 文件夹
打开 wb-build 文件夹并运行 cmake 命令。
cmake [-DCMAKE_INSTALL_PREFIX=/usr] ..
- 检查需要编译哪个版本(如您所见是 4.9.1)。
WITH_ANTLR_JAR:CMakeLists.txt:161 处的 CMake 警告(消息):antlr-4.9.1-complete.jar 或 java 运行时未找到,如果您想重建 Lexer 和 Parser 文件,这是必需的
- 从https://www.antlr.org/download/antlr-4.9.1-complete.jar下载
- 将antlr-4.9.1文件的路径添加到cmake
cmake [-DCMAKE_INSTALL_PREFIX=/usr -DWITH_ANTLR_JAR=path_to_your_antlr_complete_file] .. 6. 如果路径和版本没问题,它应该是:找到 unixodbc,将其用作 ODBC 库。WITH_ANTLR_JAR: /tmp/antlr-4.9.1-complete.jar] -- ANTLR jar: /tmp/antlr-4.9.1-complete.jar 7. 然后制作(大约需要 30 分钟)并制作安装(或sudo进行安装)
提示:我发现在一个 CPU 内核上运行 make 会更好。如果我使用了许多内核(-j FLAG),则会出现很多错误,并且每次都停止编译。
推荐阅读
- python - 如何使用龟蟒绘制骰子
- flutter - 如何沿着从起点到终点的弯曲贝塞尔路径为小部件设置动画?
- c++ - 关于构造函数和内存泄漏的问题
- android - Jetpack Compose - 在动画中间立即更改值
- python - MNIST 训练的网络用我自己的样本进行了测试
- postgresql - 从 DBeaver(在 Windows 上)访问 PostgreSQL(在 wsl2 上)失败:“连接被拒绝:连接”
- kubernetes - 如何在 kubernetes 中将多个节点合并为一个大节点
- google-sheets - 创建以字符串为源的公式
- webrtc - ArCore Capture 自定义 VideoCapture | 尝试了所有解决方案
- python-3.x - 以 datetime 为索引的 Pandas 系列的平均值,但可能缺少数据