intel / linux-sgx

Intel SGX for Linux*
https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/linux-overview.html
Other
1.32k stars 542 forks source link

docker build fails from 2.20 #972

Open thpun opened 1 year ago

thpun commented 1 year ago

Background

I follow the instructions here to build docker images, but it fails with error fatal: not a git repository.

Steps to reproduce

git clone https://github.com/intel/linux-sgx
cd linux-sgx/
git checkout tags/<tag>
make preparation
cd docker/build
./build_and_run_aesm_docker.sh

For tag being sgx_2.20, sgx_2.21 or master branch, the following error is printed

make[3]: Leaving directory '/linux-sgx/sdk/utls'
make -C /linux-sgx/external/mbedtls
make[3]: Entering directory '/linux-sgx/external/mbedtls'
Apply patch for SGX...
fatal: not a git repository: /linux-sgx/external/mbedtls/mbedtls_code/../../../.git/modules/external/mbedtls/mbedtls_code
Makefile:57: recipe for target 'library/libmbedcrypto.a' failed
make[3]: Leaving directory '/linux-sgx/external/mbedtls'
make[3]: *** [library/libmbedcrypto.a] Error 128
Makefile.source:242: recipe for target 'mbedtls' failed
make[2]: Leaving directory '/linux-sgx/sdk'
make[2]: *** [mbedtls] Error 2
Makefile:50: recipe for target 'all' failed
make[1]: Leaving directory '/linux-sgx/sdk'
make[1]: *** [all] Error 2
Makefile:66: recipe for target 'sdk_no_mitigation' failed
make: *** [sdk_no_mitigation] Error 2
The command '/bin/sh -c make sdk_install_pkg_no_mitigation' returned a non-zero code: 2

For sgx_2.19, the docker build finished without error. So I suspect this issue is related to mbedtls/mbedtls_code which is added since release 2.20.

Environment

lzha101 commented 1 year ago

Thanks for reporting this. Looks we need to add the patch applying action to the top Makefile like the reproducible branch https://github.com/intel/linux-sgx/blob/sgx_reproducible/Makefile#L58. The bug will be fixed in next release.