已合并
优化README.md构建指导 #7
xxzzqqvvqq创建于 1月19日
优化README.md构建指导 #7
已合并
共 3 个文件变更+49-32
| @@ -6,6 +6,7 @@ | |||
| 6 | - [版本说明](#版本说明) | 6 | - [版本说明](#版本说明) |
| 7 | - [兼容性信息](#兼容性信息) | 7 | - [兼容性信息](#兼容性信息) |
| 8 | - [环境部署](#环境部署) | 8 | - [环境部署](#环境部署) |
| 9 | +- [编译流程](#编译流程) | ||
| 9 | - [快速入门](#快速入门) | 10 | - [快速入门](#快速入门) |
| 10 | - [功能介绍](#功能介绍) | 11 | - [功能介绍](#功能介绍) |
| 11 | - [API参考](#API参考) | 12 | - [API参考](#API参考) |
| @@ -59,34 +60,6 @@ OM SDK版本配套详情请参考:[版本配套说明](https://www.hiascend.co | |||
| 59 | 60 | ||
| 60 | ## 环境部署 | 61 | ## 环境部署 |
| 61 | 62 | ||
| 62 | -### 依赖准备 | ||
| 63 | -执行OM SDK编译前,请保证环境上存在以下依赖: | ||
| 64 | -zip、unzip、dos2unix、git、autoconf、automake、libtool、libc-dev、cmake、lcov、node、npm、python3、curl、build-essential,其中python版本为3.11.4。 | ||
| 65 | - | ||
| 66 | -### 编译 | ||
| 67 | - | ||
| 68 | -1. 拉取OM SDK整体源码,例如放在/home目录下。 | ||
| 69 | -2. 进入/home/OMSDK/build目录 | ||
| 70 | - ```shell | ||
| 71 | - cd /home/OMSDK/build | ||
| 72 | - ``` | ||
| 73 | -3. 修改组件版本配置文件service_config.ini中om-sdk-version字段值为所需编译版本,默认值如下: | ||
| 74 | - ``` | ||
| 75 | - om-sdk-version=7.3.0 | ||
| 76 | - ``` | ||
| 77 | -4. (可选)通过环境变量NPM_REGISTRY_MIRROR设置npm镜像地址,用户可以根据自身场景修改为其它的npm镜像地址。默认值如下: | ||
| 78 | - ```shell | ||
| 79 | - export NPM_REGISTRY_MIRROR=https://repo.huaweicloud.com/repository/npm | ||
| 80 | - ``` | ||
| 81 | -5. 执行以下命令,执行构建脚本: | ||
| 82 | - ```shell | ||
| 83 | - dos2unix *.sh && chmod +x *.sh | ||
| 84 | - ./build_all.sh | ||
| 85 | - ``` | ||
| 86 | -6. 执行完成后,可在/home/OMSDK/output目录下获取编译完成的软件包。 | ||
| 87 | - | ||
| 88 | -### 安装 | ||
| 89 | - | ||
| 90 | 在安装和使用前,用户需要了解安装须知、环境准备,具体内容请参考昇腾社区《OM SDK使用》文档,"[安装部署](https://www.hiascend.com/document/detail/zh/mindedge/72rc1/omsdk/omsdkug/omsdkag_0004.html)"章节。 | 63 | 在安装和使用前,用户需要了解安装须知、环境准备,具体内容请参考昇腾社区《OM SDK使用》文档,"[安装部署](https://www.hiascend.com/document/detail/zh/mindedge/72rc1/omsdk/omsdkug/omsdkag_0004.html)"章节。 |
| 91 | 64 | ||
| 92 | - 获取软件包 | 65 | - 获取软件包 |
| @@ -118,6 +91,52 @@ zip、unzip、dos2unix、git、autoconf、automake、libtool、libc-dev、cmake | |||
| 118 | Install MindXOM success, MindXOM service is ready. | 91 | Install MindXOM success, MindXOM service is ready. |
| 119 | ``` | 92 | ``` |
| 120 | 93 | ||
| 94 | +## 编译流程 | ||
| 95 | + | ||
| 96 | +### 依赖准备 | ||
| 97 | +OM SDK构建仅支持ARM64 CPU。 | ||
| 98 | + | ||
| 99 | +本节以ubuntu22.04系统为例,介绍如何通过源码编译生成OM软件包。 | ||
| 100 | + | ||
| 101 | +执行OM SDK编译前,请保证环境上安装了必要编译工具和依赖库,参考安装命令如下: | ||
| 102 | + | ||
| 103 | + ```shell | ||
| 104 | + apt-get update && apt-get upgrade -y | ||
| 105 | + apt-get install -y python3 python3-pip build-essential zip unzip dos2unix git cmake autoconf automake libtool curl | ||
| 106 | + | ||
| 107 | + # 由于ubuntu 22.04默认的node.js版本过低,需要手动下载安装 | ||
| 108 | + # 使用国内镜像下载node.js | ||
| 109 | + NODE_MIRROR_URL=https://mirrors.huaweicloud.com/nodejs | ||
| 110 | + # 编译OM SDK要求node.js版本最低为16.0 | ||
| 111 | + NODE_VERSION=v16.20.2 | ||
| 112 | + NODE_INSTALL_DIR=/usr/local/lib/nodejs | ||
| 113 | + mkdir -p $NODE_INSTALL_DIR | ||
| 114 | + curl -sSL $NODE_MIRROR_URL/$NODE_VERSION/node-$NODE_VERSION-linux-arm64.tar.gz | tar -zxvf - -C $NODE_INSTALL_DIR | ||
| 115 | + find $NODE_INSTALL_DIR/node-$NODE_VERSION-linux-arm64/bin -mindepth 1 -exec sh -c 'ln -s {} /usr/bin/$(basename {})' \; | ||
| 116 | + ``` | ||
| 117 | + | ||
| 118 | +### 编译 | ||
| 119 | + | ||
| 120 | +1. 拉取OM SDK整体源码,例如放在/home目录下。 | ||
| 121 | +2. 进入/home/OMSDK/build目录 | ||
| 122 | + ```shell | ||
| 123 | + cd /home/OMSDK/build | ||
| 124 | + ``` | ||
| 125 | +3. 修改组件版本配置文件service_config.ini中om-sdk-version字段值为所需编译版本,默认值如下: | ||
| 126 | + ``` | ||
| 127 | + om-sdk-version=7.3.0 | ||
| 128 | + ``` | ||
| 129 | +4. (可选)通过环境变量NPM_REGISTRY_MIRROR设置npm镜像地址,用户可以根据自身场景修改为其它的npm镜像地址。默认值如下: | ||
| 130 | + ```shell | ||
| 131 | + export NPM_REGISTRY_MIRROR=https://repo.huaweicloud.com/repository/npm | ||
| 132 | + ``` | ||
| 133 | +5. 执行以下命令,执行构建脚本: | ||
| 134 | + ```shell | ||
| 135 | + dos2unix *.sh && chmod +x *.sh | ||
| 136 | + ./build_all.sh | ||
| 137 | + ``` | ||
| 138 | +6. 执行完成后,可在/home/OMSDK/output目录下获取编译完成的软件包。 | ||
| 139 | + | ||
| 121 | ## 快速入门 | 140 | ## 快速入门 |
| 122 | 141 | ||
| 123 | 安装OM SDK后,可登录边缘管理系统进行基础操作、系统管理和数据配置。具体内容请参考昇腾社区《OM SDK使用》文档,"[新手入门](https://www.hiascend.com/document/detail/zh/mindedge/72rc1/omsdk/omsdkug/help_003.html)"章节。 | 142 | 安装OM SDK后,可登录边缘管理系统进行基础操作、系统管理和数据配置。具体内容请参考昇腾社区《OM SDK使用》文档,"[新手入门](https://www.hiascend.com/document/detail/zh/mindedge/72rc1/omsdk/omsdkug/help_003.html)"章节。 |
| @@ -56,6 +56,7 @@ LDFLAG="-Wl,-z,relro,-z,now,-z,noexecstack -pie -s" | |||
| 56 | --with-cc-opt="$CFLAG" --with-ld-opt="$LDFLAG" --without-http_auth_basic_module \ | 56 | --with-cc-opt="$CFLAG" --with-ld-opt="$LDFLAG" --without-http_auth_basic_module \ |
| 57 | --without-http_autoindex_module --without-http_map_module --without-http_fastcgi_module \ | 57 | --without-http_autoindex_module --without-http_map_module --without-http_fastcgi_module \ |
| 58 | --without-http_memcached_module --without-http_empty_gif_module --without-http_upstream_ip_hash_module \ | 58 | --without-http_memcached_module --without-http_empty_gif_module --without-http_upstream_ip_hash_module \ |
| 59 | + --with-openssl-opt='-Wall -fPIC -fstack-protector-all -O2 -fomit-frame-pointer' \ | ||
| 59 | --with-pcre-opt='-Wall -fPIC -fstack-protector-all -O2 -fomit-frame-pointer' \ | 60 | --with-pcre-opt='-Wall -fPIC -fstack-protector-all -O2 -fomit-frame-pointer' \ |
| 60 | --http-client-body-temp-path=${OM_WORK_DIR}/software/nginx/client_body_temp | 61 | --http-client-body-temp-path=${OM_WORK_DIR}/software/nginx/client_body_temp |
| 61 | 62 | ||
| @@ -55,10 +55,7 @@ function build_prepare() | |||
| 55 | 55 | ||
| 56 | cp -rf ${TOP_DIR}/opensource/libboundscheck/include/* ${TOP_DIR}/test/C++/output | 56 | cp -rf ${TOP_DIR}/opensource/libboundscheck/include/* ${TOP_DIR}/test/C++/output |
| 57 | cp -rf ${TOP_DIR}/opensource/googletest/googletest/include/* ${TOP_DIR}/test/C++/output | 57 | cp -rf ${TOP_DIR}/opensource/googletest/googletest/include/* ${TOP_DIR}/test/C++/output |
| 58 | - mkdir -p ${TOP_DIR}/test/C++/output/crypto/rsa/ | 58 | + cp -rf "${TOP_DIR}"/opensource/openssl/include/* "${TOP_DIR}"/test/C++/output/ |
| 59 | - cp -f ${TOP_DIR}/opensource/openssl/crypto/rsa/rsa_local.h "${TOP_DIR}"/test/C++/output/crypto/rsa/ | ||
| 60 | - mkdir -p ${TOP_DIR}/test/C++/output/crypto/evp/ | ||
| 61 | - cp -f "${TOP_DIR}"/opensource/openssl/crypto/evp/evp_local.h "${TOP_DIR}"/test/C++/output/crypto/evp/ | ||
| 62 | 59 | ||
| 63 | cp -rf ${TOP_DIR}/test/install/lib/libcrypto.so* ${TOP_DIR}/test/C++/lib/ | 60 | cp -rf ${TOP_DIR}/test/install/lib/libcrypto.so* ${TOP_DIR}/test/C++/lib/ |
| 64 | cp -rf ${TOP_DIR}/test/install/lib/libssl.so* ${TOP_DIR}/test/C++/lib/ | 61 | cp -rf ${TOP_DIR}/test/install/lib/libssl.so* ${TOP_DIR}/test/C++/lib/ |