Fix demo compilation error with occlum-gcc on ubuntu 20.04

This commit is contained in:
Hui, Chunyang 2022-02-15 07:49:52 +00:00 committed by Zongmin.Gu
parent e0cf6bd0a6
commit d5164239d0
4 changed files with 13 additions and 19 deletions

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
OCCLUM_GCC_INC_DIR=/usr/local/occlum/include
rm -rf ncurses rm -rf ncurses
# download and install ncurses # download and install ncurses
git clone -b v6.1 --depth 1 https://github.com/mirror/ncurses.git git clone -b v6.1 --depth 1 https://github.com/mirror/ncurses.git
@ -11,9 +13,8 @@ make -j$(nproc) && make install
cd .. cd ..
# download and build FISH # 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 cd fish-shell
git apply ../fish.patch
mkdir build && cd build mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCURSES_LIBRARY=/opt/occlum/toolchains/gcc/lib/libcurses.a \ cmake ../ -DCMAKE_BUILD_TYPE=Debug -DCURSES_LIBRARY=/opt/occlum/toolchains/gcc/lib/libcurses.a \
-DCMAKE_C_COMPILER=occlum-gcc -DCMAKE_CXX_COMPILER=occlum-g++ \ -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_CXX_COMPILER_RANLIB=/usr/local/occlum/bin/occlum-ranlib \
-DCMAKE_C_COMPILER_AR=/usr/local/occlum/bin/occlum-ar \ -DCMAKE_C_COMPILER_AR=/usr/local/occlum/bin/occlum-ar \
-DCMAKE_C_COMPILER_RANLIB=/usr/local/occlum/bin/occlum-ranlib \ -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_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" -DCMAKE_CXX_FLAGS="-I/usr/local/occlum/include -fpic -pie"
make -j$(nproc) make -j$(nproc)
cd ../../ cd ../../

@ -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<job_t>
#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.

@ -2,6 +2,7 @@
set -e set -e
INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl INSTALL_DIR=/usr/local/occlum/x86_64-linux-musl
OCCLUM_GCC_INC_DIR=/usr/local/occlum/include
GRPC_VER=1.24.3 GRPC_VER=1.24.3
GRPC_SRC_DIR=$PWD/grpc-src GRPC_SRC_DIR=$PWD/grpc-src
CARES_VER=1_15_0 CARES_VER=1_15_0
@ -42,7 +43,9 @@ cmake ../ \
-Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=TRUE \ -Dprotobuf_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=TRUE \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=occlum-gcc \
-DCMAKE_CXX_COMPILER=occlum-g++ -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ -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 -j$(nproc)
make install make install

@ -2,9 +2,8 @@
#copyright@antfinancial:adopted from a script written by geding #copyright@antfinancial:adopted from a script written by geding
set -e 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 cd openssl
git checkout tags/OpenSSL_1_1_1
CC=occlum-gcc ./config \ CC=occlum-gcc ./config \
--prefix=/usr/local/occlum/x86_64-linux-musl \ --prefix=/usr/local/occlum/x86_64-linux-musl \
--openssldir=/usr/local/occlum/x86_64-linux-musl/ssl \ --openssldir=/usr/local/occlum/x86_64-linux-musl/ssl \