gramineproject / graphene

Graphene / Graphene-SGX - a library OS for Linux multi-process applications, with Intel SGX support
https://grapheneproject.io
GNU Lesser General Public License v3.0
771 stars 260 forks source link

[Linux-SGX] Compile sgx tools with meson #2645

Closed woju closed 3 years ago

woju commented 3 years ago

Description of the changes

This is another step towards mesonification of Linux-SGX. The changes keep piling up, so maybe I can merge this undertaking in smaller chunks.

How to test this PR?

Jenkins


This change is Reviewable

woju commented 3 years ago

Jenkins, retest Jenkins-Debug-20.04 please (writev07)

woju commented 3 years ago

a discussion (no related file):

Previously, woju (Wojtek Porczyk) wrote…
This would work fine if you used `meson dist` on meson 0.55, which produces tarball with subprojects already fetched. Then you can unpack this tarball and run `meson setup`. (This will be intended method of source distribution for packaging, once everything important will be mesonified.) To execute `meson setup` without subprojects fetched, you need meson >= 0.55, because `packagefiles=`in wraps is supported since then, and without that we'd have to either maintain forks or make available tarballs(!) with overlays. Or yolo, scrap all that and let's say you need meson >= 0.55, and users on 18.04 can download meson from unsigned pip.

I mean, patch_directory =. Aaand I fixed / problem in my tree, will push with next batch.


boryspoplawski commented 3 years ago

Jenkins, retest Jenkins-20.04 please (LTP fcntl14, setrlimit02, setrlimit03, setrlimit05 timed out, unrelated)

anjalirai-intel commented 3 years ago

Hi @woju

I wanted to know what is the status of Meson changes for Graphene? As part of Meson changes make command will be replaced by Meson but in documentation I still see that make commands are still in use, so I wanted to know if there will be other PR's for Meson and is it part of Release 1.0 validation.

As part of this PR, there has been some changes done for meson, for e.g. is_sgx_available does not have make file, is it supposed to be built along with initial make at Graphene source level directory or it has to be built separately. If someone has to build is_sgx_available, how they can build it manually?

anjalirai-intel commented 3 years ago

@woju @jinengandhi-intel

Yes, I could see is-sgx-available executable in /usr/local/bin. Initially it used to be in the Pal/src/host/Linux-SGX/tools/is-sgx-available so i was verifying in the previous location itself.

woju commented 3 years ago

@anjalirai-intel Thanks for verifying!

With meson, builds are out-of-tree, which means that no build artifacts will be found in source tree, ever. Instead, everything will be in build directory (whatever you specify to meson setup, in CI it's simply build/). So if you named it build/, you can find it under build/Pal/src/host/Linux-SGX/tools/is_sgx_available. There's a caveat though: when installing, meson changes the binaries slightly, at least it removes temporary rpaths, which are included in binaries while they sit in builddir, and only install_rpaths are preserved. So please use and verify only binaries after install.

woju commented 3 years ago

.ci/lib/stage-build-sgx.jenkinsfile, line 48 at r1 (raw file):

Previously, pwmarcz (Paweł Marczewski) wrote…
Sounds reasonable to me, and will make running the command-line tools easier to the user.

1) We don't have a way to see if --prefix was specified in cmdline, and if there was, this would be wrong, because we change --prefix=/usr in release builds (deb). And I don't want this rpath in release builds. 2) It doesn't make running command-line tools any easier, they already run fine.

It will blow only if something overrides this LD_LIBRARY_PATH, but I don't think this would happen.

woju commented 3 years ago

Moved to gramineproject/gramine#64.