[installer] Add glibc installer deb
This commit is contained in:
parent
d2071f65da
commit
a20b52bae3
@ -26,7 +26,7 @@ If a user wants to build his application on a platform installed with Occlum ins
|
||||
cd tools/installer/deb
|
||||
make <language option>
|
||||
```
|
||||
Now, only `musl-gcc` and `golang` options are supported. And the installer can be found under `build/debs`.
|
||||
Now, only `musl-gcc`, `glibc` and `golang` options are supported. And the installer can be found under `build/debs`.
|
||||
|
||||
### How to Use
|
||||
|
||||
@ -36,7 +36,7 @@ To run Occlum on clean Ubuntu 18.04, please follow below steps:
|
||||
**Step 1. Install Prerequisites**
|
||||
```
|
||||
apt-get update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libcurl4-openssl-dev libssl-dev libprotobuf-dev libfuse-dev autoconf automake make cmake libtool gdb python jq ca-certificates gnupg wget vim
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libcurl4-openssl-dev libssl-dev libprotobuf-dev libfuse-dev autoconf automake make cmake libtool gdb python jq ca-certificates gnupg wget vim rsync
|
||||
```
|
||||
|
||||
**Step 2. Install Intel® SGX driver and Intel® SGX PSW**
|
||||
@ -65,11 +65,16 @@ apt install -y ./occlum-sgx-tools*.deb
|
||||
```
|
||||
|
||||
Toolchains are needed when compiling applications and also during runtime. C/C++ toolchain is a must for Occlum commands.
|
||||
To install C/C++ toolchain, just run the command:
|
||||
To install musl C/C++ toolchain, just run the command:
|
||||
```
|
||||
apt install -y ./occlum-toolchains-gcc*.deb
|
||||
```
|
||||
|
||||
Also, users can install glibc to support glibc based applications.
|
||||
```
|
||||
apt install -y ./occlum-toolchains-glibc*.deb
|
||||
```
|
||||
|
||||
Besides, users can choose to install the toolchain installer based on the application's language. Currently, we also supports Golang. More language toolchain installers are on the way. To install Golang toolchain, run the below commands:
|
||||
```
|
||||
apt install -y ./occlum-toolchains-golang*.deb
|
||||
|
@ -18,10 +18,11 @@ C_TOOLCHAIN_PACKAGE_NAME := occlum-toolchains-gcc
|
||||
# update the "changelog" file accordingly.
|
||||
MUSL_VERSION := 0.27.0
|
||||
GOLAN_VERSION := 0.16.0
|
||||
GLIBC_VERSION := 2.31
|
||||
|
||||
GO_PATCH = $(PROJECT_DIR)/tools/toolchains/golang/adapt-golang-to-occlum.patch
|
||||
|
||||
.PHONY: all main config_files main_deps musl-gcc deps_c clean clean-build
|
||||
.PHONY: all main config_files main_deps musl-gcc deps_c glibc deps_glibc clean clean-build
|
||||
|
||||
all: main
|
||||
|
||||
@ -78,6 +79,17 @@ deps_golang:
|
||||
cp -r toolchains/golang $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian
|
||||
cp -t $(DEB_BUILD_DIR)/occlum-toolchains-golang/debian $(GO_PATCH) $(PROJECT_DIR)/tools/installer/rpm/toolchains/golang/occlum-go.sh
|
||||
|
||||
glibc: deps_glibc
|
||||
cd $(DEB_BUILD_DIR)/occlum-toolchains-glibc ; \
|
||||
dpkg-buildpackage -us -uc
|
||||
cp -t $(TARGET_DIR) $(DEB_BUILD_DIR)/occlum-toolchains-glibc*.deb
|
||||
|
||||
deps_glibc:
|
||||
mkdir -p $(TARGET_DIR)
|
||||
mkdir -p $(DEB_BUILD_DIR)/occlum-toolchains-glibc
|
||||
cp -r toolchains/glibc $(DEB_BUILD_DIR)/occlum-toolchains-glibc/debian
|
||||
sed -i -e 's/$$GLIBC_VERSION/$(GLIBC_VERSION)/g' $(DEB_BUILD_DIR)/occlum-toolchains-glibc/debian/changelog
|
||||
|
||||
clean-build:
|
||||
rm -rf $(DEB_BUILD_DIR)
|
||||
clean: clean-build
|
||||
|
5
tools/installer/deb/toolchains/glibc/changelog
Normal file
5
tools/installer/deb/toolchains/glibc/changelog
Normal file
@ -0,0 +1,5 @@
|
||||
occlum-toolchains-glibc (2.31-1) unstable; urgency=medium
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Qi Zheng <huaiqing.zq@antgroup.com> Tue, 13 Sep 2022 14:37:39 +0000
|
1
tools/installer/deb/toolchains/glibc/compat
Normal file
1
tools/installer/deb/toolchains/glibc/compat
Normal file
@ -0,0 +1 @@
|
||||
10
|
12
tools/installer/deb/toolchains/glibc/control
Normal file
12
tools/installer/deb/toolchains/glibc/control
Normal file
@ -0,0 +1,12 @@
|
||||
Source: occlum-toolchains-glibc
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: Qi Zheng <huaiqing.zq@antgroup.com>
|
||||
Build-Depends: debhelper (>=9), autoconf, automake, build-essential, cmake, libtool, ocaml, ocamlbuild, python, libssl-dev, libcurl4-openssl-dev, libprotobuf-dev, git, protobuf-compiler
|
||||
Standards-Version: 4.1.2
|
||||
Homepage: https://github.com/occlum/glibc
|
||||
|
||||
Package: occlum-toolchains-glibc
|
||||
Architecture: amd64
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Occlum glibc libraries
|
61
tools/installer/deb/toolchains/glibc/rules
Executable file
61
tools/installer/deb/toolchains/glibc/rules
Executable file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/make -f
|
||||
export DH_VERBOSE = 1
|
||||
export deb_build_dir = /tmp/deb_build
|
||||
export name = occlum-toolchains-glibc
|
||||
export buildroot := $(deb_build_dir)/$(name)/debian/$(name)
|
||||
|
||||
export tmp_build_dir = $(deb_build_dir)/$(name)/tmp_build
|
||||
export src_dir = $(tmp_build_dir)/glibc
|
||||
export install_dir = $(buildroot)/opt/occlum/glibc
|
||||
|
||||
SHELL = /bin/bash
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS=hardening=+pie,-fortify
|
||||
|
||||
# Users can pass "-j$(nproc)" by specifying this env.
|
||||
# This is not enabled by default because under certain scenarios,
|
||||
# make will use too many jobs and gcc will be killed because out
|
||||
# of memory.
|
||||
BUILD_OPTIONS +=
|
||||
|
||||
.ONESHELL: prepare_glibc override_dh_install
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
# All rules executed in one shell
|
||||
prepare_glibc:
|
||||
rm -rf $(tmp_build_dir)
|
||||
rm -rf $(install_dir)
|
||||
mkdir -p $(src_dir)
|
||||
cd $(src_dir)
|
||||
git clone -b occlum-glibc-2.31 https://github.com/occlum/glibc .
|
||||
|
||||
|
||||
override_dh_auto_build: prepare_glibc
|
||||
mkdir -p $(tmp_build_dir)/build
|
||||
cd $(tmp_build_dir)/build
|
||||
unset LD_LIBRARY_PATH
|
||||
${src_dir}/configure \
|
||||
--prefix=${install_dir} --with-tls --without-selinux \
|
||||
--disable-nscd
|
||||
make
|
||||
|
||||
|
||||
# We create symlinks in /usr/local
|
||||
override_dh_usrlocal:
|
||||
echo "Skip ..."
|
||||
|
||||
override_dh_fixperms:
|
||||
dh_fixperms
|
||||
|
||||
override_dh_install:
|
||||
cd $(tmp_build_dir)/build
|
||||
make install
|
||||
|
||||
clean:
|
||||
dh_clean
|
||||
rm -f $(buildroot)
|
||||
|
||||
override_dh_shlibdeps:
|
||||
echo "skip ..."
|
1
tools/installer/deb/toolchains/glibc/source/format
Normal file
1
tools/installer/deb/toolchains/glibc/source/format
Normal file
@ -0,0 +1 @@
|
||||
1.0
|
Loading…
Reference in New Issue
Block a user