在msys2里面编译antlr4的过程记录
简单记录一下如何在msys2里面的mingw64里面编译antlr4 runtime
第一步:下载压缩包
https://github.com/antlr/antlr4/releases第二步:解压缩第三步:打开msys64 mingw64控制台第四步:cd d:\xxx\xxx 打开cpp运行时目录第五步:mkdir build ,cd build第六步:这玩意需要联网下载一个谷歌的什么测试的东西,设置好联网代理export http_proxy=代理地址
export https_proxy=代理地址第七步:cmake .. -G "MSYS Makefiles" \-DCMAKE_INSTALL_PREFIX=/mingw64 \-DBUILD_SHARED_LIBS=OFF \-DCMAKE_BUILD_TYPE=Release
-- Building without demo. To enable demo build use: -DWITH_DEMO=True
CMake Warning (dev) at D:/msys64/mingw64/share/cmake/Modules/FetchContent.cmake:1373 (message):The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 isnot set. The policy's OLD behavior will be used. When using a URLdownload, the timestamps of extracted files should preferably be that ofthe time of extraction, otherwise code that depends on the extractedcontents might not be rebuilt if the URL changes. The OLD behaviorpreserves the timestamps from the archive instead, but this is usually notwhat you want. Update your project to the NEW behavior or specify theDOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid thisrobustness issue.
Call Stack (most recent call first):runtime/CMakeLists.txt:71 (FetchContent_Declare)
This warning is for project developers. Use -Wno-dev to suppress it.CMake Deprecation Warning at build/_deps/googletest-src/CMakeLists.txt:4 (cmake_minimum_required):Compatibility with CMake < 3.10 will be removed from a future version ofCMake.Update the VERSION argument <min> value. Or, use the <min>...<max> syntaxto tell CMake that the project requires at least <min> but has been updatedto work with policies introduced by <max> or earlier.CMake Deprecation Warning at build/_deps/googletest-src/googlemock/CMakeLists.txt:45 (cmake_minimum_required):Compatibility with CMake < 3.10 will be removed from a future version ofCMake.Update the VERSION argument <min> value. Or, use the <min>...<max> syntaxto tell CMake that the project requires at least <min> but has been updatedto work with policies introduced by <max> or earlier.CMake Deprecation Warning at build/_deps/googletest-src/googletest/CMakeLists.txt:56 (cmake_minimum_required):Compatibility with CMake < 3.10 will be removed from a future version ofCMake.Update the VERSION argument <min> value. Or, use the <min>...<max> syntaxto tell CMake that the project requires at least <min> but has been updatedto work with policies introduced by <max> or earlier.-- Found Python: D:/msys64/mingw64/bin/python3.12.exe (found version "3.12.9") found components: Interpreter
-- Configuring done (12.1s)
-- Generating done (0.4s)
-- Build files have been written to: D:/xxxxx/libs/antlr4_312/build
出来done就可以make了
make -j 8
[ 97%] Building CXX object runtime/CMakeFiles/antlr4_static.dir/src/tree/xpath/XPathTokenElement.cpp.obj
[ 97%] Building CXX object runtime/CMakeFiles/antlr4_static.dir/src/tree/xpath/XPathWildcardAnywhereElement.cpp.obj
[ 98%] Building CXX object runtime/CMakeFiles/antlr4_static.dir/src/tree/xpath/XPathWildcardElement.cpp.obj
[ 99%] Linking CXX shared library libantlr4-runtime.dll
[ 99%] Linking CXX static library libantlr4-runtime-static.a
[ 99%] Built target antlr4_shared
[ 99%] Built target antlr4_static
[ 99%] Building CXX object runtime/CMakeFiles/antlr4_tests.dir/tests/Utf8Test.cpp.obj
[100%] Linking CXX executable antlr4_tests.exe
[100%] Built target antlr4_tests
这就编译出来了。
make install就可以了