forked from hyperledger-labs/private-data-objects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·141 lines (118 loc) · 4.59 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·141 lines (118 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
# Copyright 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------
# -----------------------------------------------------------------
SCRIPTDIR="$(dirname $(readlink --canonicalize ${BASH_SOURCE}))"
SRCDIR="$(realpath ${SCRIPTDIR}/../..)"
source ${SRCDIR}/bin/lib/common.sh
check_pdo_build_env
check_python_version
# Automatically determine how many cores the host system has
# (for use with multi-threaded make)
NUM_CORES=$(grep -c '^processor' /proc/cpuinfo)
if [ "$NUM_CORES " == " " ]; then
NUM_CORES=4
fi
F_CLIENT='no'
TEMP=$(getopt -o '' --long 'client,trusted,untrusted' -n "build.sh" -- "$@")
if [ $? != 0 ] ; then echo "Usage: build.sh [--client]" >&2 ; exit 1 ; fi
eval set -- "$TEMP"
while true ; do
case "$1" in
--client) F_CLIENT="yes" ; shift 1 ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit 1 ;;
esac
done
if [ ${F_CLIENT} == "yes" ]; then
CMAKE_ARGS="-DBUILD_CLIENT=1 -DBUILD_TRUSTED=0 -DBUILD_UNTRUSTED=0"
MAKE_ARGS="-j${NUM_CORES} BUILD_CLIENT=1"
else
CMAKE_ARGS="-DBUILD_CLIENT=0 -DBUILD_TRUSTED=1 -DBUILD_UNTRUSTED=1"
MAKE_ARGS="-j${NUM_CORES} BUILD_CLIENT=0"
fi
# Set CMAKE built type through the CMAKE_BUILD_TYPE variable; this works
# for cmake version 3.22; later versions can use --config <Debug|Release>
#
# Note that the build type affects the SGX debug flag:
# * Build type "Release" defines NDEBUG, which causes sgx_urts.h to set SGX_DEBUG_FLAG to 0.
# * Build type "Debug" does not define NDEBUG, which causes sgx_urts.h to set SGX_DEBUG_FLAG to 1.
#
# We do not need to explicitly add these to the make args; as environment variables they will be
# passed through appropriately
if [ ${PDO_DEBUG_BUILD} == "0" ]; then
CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Release"
else
CMAKE_ARGS+=" -DCMAKE_BUILD_TYPE=Debug"
fi
# We need to export CMAKE_ARGS so that the Makefiles that call
# cmake (e.g. pservice and eservice) will pick up these definitions
export CMAKE_ARGS
# -----------------------------------------------------------------
# BUILD
# -----------------------------------------------------------------
yell --------------- COMMON ---------------
# now build the rest of common
cd $SRCDIR/common
if [ ! -d build ]; then
yell create the build directory
mkdir -p build
pushd build
try cmake ${CMAKE_ARGS} ..
popd
fi
cd build
#In the following we use a single threaded build due to race conditions the arise with a multi-threaded one.
#In the following we append the error log for multi-threaded (j4) build for troubleshooting in the future.
#11 33.53 build.sh: ERROR: operation failed: cmake --build . -- -j4 BUILD_CLIENT=0
#11 33.53 make[1]: *** [Makefile:98: build] Error 111
#11 33.53 make[1]: Leaving directory '/project/pdo/src/build'
#11 33.53 make: *** [Makefile:101: verified-build] Error 2
#11 33.53 make: Leaving directory '/project/pdo/src/build'
#11 33.53 build_services.sh: ERROR: operation failed: make -C /project/pdo/src/build verified-build
#11 ERROR: process "/bin/sh -c /project/pdo/tools/build_services.sh" did not complete successfully: exit code: 111
try cmake --build . -- ${MAKE_ARGS} -j1
yell --------------- BIN ---------------
cd $SRCDIR/bin
try make ${MAKE_ARGS}
try make ${MAKE_ARGS} install
yell --------------- PYTHON ---------------
cd $SRCDIR/python
try make ${MAKE_ARGS}
try make ${MAKE_ARGS} install
yell --------------- SSERVICE ---------------
cd $SRCDIR/sservice
try make "-j$NUM_CORES" BUILD_CLIENT=${BUILD_CLIENT}
try make install BUILD_CLIENT=${BUILD_CLIENT}
yell --------------- ESERVICE ---------------
if [ ${F_CLIENT} == "no" ]; then
cd $SRCDIR/eservice
try make ${MAKE_ARGS}
try make ${MAKE_ARGS} install
fi
yell --------------- PSERVICE ---------------
if [ ${F_CLIENT} == "no" ]; then
cd $SRCDIR/pservice
try make ${MAKE_ARGS}
try make ${MAKE_ARGS} install
fi
yell --------------- CLIENT ---------------
cd $SRCDIR/client
try make ${MAKE_ARGS}
try make ${MAKE_ARGS} install
yell --------------- CONTRACTS ---------------
cd $SRCDIR/contracts
try make ${MAKE_ARGS} all
try make ${MAKE_ARGS} install