Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-build failing whereas nix-shell --pure works #11

Open
2 of 5 tasks
sbellem opened this issue Oct 16, 2020 · 3 comments
Open
2 of 5 tasks

nix-build failing whereas nix-shell --pure works #11

sbellem opened this issue Oct 16, 2020 · 3 comments

Comments

@sbellem
Copy link
Contributor

sbellem commented Oct 16, 2020

Building and installing the SGX SDK works in a nix-shell session, including when using the --pure option, but when building with nix-build it fails as it tries to apply an OpenMP patch with git, which is not available.

Thing to look for:

  • Is git available in the nix shell session?
  • Find out if the patch is applied in nix shell session.
  • Understand differences between using nix-build, nix-shell and nix-shell --pure. Why is --pure not "pure enough"?
  • If patch is not applied in nix shell session, then just disable the trigger for when using nix-build. But try to understand what is causing the different behaviors.
  • temporary measure: try adding git as a dependency

For use an already patched version of openmp and disable the check and git apply command invocation.

make[3]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/sdk/pthread'
make -C /tmp/nix-build-sgx.drv-0/source/external/openmp
make[3]: Entering directory '/tmp/nix-build-sgx.drv-0/source/external/openmp'
cd openmp_code && git apply ../0001-Enable-OpenMP-in-SGX.patch && cd ..
/nix/store/l6h4ya0wzb4b8mr0y58k2gh2nhfql4sn-bash-4.4-p23/bin/bash: git: command not found
make[3]: *** [Makefile:70: openmp_code/final/build/runtime/src/libomp.a] Error 127
make[3]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp'
make[2]: *** [Makefile.source:201: openmp] Error 2
make[2]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/sdk'
make[1]: *** [Makefile:50: all] Error 2
make[1]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/sdk'
make: *** [Makefile:70: sdk] Error 2
builder for '/nix/store/vmwr9980q11idzyzzpbqhwfjapkf3zsv-sgx.drv' failed with exit code 2
error: build of '/nix/store/vmwr9980q11idzyzzpbqhwfjapkf3zsv-sgx.drv' failed
@sbellem
Copy link
Contributor Author

sbellem commented Oct 16, 2020

@sbellem
Copy link
Contributor Author

sbellem commented Oct 16, 2020

when using already patched openmp:

make[6]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
[  5%] Built target libomp-needed-headers
make[6]: Entering directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
Scanning dependencies of target omp
make[6]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
make[6]: Entering directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
[  8%] Building C object runtime/src/CMakeFiles/omp.dir/thirdparty/ittnotify/ittnotify_static.c.o
[ 11%] Building CXX object runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o
In file included from /tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/runtime/src/kmp.h:62,
                 from /tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/runtime/src/kmp_alloc.cpp:14:
/nix/store/7b67hqgxavm47qizrkya55qvyp1f65s4-glibc-2.27-dev/include/signal.h:301:11: fatal error: stddef.h: No such file or directory
 # include <stddef.h>
           ^~~~~~~~~~
compilation terminated.
make[6]: *** [runtime/src/CMakeFiles/omp.dir/build.make:76: runtime/src/CMakeFiles/omp.dir/kmp_alloc.cpp.o] Error 1
make[6]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
make[5]: *** [CMakeFiles/Makefile2:234: runtime/src/CMakeFiles/omp.dir/all] Error 2
make[5]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
make[4]: *** [Makefile:130: all] Error 2
make[4]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp/openmp_code/final/build'
make[3]: *** [Makefile:73: openmp_code/final/build/runtime/src/libomp.a] Error 2
make[3]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/external/openmp'
make[2]: *** [Makefile.source:201: openmp] Error 2
make[2]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/sdk'
make[1]: *** [Makefile:50: all] Error 2
make[1]: Leaving directory '/tmp/nix-build-sgx.drv-0/source/sdk'
make: *** [Makefile:70: sdk] Error 2
builder for '/nix/store/0640jh4gs8fm1x16hfps5dss3mpc7nja-sgx.drv' failed with exit code 2
error: build of '/nix/store/0640jh4gs8fm1x16hfps5dss3mpc7nja-sgx.drv' failed

@sbellem
Copy link
Contributor Author

sbellem commented Oct 16, 2020

In the nix shell, the patch is applied:

make[3]: Leaving directory '/usr/src/source/sdk/pthread'                                                                                                                                                 [146/32369]
make -C /usr/src/source/external/openmp
make[3]: Entering directory '/usr/src/source/external/openmp'
cd openmp_code && git apply ../0001-Enable-OpenMP-in-SGX.patch && cd ..
../0001-Enable-OpenMP-in-SGX.patch:239: trailing whitespace.
#define KMP_NOW() get_timestamp()
../0001-Enable-OpenMP-in-SGX.patch:341: trailing whitespace.
#ifndef _OPENMP_SGX
../0001-Enable-OpenMP-in-SGX.patch:748: trailing whitespace.
#ifdef _OPENMP_SGX
../0001-Enable-OpenMP-in-SGX.patch:1043: trailing whitespace.
        return __sync_add_and_fetch(&__kmp_global_count, 20*KMP_USEC_PER_SEC);
../0001-Enable-OpenMP-in-SGX.patch:1123: trailing whitespace.
#endif // _OPENMP_SGX
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.
mkdir -p openmp_code/final/build && cd openmp_code/final/build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_WORKS=TRUE -DCMAKE_CXX_COMPILER_WORKS=TRUE -DCMAKE_CXX_FLAGS=" -ffreestanding -nostdinc -fvisi
bility=hidden  -fpic -fno-strict-overflow -fno-delete-null-pointer-checks -B/usr/src/source/external/toolset/nix -mindirect-branch-register -fcf-protection=none -mfunction-return=thunk-extern -fno-plt -Wa,-mlfenc
e-after-load=yes -Wa,-mlfence-before-indirect-branch=memory -Wa,-mlfence-before-ret=shl -nostdinc++" .. && make
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test OPENMP_HAVE_WERROR_FLAG
-- Performing Test OPENMP_HAVE_WERROR_FLAG - Success
-- Performing Test OPENMP_HAVE_STD_GNUPP11_FLAG
-- Performing Test OPENMP_HAVE_STD_GNUPP11_FLAG - Failed
-- Performing Test OPENMP_HAVE_STD_CPP11_FLAG
-- Performing Test OPENMP_HAVE_STD_CPP11_FLAG - Failed
-- Found PythonInterp: /nix/store/k0igqpz995nmxwf6piyd5jjpcc7gcnyc-python3-3.7.4/bin/python (found version "3.7.4")
-- Cannot find llvm-lit.
-- Please put llvm-lit in your PATH, set OPENMP_LLVM_LIT_EXECUTABLE to its full path, or point OPENMP_LLVM_TOOLS_DIR to its directory.
CMake Warning at cmake/OpenMPTesting.cmake:22 (message):
  The check targets will not be available!
Call Stack (most recent call first):
  cmake/OpenMPTesting.cmake:40 (find_standalone_test_dependencies)
  CMakeLists.txt:49 (include)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant