最近准备参加OpenSourceTalent,题目是KonaJDK相关的,首先要构建KonaJDK,这儿我踩了很多坑
尝试在windows构建
- 我一开始尝试使用mingw构建,但是configure中要求的make版本不一致
configure: Found GNU make version GNU Make 4.2.1 at /f/App/mingw64/bin/make, but it is not for msys (it says: Built for x86_64-w64-mingw32). Ignoring.
configure: error: Cannot find GNU make 3.81 or newer! Please put it in the path, or add e.g. MAKE=/opt/gmake3.81/make as argument to configure.
- 然后我尝试使用msys2构建,make版本没有问题,但是configure死活不认我装的vs2022,使用vs2013也一样构建失败(后来在ci里看到它使用的是vs2017)
configure: Could not succesfully extract the envionment variables needed for the VS setup.
configure: Try setting –with-tools-dir to the VC/bin directory within the VS installation
configure: or run “bash.exe -l” from a VS command prompt and then run configure from there.
configure: error: Cannot continue - 宣告放弃,下各种版本的vs弄得我头都大了
尝试在Ubuntu构建
- 首先我电脑里有一个之前用过的Ubuntu22.04,我先尝试在上面构建,但是编译的时候会出现各种语法错误导致无法完成编译
- 然后我去翻Kona的ci,看到了他的构建脚本,使用的是
Ubuntu20.04
- 最终我下了一个新的
Ubuntu20.04
镜像,按照ci的构建脚本构建成功了(但是还是要自己apt装一些依赖,这ci依赖不全怎么能构建出来的?
Ubuntu上的构建过程
# ci里装的依赖 apt-get install openjdk-8-jdk gcc-9 g++-9 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev # 自己安装时缺少的依赖 apt-get install libfontconfig1-dev libfreetype6-dev bash configure \ --with-conf-name=linux-x64 \ --with-target-bits=64 \ --enable-debug \ --with-build-number=b00 \ --with-boot-jdk=/usr/lib/jvm/java-8-openjdk-amd64 \ --with-zlib=bundled \ --with-freetype-lib=/usr/lib/x86_64-linux-gnu \ --with-freetype-include=/usr/include/freetype2 make images
总结:构建文档没一个能信的,只有ci不会骗人
准备等空了再挑战一下在win构建KonaJDK,成功了再来更新