From d5164239d02b20bed47995bae43e908a71357c47 Mon Sep 17 00:00:00 2001 From: "Hui, Chunyang" Date: Tue, 15 Feb 2022 07:49:52 +0000 Subject: [PATCH] Fix demo compilation error with occlum-gcc on ubuntu 20.04 --- demos/fish/download_and_build.sh | 11 ++++++++--- demos/fish/fish.patch | 13 ------------- demos/grpc/grpc_tls/download_and_install_grpc.sh | 5 ++++- demos/grpc/grpc_tls/download_and_install_openssl.sh | 3 +-- 4 files changed, 13 insertions(+), 19 deletions(-) delete mode 100644 demos/fish/fish.patch diff --git a/demos/fish/download_and_build.sh b/demos/fish/download_and_build.sh index fd9e5dc6..be62f728 100755 --- a/demos/fish/download_and_build.sh +++ b/demos/fish/download_and_build.sh @@ -1,6 +1,8 @@ #!/bin/bash set -e +OCCLUM_GCC_INC_DIR=/usr/local/occlum/include + rm -rf ncurses # download and install ncurses git clone -b v6.1 --depth 1 https://github.com/mirror/ncurses.git @@ -11,9 +13,8 @@ make -j$(nproc) && make install cd .. # download and build FISH -git clone -b 3.1.2 --depth 1 https://github.com/fish-shell/fish-shell.git +git clone -b 3.3.1 --depth 1 https://github.com/fish-shell/fish-shell.git cd fish-shell -git apply ../fish.patch mkdir build && cd build cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCURSES_LIBRARY=/opt/occlum/toolchains/gcc/lib/libcurses.a \ -DCMAKE_C_COMPILER=occlum-gcc -DCMAKE_CXX_COMPILER=occlum-g++ \ @@ -21,8 +22,12 @@ cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCURSES_LIBRARY=/opt/occlum/toolchains/gcc/ -DCMAKE_CXX_COMPILER_RANLIB=/usr/local/occlum/bin/occlum-ranlib \ -DCMAKE_C_COMPILER_AR=/usr/local/occlum/bin/occlum-ar \ -DCMAKE_C_COMPILER_RANLIB=/usr/local/occlum/bin/occlum-ranlib \ +-DCURSES_INCLUDE_PATH=$OCCLUM_GCC_INC_DIR \ +-DIntl_INCLUDE_DIR=$OCCLUM_GCC_INC_DIR \ +-DSYS_PCRE2_INCLUDE_DIR=$OCCLUM_GCC_INC_DIR \ +-DZLIB_INCLUDE_DIR=$OCCLUM_GCC_INC_DIR \ +-DCMAKE_INSTALL_OLDINCLUDEDIR=$OCCLUM_GCC_INC_DIR \ -DCMAKE_LINKER=/usr/local/occlum/bin/occlum-ld -DCMAKE_C_FLAGS="-I/usr/local/occlum/include -fpic -pie" \ -DCMAKE_CXX_FLAGS="-I/usr/local/occlum/include -fpic -pie" make -j$(nproc) cd ../../ - diff --git a/demos/fish/fish.patch b/demos/fish/fish.patch deleted file mode 100644 index 4ca45269..00000000 --- a/demos/fish/fish.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/exec.cpp b/src/exec.cpp -index 1557caf0b..254dd0e2e 100644 ---- a/src/exec.cpp -+++ b/src/exec.cpp -@@ -565,7 +565,7 @@ static bool exec_external_command(parser_t &parser, const std::shared_ptr - - #if FISH_USE_POSIX_SPAWN - // Prefer to use posix_spawn, since it's faster on some systems like OS X. -- bool use_posix_spawn = g_use_posix_spawn && can_use_posix_spawn_for_job(j, dup2s); -+ bool use_posix_spawn = g_use_posix_spawn; //&& can_use_posix_spawn_for_job(j, dup2s); - if (use_posix_spawn) { - s_fork_count++; // spawn counts as a fork+exec - // Create posix spawn attributes and actions. diff --git a/demos/grpc/grpc_tls/download_and_install_grpc.sh b/demos/grpc/grpc_tls/download_and_install_grpc.sh index 69e3582d..0e05aa43 100755 --- a/demos/grpc/grpc_tls/download_and_install_grpc.sh +++ b/demos/grpc/grpc_tls/download_and_install_grpc.sh @@ -2,6 +2,7 @@ set -e INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl +OCCLUM_GCC_INC_DIR=/usr/local/occlum/include GRPC_VER=1.24.3 GRPC_SRC_DIR=$PWD/grpc-src CARES_VER=1_15_0 @@ -42,7 +43,9 @@ cmake ../ \ -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=TRUE \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ -DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ - -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE + -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE \ + -DCMAKE_INSTALL_OLDINCLUDEDIR=$OCCLUM_GCC_INC_DIR \ + -DZLIB_INCLUDE_DIR=$OCCLUM_GCC_INC_DIR make -j$(nproc) make install diff --git a/demos/grpc/grpc_tls/download_and_install_openssl.sh b/demos/grpc/grpc_tls/download_and_install_openssl.sh index 289002dd..3bfdda5f 100755 --- a/demos/grpc/grpc_tls/download_and_install_openssl.sh +++ b/demos/grpc/grpc_tls/download_and_install_openssl.sh @@ -2,9 +2,8 @@ #copyright@antfinancial:adopted from a script written by geding set -e -git clone http://github.com/openssl/openssl +git clone -b OpenSSL_1_1_1 --depth 1 http://github.com/openssl/openssl cd openssl -git checkout tags/OpenSSL_1_1_1 CC=occlum-gcc ./config \ --prefix=/usr/local/occlum/x86_64-linux-musl \ --openssldir=/usr/local/occlum/x86_64-linux-musl/ssl \