Describe the bug
building the package swift fails.
To Reproduce
Steps to reproduce the behavior:
NIX_PATH=nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz nix-shell --pure -p swiftExpected behavior
Successfully building swift to be used.
Notify maintainers
Maintainer: @dtzWill
Last 4: @Ma27 @Ericson2314 @Infinisil @mroi …
Metadata
- system: `"x86_64-linux"`
- host os: `Linux 5.7.7, NixOS, 20.09pre-git (Nightingale)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.7`
- channels(root): `"nixos-20.09pre235279.5717d9d2f7c"`
- channels(sivizius): `""`
- nixpkgs: `/nix/store/sg3gjhyhpln88cavabdpgaf5lzgmdb9p-master.tar.gz`
Error
-- The C compiler identification is Clang 7.1.0
-- The CXX compiler identification is Clang 7.1.0
-- Check for working C compiler: /nix/store/5pc7rp4hm228nql5xh8ik0pvwd96iipm-clang-wrapper-7.1.0/bin/clang
-- Check for working C compiler: /nix/store/5pc7rp4hm228nql5xh8ik0pvwd96iipm-clang-wrapper-7.1.0/bin/clang - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /nix/store/5pc7rp4hm228nql5xh8ik0pvwd96iipm-clang-wrapper-7.1.0/bin/clang++
-- Check for working CXX compiler: /nix/store/5pc7rp4hm228nql5xh8ik0pvwd96iipm-clang-wrapper-7.1.0/bin/clang++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FLAG_ADDRESS_SANITIZER
-- Performing Test HAVE_FLAG_ADDRESS_SANITIZER - Failed
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS - Success
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Performing Test HAVE___BUILTIN_EXPECT
-- Performing Test HAVE___BUILTIN_EXPECT - Success
-- Performing Test HAVE___ATTRIBUTE__
-- Performing Test HAVE___ATTRIBUTE__ - Success
-- Could NOT find PythonInterp: Found unsuitable version "2.7.18", but required is at least "3" (found /nix/store/984x0xnjaf00ms5nh1r1ki3h6qd5q399-python-2.7.18/bin/python)
*** A python 3 interpreter is required to run the spec tests.
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CLANG_VERSION_MAJOR
CLANG_VERSION_MINOR
CLANG_VERSION_PATCH
CMAKE_LIBTOOL
C_INCLUDE_DIRS
GCC_INSTALL_PREFIX
GLIBC_INCLUDE_PATH
LLVM_VERSION_MAJOR
LLVM_VERSION_MINOR
LLVM_VERSION_PATCH
-- Build files have been written to: /build/build/buildbot_linux/cmark-linux-x86_64
+ popd
/build/build
+ /nix/store/ajs06x1m5ci5ij41wc2jm7ibvy0ssrv2-cmake-3.17.3/bin/cmake --build /build/build/buildbot_linux/cmark-linux-x86_64 -- -j8 all
[58/66][ 87%][31.642s] Building CXX object api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o
FAILED: api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o
/nix/store/5pc7rp4hm228nql5xh8ik0pvwd96iipm-clang-wrapper-7.1.0/bin/clang++ -I/build/src/cmark/src -Isrc -O3 -DNDEBUG -MD -MT api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o -MF api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o.d -o api_test/CMakeFiles/api_test.dir/cplusplus.cpp.o -c /build/src/cmark/api_test/cplusplus.cpp
In file included from /build/src/cmark/api_test/cplusplus.cpp:1:
/nix/store/55k63xcm3dbqj9qksmp1kv1mdw3hxqp5-gcc-9.3.0/include/c++/9.3.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
#include_next <stdlib.h>
^~~~~~~~~~
1 error generated.
[64/66][ 96%][31.962s] Building C object api_test/CMakeFiles/api_test.dir/main.c.o[KK
ninja: build stopped: subcommand failed.
/build/src/swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
/build/src/swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
builder for '/nix/store/lq1i8lknlblx7gqcs7x3cgbxld7maaq8-swift-5.1.1.drv' failed with exit code 1
error: build of '/nix/store/lq1i8lknlblx7gqcs7x3cgbxld7maaq8-swift-5.1.1.drv' failed
Seems as python2 is used for building rather than python3. Probably happened during experiments to declare python = python3.
Apart from that I'm not a swift maintainer, so if the issue is more complex, I can't help I'm afraid.
I think the Python warning is actually benign. I see a build error related to a change in the handling of CFLAGS. Commit f3f7612a409e4ebbec634ab7f20e094f206d396a appears to break it for me. I can offer a workaround, which you can try like this:
NIX_PATH=nixpkgs=https://github.com/mroi/nixpkgs/archive/patch-swift-cflags.tar.gz nix-shell -p swift
But I am not sure what the proper fix is. I would like to ask @Ericson2314 for comment.
I have pushed a new fix to my patch branch. This uses the proper fix as suggested by @Ericson2314. It would be nice, if someone can confirm it works. I have also opened PR #94160 with this fix.