同步操作将从 方舟编译器孵化器/maple_engine 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#
# Copyright (C) [2020] Futurewei Technologies, Inc. All rights reverved.
#
# Licensed under the Mulan Permissive Software License v2.
# You can use this software according to the terms and conditions of the MulanPSL - 2.0.
# You may obtain a copy of MulanPSL - 2.0 at:
#
# https://opensource.org/licenses/MulanPSL-2.0
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
# FIT FOR A PARTICULAR PURPOSE.
# See the MulanPSL - 2.0 for more details.
#
需要一台Linux x86_64服务器,至少16GB或以上内存,安装Ubuntu 16.04或18.04系统. 若您的服务器只有16GB内存,需要创建8GB或以上的swap空间。
编译和链接 OpenJDK 核心库时,会占用很多内存。对于少于16GB内存的服务器,可以考虑 在其它内存较多的服务器上先构建好libcore.so, 将maple_engine/maple_build/out/这个 目录打包传到您的本地机器,展开后放到本地机器 同名目录下,再拷贝其中的文件 libcore.so 到maple_engine/maple_runtime/lib/x86_64/libcore.so,就可以本地编译和运行应用程序了。
登录服务器后,执行如下命令安装所需的软件包:
sudo apt install -y build-essential clang cmake libffi-dev libelf-dev libunwind-dev \
libssl-dev openjdk-8-jdk-headless unzip python-minimal python3 gdb bc highlight
下载代码并设置Maple 构建环境:
git clone https://gitee.com/openarkcompiler-incubator/maple_engine.git
cd maple_engine
source ./envsetup.sh
若要执行后续命令,需先执行source ./envsetup.sh
.
./maple_build/tools/build-maple.sh
按照文档./maple_build/doc/build_OpenJDK8.md 中介绍的方法构建定制的OpenJDK-8. 将文档中提到的必需的.jar 文件拷贝到./maple_build/jar/ 目录中,再执行如下命令:
./maple_build/tools/build-libcore.sh
构建Java 核心库完成后,会将编译应用代码所需要的文件拷贝到maple_runtime/lib/x86_64/目录下。
以HelloWorld为例,编译和执行一个应用程序:
cd ./maple_build/examples/HelloWorld
"$MAPLE_BUILD_TOOLS"/java2asm.sh HelloWorld.java
"$MAPLE_BUILD_TOOLS"/asm2so.sh HelloWorld.s
"$MAPLE_BUILD_TOOLS"/run-app.sh -classpath ./HelloWorld.so HelloWorld
"$MAPLE_BUILD_TOOLS"/run-app.sh -gdb -classpath ./HelloWorld.so HelloWorld
Needs a Linux x86_64 server with 16GB or more RAM and Ubuntu 16.04/18.04 installed. If your server has 16GB RAM, please setup 8GB or more swap space.
Execute the following command to install the packages used by the Maple build.
sudo apt install -y build-essential clang cmake libffi-dev libelf-dev libunwind-dev \
libssl-dev openjdk-8-jdk-headless unzip python-minimal python3 gdb bc highlight
cd maple_engine
source ./envsetup.sh
./maple_build/tools/build-maple.sh
Following the doc at ./maple_build/doc/build_OpenJDK8.md to build the customized OpenJDK8. Make sure the needed .jar files are copied into ./maple_build/jar/ directory.
./maple_build/tools/build-libcore.sh
cd ./maple_build/examples/HelloWorld
"$MAPLE_BUILD_TOOLS"/java2asm.sh HelloWorld.java
"$MAPLE_BUILD_TOOLS"/asm2so.sh HelloWorld.s
"$MAPLE_BUILD_TOOLS"/run-app.sh -classpath ./HelloWorld.so HelloWorld
"$MAPLE_BUILD_TOOLS"/run-app.sh -gdb -classpath ./HelloWorld.so HelloWorld
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。