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

[Bug]: Error while installing ninja #8951

Closed
bidyut1153 opened this issue Feb 7, 2022 · 18 comments
Closed

[Bug]: Error while installing ninja #8951

bidyut1153 opened this issue Feb 7, 2022 · 18 comments
Labels
python Issue is about python-related stuff, including pip.

Comments

@bidyut1153
Copy link

bidyut1153 commented Feb 7, 2022

Problem description

I'm trying to install ninja but it got error:-

Collecting ninja
  Using cached ninja-1.10.2.3.tar.gz (26 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: ninja
  Building wheel for ninja (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /data/data/com.termux/files/usr/bin/python3 /data/data/com.termux/files/usr/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /data/data/com.termux/files/usr/tmp/tmpv3od5ua7
       cwd: /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947
  Complete output (166 lines):
  Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  -- The C compiler identification is Clang 13.0.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- The CXX compiler identification is Clang 13.0.0
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_cmake_test_compile/build
  -- The C compiler identification is Clang 13.0.0
  -- The CXX compiler identification is Clang 13.0.0
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- *********************************************
  -- Ninja Python Distribution
  --
  --   BUILD_VERBOSE             : OFF
  --
  --   ARCHIVE_DOWNLOAD_DIR      : /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build
  --
  --     src_archive             : unix_source
  --     <src_archive>_url       : https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz
  --     <src_archive>_sha256    : 549c31ee596566b952c600e23eb9b8d39a4112cd5fdeb2e5a83370669176da40
  -- *********************************************
  -- download_ninja_source - URL: https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz
  -- Found PythonInterp: /data/data/com.termux/files/usr/bin/python3 (found version "3.10.2")
  -- Configuring done
  -- Generating done
  CMake Warning:
    Manually-specified variables were not used by the project:

      PYTHON_INCLUDE_DIR
      PYTHON_LIBRARY
      SKBUILD


  -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build
  [ 11%] Creating directories for 'download_ninja_source'
  [ 22%] Performing download step (download, verify and extract) for 'download_ninja_source'
  -- Downloading...
     dst='/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
     timeout='none'
     inactivity timeout='none'
  -- Using src='https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
  -- verifying file...
         file='/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
  -- Downloading... done
  -- extracting...
       src='/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
       dst='/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/Ninja-src'
  -- extracting... [tar xfz]
  -- extracting... [analysis]
  -- extracting... [rename]
  -- extracting... [clean up]
  -- extracting... done
  [ 33%] No update step for 'download_ninja_source'
  [ 44%] No patch step for 'download_ninja_source'
  [ 55%] No configure step for 'download_ninja_source'
  [ 66%] No build step for 'download_ninja_source'
  [ 77%] No install step for 'download_ninja_source'
  [ 88%] Completed 'download_ninja_source'
  [ 88%] Built target download_ninja_source
  [100%] Generating ../../../Ninja-src/ninja
  ./src/subprocess-posix.cc:26:10: fatal error: 'spawn.h' file not found
  #include <spawn.h>
           ^~~~~~~~~
  1 error generated.
  bootstrapping ninja...
  warning: A compatible version of re2c (>= 0.11.3) was not found; changes to src/*.in.cc will not affect your build.
  when running:  c++ -MMD -MT build/subprocess-posix.o -MF build/subprocess-posix.o.d -g -Wall -Wextra -Wno-deprecated -Wno-missing-field-initializers -Wno-unused-parameter -fno-rtti -fno-exceptions -fvisibility=hidden -pipe '-DNINJA_PYTHON="python3"' -O2 -DNDEBUG -fdiagnostics-color -DUSE_PPOLL -DNINJA_HAVE_BROWSE -I. -D_BSD_SOURCE -c ./src/subprocess-posix.cc -o build/subprocess-posix.o
  Traceback (most recent call last):
    File "/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/Ninja-src/configure.py", line 534, in <module>
      objs += cxx(name)
    File "/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/Ninja-src/configure.py", line 287, in cxx
      return n.build(built(name + objext), 'cxx', src(name + '.cc'), **kwargs)
    File "/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/Ninja-src/configure.py", line 169, in build
      self._run_command(self._expand(cmd, local_vars))
    File "/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/Ninja-src/configure.py", line 194, in _run_command
      subprocess.check_call(cmdline, shell=True)
    File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command 'c++ -MMD -MT build/subprocess-posix.o -MF build/subprocess-posix.o.d -g -Wall -Wextra -Wno-deprecated -Wno-missing-field-initializers -Wno-unused-parameter -fno-rtti -fno-exceptions -fvisibility=hidden -pipe '-DNINJA_PYTHON="python3"' -O2 -DNDEBUG -fdiagnostics-color -DUSE_PPOLL -DNINJA_HAVE_BROWSE -I. -D_BSD_SOURCE -c ./src/subprocess-posix.cc -o build/subprocess-posix.o' returned non-zero exit status 1.
  make[2]: *** [CMakeFiles/build_ninja.dir/build.make:73: ../../../Ninja-src/ninja] Error 1
  make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/build_ninja.dir/all] Error 2
  make: *** [Makefile:136: all] Error 2
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-qupnhv8q/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 595, in setup
      cmkr.make(make_args, env=env)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-qupnhv8q/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 609, in make
      raise SKBuildError(


  --------------------------------------------------------------------------------
  -- Trying "Ninja" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja" generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying "Unix Makefiles" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Unix Makefiles" generator - success
  --------------------------------------------------------------------------------

  Configuring Project
    Working directory:
      /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build
    Command:
      cmake /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947 -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPYTHON_VERSION_STRING:STRING=3.10.2 -DPYTHON_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPYTHON_LIBRARY:FILEPATH=/data/data/com.termux/files/usr/lib/libpython3.10.so -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/data/data/com.termux/files/usr/tmp/pip-build-env-qupnhv8q/overlay/lib/python3.10/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release

  Traceback (most recent call last):

  An error occurred while building with CMake.
    Command:
      cmake --build . --target install --config Release --
    Source directory:
      /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947
    Working directory:
      /data/data/com.termux/files/usr/tmp/pip-install-ykejw6js/ninja_e5f33e0e0d0d4d87b2921b3f3e8cf947/_skbuild/linux-aarch64-3.10/cmake-build
  Please see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja which use PEP 517 and cannot be installed directly

What steps will reproduce the bug?

pip install ninja

What is the expected behavior?

Ninja should be installed

System information

termux-info:

Application version:
0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main/ stable main
Updatable packages:
All packages up to date
Android version:
7.1.2
Kernel build information:
Linux localhost 3.18.31-perf-gf2fd6b0 #1 SMP PREEMPT Wed Jun 5 18:40:35 WIB 2019 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
Redmi 4A

@bidyut1153 bidyut1153 added the bug report Something is not working properly. label Feb 7, 2022
@bidyut1153 bidyut1153 reopened this Feb 7, 2022
@Grimler91
Copy link
Member

Grimler91 commented Feb 7, 2022

Looks like you need to pkg install ninja first before python bindings can be installed

./src/subprocess-posix.cc:26:10: fatal error: 'spawn.h' file not found

And also install libandroid-spawn.

@xtkoba xtkoba added the python Issue is about python-related stuff, including pip. label Feb 8, 2022
@Grimler91
Copy link
Member

Closing since we haven't heard anything from OP

@bidyut1153
Copy link
Author

Nope, same error

FAILED: ../../../Ninja-src/ninja /data/data/com.termux/files/usr/tmp/pip-install-c1fjlrjz/ninja_581cc53e4c4c4357811f08e646462245/Ninja-src/ninja
  cd /data/data/com.termux/files/usr/tmp/pip-install-c1fjlrjz/ninja_581cc53e4c4c4357811f08e646462245/Ninja-src && /data/data/com.termux/files/usr/bin/cmake -E env CXXFLAGS=-D_BSD_SOURCE /data/data/com.termux/files/usr/bin/python3 configure.py --bootstrap
  ld.lld: error: undefined symbol: posix_spawn_file_actions_init
  >>> referenced by subprocess-posix.cc:66 (./src/subprocess-posix.cc:66)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawn_file_actions_addclose
  >>> referenced by subprocess-posix.cc:70 (./src/subprocess-posix.cc:70)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a
  >>> referenced by subprocess-posix.cc:107 (./src/subprocess-posix.cc:107)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawnattr_init
  >>> referenced by subprocess-posix.cc:75 (./src/subprocess-posix.cc:75)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawnattr_setsigmask
  >>> referenced by subprocess-posix.cc:82 (./src/subprocess-posix.cc:82)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawn_file_actions_addopen
  >>> referenced by subprocess-posix.cc:95 (./src/subprocess-posix.cc:95)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawn_file_actions_adddup2
  >>> referenced by subprocess-posix.cc:101 (./src/subprocess-posix.cc:101)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a
  >>> referenced by subprocess-posix.cc:104 (./src/subprocess-posix.cc:104)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawnattr_setflags
  >>> referenced by subprocess-posix.cc:117 (./src/subprocess-posix.cc:117)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawn
  >>> referenced by subprocess-posix.cc:122 (./src/subprocess-posix.cc:122)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawnattr_destroy
  >>> referenced by subprocess-posix.cc:127 (./src/subprocess-posix.cc:127)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a

  ld.lld: error: undefined symbol: posix_spawn_file_actions_destroy
  >>> referenced by subprocess-posix.cc:130 (./src/subprocess-posix.cc:130)
  >>>               subprocess-posix.o:(Subprocess::Start(SubprocessSet*, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&)) in archive build/libninja.a
  clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

@Grimler91
Copy link
Member

Nope, same error

Error looks completely different to me. Try adding -landroid-spawn to LDFLAGS, with something like export LDFLAGS+=" -landroid-spawn".

@RSwarnkar
Copy link

RSwarnkar commented Aug 6, 2022

Hi @Grimler91 thanks for suggestions about the landroid-spawn , but throws a new kind of error : I tried installing pkg install re2c still the same error.

warning: A compatible version of re2c (>= 0.11.3) was not found; changes to src/*.in.cc will not affect your build.

Any suggestions for this
Detailed log:

~ $ export LDFLAGS+=" -landroid-spawn"
~ $ pip install ninja
Collecting ninja                                          Using cached ninja-1.10.2.3.tar.gz (26 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done            Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ninja             Building wheel for ninja (pyproject.toml) ... error
  error: subprocess-exited-with-error                   
  × Building wheel for ninja (pyproject.toml) did not run successfully.                                           │ exit code: 1
  ╰─> [145 lines of output]
      Not searching for unused variables given on the command line.
      -- The C compiler identification is Clang 14.0.6        -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done                  -- The CXX compiler identification is Clang 14.0.6
      -- Detecting CXX compiler ABI info                      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
      -- Detecting CXX compile features                       -- Detecting CXX compile features - done
      -- Configuring done                                     -- Generating done
      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_cmake_test_compile/build          -- The C compiler identification is Clang 14.0.6
      -- The CXX compiler identification is Clang 14.0.6
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info                      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped                            -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- *********************************************        -- Ninja Python Distribution
      --
      --   BUILD_VERBOSE             : OFF
      --
      --   ARCHIVE_DOWNLOAD_DIR      : /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build
      --
      --     src_archive             : unix_source            --     <src_archive>_url       : https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz
      --     <src_archive>_sha256    : 549c31ee596566b952c600e23eb9b8d39a4112cd5fdeb2e5a83370669176da40
      -- *********************************************
      -- download_ninja_source - URL: https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz
      -- Found PythonInterp: /data/data/com.termux/files/usr/bin/python3 (found version "3.10.5")
      -- Configuring done
      -- Generating done
      CMake Warning:
        Manually-specified variables were not used by the project:

          PYTHON_INCLUDE_DIR
          PYTHON_LIBRARY
          Python3_EXECUTABLE
          Python3_INCLUDE_DIR
          Python3_LIBRARY
          Python_EXECUTABLE
          Python_INCLUDE_DIR
          Python_LIBRARY
          SKBUILD                                       

      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build
      [1/10] Creating directories for 'download_ninja_source'
      [1/10] Performing download step (download, verify and extract) for 'download_ninja_source'
      -- Downloading...
         dst='/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
         timeout='none'                                          inactivity timeout='none'
      -- Using src='https://github.com/Kitware/ninja/archive/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'
      -- verifying file...                                           file='/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'                                 -- Downloading... done
      -- extracting...                                             src='/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build/v1.10.2.g51db2.kitware.jobserver-1.tar.gz'                                         dst='/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src'                                                    -- extracting... [tar xfz]
      -- extracting... [analysis]                             -- extracting... [rename]
      -- extracting... [clean up]                             -- extracting... done
      [3/10] No update step for 'download_ninja_source'       [4/10] No patch step for 'download_ninja_source'
      [5/10] No configure step for 'download_ninja_source'
      [6/10] No build step for 'download_ninja_source'        [7/10] No install step for 'download_ninja_source'
      [8/10] Completed 'download_ninja_source'                [9/10] Generating ../../../Ninja-src/ninja
      FAILED: ../../../Ninja-src/ninja /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src/ninja                        cd /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src && /data/data/com.termux/files/usr/bin/cmake -E env CXXFLAGS=-D_BSD_SOURCE /data/data/com.termux/files/usr/bin/python3 configure.py --bootstrap
      /data/data/com.termux/files/usr/bin/sh: 1: ar: not found                                                        bootstrapping ninja...
      warning: A compatible version of re2c (>= 0.11.3) was not found; changes to src/*.in.cc will not affect your build.                                                     when running:  rm -f build/libninja.a && ar crs build/libninja.a build/browse.o build/build.o build/build_log.o build/clean.o build/clparser.o build/debug_flags.o build/depfile_parser.o build/deps_log.o build/disk_interface.o build/dyndep.o build/dyndep_parser.o build/edit_distance.o build/eval_env.o build/graph.o build/graphviz.o build/lexer.o build/line_printer.o build/manifest_parser.o build/metrics.o build/parser.o build/state.o build/string_piece_util.o build/tokenpool-gnu-make.o build/util.o build/version.o build/subprocess-posix.o build/tokenpool-gnu-make-posix.o
      Traceback (most recent call last):                        File "/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src/configure.py", line 540, in <module>
          ninja_lib = n.build(built('libninja.a'), 'ar', objs)
        File "/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src/configure.py", line 169, in build                         self._run_command(self._expand(cmd, local_vars))                                                              File "/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src/configure.py", line 194, in _run_command
          subprocess.check_call(cmdline, shell=True)            File "/data/data/com.termux/files/usr/lib/python3.10/subprocess.py", line 369, in check_call                      raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command 'rm -f build/libninja.a && ar crs build/libninja.a build/browse.o build/build.o build/build_log.o build/clean.o build/clparser.o build/debug_flags.o build/depfile_parser.o build/deps_log.o build/disk_interface.o build/dyndep.o build/dyndep_parser.o build/edit_distance.o build/eval_env.o build/graph.o build/graphviz.o build/lexer.o build/line_printer.o build/manifest_parser.o build/metrics.o build/parser.o build/state.o build/string_piece_util.o build/tokenpool-gnu-make.o build/util.o build/version.o build/subprocess-posix.o build/tokenpool-gnu-make-posix.o' returned non-zero exit status 127.
      ninja: build stopped: subcommand failed.                  File "/data/data/com.termux/files/usr/tmp/pip-build-env-_4ij7wc9/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 645, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-_4ij7wc9/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 680, in make                               self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-_4ij7wc9/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 704, in make_impl                          raise SKBuildError(
                                                        
      --------------------------------------------------------------------------------
      -- Trying "Ninja" generator                             --------------------------------
      ---------------------------                             ----------------------
      -----------------                                       ------------
      -------                                                 --
      --                                                      -------
      ------------                                            -----------------
      ----------------------                                  ---------------------------
      --------------------------------                        -- Trying "Ninja" generator - success
      --------------------------------------------------------------------------------
                                                              Configuring Project
        Working directory:                                        /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build
        Command:                                                  cmake /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799 -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-install -DPYTHON_VERSION_STRING:STRING=3.10.5 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/data/data/com.termux/files/usr/tmp/pip-build-env-_4ij7wc9/overlay/lib/python3.10/site-packages/skbuild/resources/cmake -DPython3_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPython3_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPython3_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/[libpython3.10.so](http://libpython3.10.so/) -DPython_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPython_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPython_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/[libpython3.10.so](http://libpython3.10.so/) -DPYTHON_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPYTHON_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.10 -DPYTHON_LIBRARY:PATH=/data/data/com.termux/files/usr/lib/[libpython3.10.so](http://libpython3.10.so/) -DCMAKE_BUILD_TYPE:STRING=Release

      Traceback (most recent call last):

      An error occurred while building with CMake.
        Command:
          cmake --build . --target install --config Release --
        Install target:
          install
        Source directory:
          /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799
        Working directory:
          /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/_skbuild/linux-aarch64-3.10/cmake-build
      Please check the install target is valid and see CMake's output for more information.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects
~ $

@Grimler91
Copy link
Member

cd /data/data/com.termux/files/usr/tmp/pip-install-y2u06bfp/ninja_642c64773ce340b0b178227c76db4799/Ninja-src && /data/data/com.termux/files/usr/bin/cmake -E env CXXFLAGS=-D_BSD_SOURCE /data/data/com.termux/files/usr/bin/python3 configure.py --bootstrap1
     /data/data/com.termux/files/usr/bin/sh: 1: ar: not found

Install binutils

@RSwarnkar
Copy link

@Grimler91 WHOA !! You are awesome man ! Works like charm.

So here is all what I did (reference for anonymous):

  1. Install build essentials: pkg install clang or/and pkg install build-essential
  2. pkg install ninja
  3. install libandroid-spawn
  4. export LDFLAGS+=" -landroid-spawn"
  5. pkg install binutils
  6. Finally try: pip install ninja

Cheers !

@egeres
Copy link

egeres commented Dec 6, 2022

I tried @RSwarnkar solution, but I'm getting the following error:

FAILED: build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite /data/data/com.termux/files/usr/tmp/pip-install-a8yhe94i/ninja_fd6f36edcc914144ba91f15859bd6193/_skbuild/linux-aarch64-3.11/cmake-build/build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite
      cd /data/data/com.termux/files/usr/tmp/pip-install-a8yhe94i/ninja_fd6f36edcc914144ba91f15859bd6193/_skbuild/linux-aarch64-3.11/cmake-build/Ninja-build && /data/data/com.termux/files/usr/tmp/pip-install-a8yhe94i/ninja_fd6f36edcc914144ba91f15859bd6193/_skbuild/linux-aarch64-3.11/cmake-build/Ninja-build/ninja_test && /data/data/com.termux/files/usr/bin/cmake -E touch /data/data/com.termux/files/usr/tmp/pip-install-a8yhe94i/ninja_fd6f36edcc914144ba91f15859bd6193/_skbuild/linux-aarch64-3.11/cmake-build/build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite
      ninja: build stopped: subcommand failed.
      Traceback (most recent call last):
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-9ypdjqfq/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 640, in setup
          cmkr.make(make_args, install_target=cmake_install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-9ypdjqfq/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 672, in make
          self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
        File "/data/data/com.termux/files/usr/tmp/pip-build-env-9ypdjqfq/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 703, in make_impl
          raise SKBuildError(

      An error occurred while building with CMake.

@treapster
Copy link

I'm having the same error as @egeres despite installing binutils and libandroid-spawn and adding it to LDFLAGS. And the output doesn't clearly say what the problem is, just that command failed. It looks like ElideMiddle.ElideInTheMiddle test fails but i'm not sure.

[402/402] ElideMiddle.ElideInTheMiddle                                                                                                                      
  failed                                                                                                                                                    
  FAILED: build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb779
7bc41e38e582f704737706c/_skbuild/linux-aarch64-3.11/cmake-build/build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite                   
  cd /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c/_skbuild/linux-aarch64-3.11/cmake-build/Ninja-build && 
/data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c/_skbuild/linux-aarch64-3.11/cmake-build/Ninja-build/ninja_te
st && /data/data/com.termux/files/usr/bin/cmake -E touch /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c/_sk
build/linux-aarch64-3.11/cmake-build/build_ninja-prefix/src/build_ninja-stamp/build_ninja-run_ninja_test_suite                                              
  ninja: build stopped: subcommand failed.                                                                                                                  
  Traceback (most recent call last):                                                                                                                        
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-kagt7b3x/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 640, in setup   
      cmkr.make(make_args, install_target=cmake_install_target, env=env)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-kagt7b3x/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 684, in make
      self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
    File "/data/data/com.termux/files/usr/tmp/pip-build-env-kagt7b3x/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 715, in make_impl
      raise SKBuildError(

  An error occurred while building with CMake.
    Command:
      cmake --build . --target install --config Release --
    Install target:
      install
    Source directory:
      /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c
    Working directory:
      /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c/_skbuild/linux-aarch64-3.11/cmake-build
  Please check the install target is valid and see CMake's output for more information.
  Please check the install target is valid and see CMake's output for more information.
  error: subprocess-exited-with-error

  × Building wheel for ninja (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  full command: /data/data/com.termux/files/usr/bin/python3 /data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /data/data/com.termux/files/usr/tmp/tmp39qlqe2p
  cwd: /data/data/com.termux/files/usr/tmp/pip-install-mu6m2lng/ninja_627eeb7797bc41e38e582f704737706c
  Building wheel for ninja (pyproject.toml) ... error
  ERROR: Failed building wheel for ninja
Failed to build ninja
ERROR: Could not build wheels for ninja, which is required to install pyproject.toml-based projects

@treapster
Copy link

treapster commented Dec 24, 2022

After a closer inspection of a log i found more test failures, probably libandroid-spawn doesn't do something these tests expect?

  [377/402] SubprocessTest.Console
  [378/402] SubprocessTest.SetWithSingle 
  *** Failure in /data/data/com.termux/files/usr/tmp/pip-install-iq6a86gf/ninja_68e7bd5857444e19b2c6c4ef6b6662f0/Ninja-src/src/subprocess_test.cc:210
  ExitSuccess == subproc->Finish()
  [379/402] SubprocessTest.SetWithMulti   
  *** Failure in /data/data/com.termux/files/usr/tmp/pip-install-iq6a86gf/ninja_68e7bd5857444e19b2c6c4ef6b6662f0/Ninja-src/src/subprocess_test.cc:251
  ExitSuccess == processes[i]->Finish()
  [380/402] SubprocessTest.ReadStdin
  [381/402] SubprocessTest.TokenAvailable
  *** Failure in /data/data/com.termux/files/usr/tmp/pip-install-iq6a86gf/ninja_68e7bd5857444e19b2c6c4ef6b6662f0/Ninja-src/src/subprocess_test.cc:350
  ExitSuccess == subproc->Finish()
  [382/402] SubprocessTest.TokenNotAvailable
  *** Failure in /data/data/com.termux/files/usr/tmp/pip-install-iq6a86gf/ninja_68e7bd5857444e19b2c6c4ef6b6662f0/Ninja-src/src/subprocess_test.cc:380
  ExitSuccess == subproc->Finish()
  [383/402] TokenPoolTest.NoTokenPool
  [384/402] TokenPoolTest.SuccessfulOldSetup

@treapster
Copy link

Interestingly, it reproduces with this same log on both android 7 and android 9

@treapster
Copy link

For now i managed to work around this by cloning https://github.com/scikit-build/ninja-python-distributions, checking out the latest version and setting RUN_NINJA_TEST to OFF in CmakeLists.txt. Then simply pip install .. But it doesn't look like a safe thing to do and i'm not sure it will work properly. It also doesn't help if ninja is a dependency of some other package, because when installing build dependencies pip alsways uses --ignore-installed and seems to ignore export PIP_IGNORE_INSTALLED=0, thus trying to build ninja and failing.

@alexpira
Copy link

alexpira commented Apr 1, 2023

I don't know if this can be useful for anybody, but problem is subprocess_test.cc (line 35) which runs "ls /" as test command and on android that fails with "permission denied". Changing it for example to "ls /sdcard/" works.
This means that patching or skipping tests should be safe.

@aseok
Copy link

aseok commented Jun 17, 2023

@alexpira is root permission the only workaround? Termux-setup-storage doesn't work.

@sylirre
Copy link
Member

sylirre commented Jun 17, 2023

@aseok termux-chroot may help to workaround ls / permission issue. Editing the source code is another variant, if you are familiar with that.

Root is not needed.

@xhy2008
Copy link

xhy2008 commented Jan 23, 2024

Screenshot_2024-01-23-18-10-37-261_com.termux.jpg

I don't know why I am getting this....

@sylirre
Copy link
Member

sylirre commented Jan 23, 2024

@xhy2008 Just don't install ninja this way.

It is enough to do pkg install ninja. I remind that Termux patches most of its packages (I mean those which are available in our repo by pkg / apt) in order to compile them without issues and ninja is not exception.

Now if you need to install some Python module requiring ninja, you need to pass flag --no-build-isolation to the pip. This will prevent pip from installing build tools already present in the system.

@sylirre sylirre removed the bug report Something is not working properly. label Jan 23, 2024
@xhy2008
Copy link

xhy2008 commented Feb 3, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Issue is about python-related stuff, including pip.
Projects
None yet
Development

No branches or pull requests

10 participants