[Bug]: igraph cant be installed with pip
Problem description
If you download termux from fdroid, install pip, python-cmake, cmake etc and then run pip install igraph it fails due to -lgcc not being available to the linker. Maybe a gcc package should be added to Termux? Here is the full logs.
Collecting igraph Using cached igraph-1.0.0.tar.gz (5.1 MB) Installing build dependencies: started Installing build dependencies: finished with status 'error' error: subprocess-exited-with-error
× installing build dependencies for igraph did not run successfully. │ exit code: 1 ╰─> [236 lines of output] Ignoring setuptools: markers 'platform_python_implementation == "PyPy"' don't match your environment Collecting setuptools>=64 Using cached setuptools-80.9.0-py3-none-any.whl.metadata (6.6 kB) Collecting cmake>=3.18 Using cached cmake-4.2.0.tar.gz (37 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Using cached setuptools-80.9.0-py3-none-any.whl (1.2 MB) Building wheels for collected packages: cmake Building wheel for cmake (pyproject.toml): started Building wheel for cmake (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error
× Building wheel for cmake (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [207 lines of output]
*** scikit-build-core 0.11.6 using CMake 4.2.0 (wheel)
*** Configuring CMake...
loading initial cache file build/py3-none-linux_aarch64/CMakeInit.txt
-- The CXX compiler identification is Clang 21.1.6
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- ***************************************************
-- Build CMake from source: ON
-- ***************************************************
-- SuperBuild - CMakeProject-src-download
-- SuperBuild - CMakeProject-src-download - URL: https://github.com/Kitware/CMake/releases/download/v4.2.0/cmake-4.2.0.tar.gz
-- SuperBuild - CMakeProject-src-download - CMakeProject_SOURCE_DIR: /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/CMake-src
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Looking for __GLIBC_MINOR__
-- Looking for __GLIBC_MINOR__ - not found
-- Looking for C++ include sys/types.h
-- Looking for C++ include sys/types.h - found
-- Looking for C++ include stdint.h
-- Looking for C++ include stdint.h - found
-- Looking for C++ include stddef.h
-- Looking for C++ include stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- SuperBuild - CMakeProject-build
-- SuperBuild - CMakeProject-build - CMakeProject_BINARY_DIR: /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build
-- SuperBuild - CMakePythonDistributions
-- Configuring done (1.4s)
-- Generating done (0.0s)
-- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64
*** Building project with Ninja...
[1/25] Creating directories for 'CMakeProject-src-download'
[1/25] Performing download step (download, verify and extract) for 'CMakeProject-src-download'
-- Downloading...
dst='/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/cmake-4.2.0.tar.gz'
timeout='none'
inactivity timeout='none'
-- Using src='https://github.com/Kitware/CMake/releases/download/v4.2.0/cmake-4.2.0.tar.gz'
-- [download 0% complete]
-- [download 1% complete]
-- [download 2% complete]
-- [download 3% complete]
-- [download 4% complete]
-- [download 5% complete]
-- [download 6% complete]
-- [download 7% complete]
-- [download 8% complete]
-- [download 9% complete]
-- [download 10% complete]
-- [download 11% complete]
-- [download 12% complete]
-- [download 13% complete]
-- [download 14% complete]
-- [download 15% complete]
-- [download 16% complete]
-- [download 17% complete]
-- [download 18% complete]
-- [download 19% complete]
-- [download 20% complete]
-- [download 21% complete]
-- [download 22% complete]
-- [download 23% complete]
-- [download 24% complete]
-- [download 25% complete]
-- [download 26% complete]
-- [download 27% complete]
-- [download 28% complete]
-- [download 29% complete]
-- [download 30% complete]
-- [download 31% complete]
-- [download 32% complete]
-- [download 33% complete]
-- [download 34% complete]
-- [download 35% complete]
-- [download 36% complete]
-- [download 37% complete]
-- [download 38% complete]
-- [download 39% complete]
-- [download 40% complete]
-- [download 41% complete]
-- [download 42% complete]
-- [download 43% complete]
-- [download 44% complete]
-- [download 45% complete]
-- [download 46% complete]
-- [download 47% complete]
-- [download 48% complete]
-- [download 49% complete]
-- [download 50% complete]
-- [download 51% complete]
-- [download 52% complete]
-- [download 53% complete]
-- [download 54% complete]
-- [download 55% complete]
-- [download 56% complete]
-- [download 57% complete]
-- [download 58% complete]
-- [download 59% complete]
-- [download 60% complete]
-- [download 61% complete]
-- [download 62% complete]
-- [download 63% complete]
-- [download 64% complete]
-- [download 65% complete]
-- [download 66% complete]
-- [download 67% complete]
-- [download 68% complete]
-- [download 69% complete]
-- [download 70% complete]
-- [download 71% complete]
-- [download 72% complete]
-- [download 73% complete]
-- [download 74% complete]
-- [download 75% complete]
-- [download 76% complete]
-- [download 77% complete]
-- [download 78% complete]
-- [download 79% complete]
-- [download 80% complete]
-- [download 81% complete]
-- [download 82% complete]
-- [download 83% complete]
-- [download 84% complete]
-- [download 85% complete]
-- [download 86% complete]
-- [download 87% complete]
-- [download 88% complete]
-- [download 89% complete]
-- [download 90% complete]
-- [download 91% complete]
-- [download 92% complete]
-- [download 93% complete]
-- [download 94% complete]
-- [download 95% complete]
-- [download 96% complete]
-- [download 97% complete]
-- [download 98% complete]
-- [download 99% complete]
-- [download 100% complete]
-- verifying file...
file='/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/cmake-4.2.0.tar.gz'
-- Downloading... done
-- extracting...
src='/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/cmake-4.2.0.tar.gz'
dst='/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/CMake-src'
-- extracting... [tar xf]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[3/25] No update step for 'CMakeProject-src-download'
[4/25] No patch step for 'CMakeProject-src-download'
[5/25] No configure step for 'CMakeProject-src-download'
[6/25] No build step for 'CMakeProject-src-download'
[7/25] No install step for 'CMakeProject-src-download'
[8/25] Completed 'CMakeProject-src-download'
[9/25] Creating directories for 'CMakeProject-build'
[10/25] No download step for 'CMakeProject-build'
[11/25] No update step for 'CMakeProject-build'
[12/25] No patch step for 'CMakeProject-build'
[12/25] Performing configure step for 'CMakeProject-build'
loading initial cache file /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/initial-cache.txt
loading initial cache file /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build-prefix/tmp/CMakeProject-build-cache-Release.cmake
-- The C compiler identification is Clang 21.1.6
-- The CXX compiler identification is Clang 21.1.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang - broken
CMake Error at /data/data/com.termux/files/usr/share/cmake-4.2/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: '/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build/CMakeFiles/CMakeScratch/TryCompile-m73xcb'
Run Build Command(s): /data/data/com.termux/files/usr/bin/ninja -v cmTC_a8449
[1/2] /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 -O2 -g -DNDEBUG -MD -MT CMakeFiles/cmTC_a8449.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_a8449.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_a8449.dir/testCCompiler.c.o -c /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build/CMakeFiles/CMakeScratch/TryCompile-m73xcb/testCCompiler.c
[2/2] : && /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 -O2 -g -DNDEBUG -lstdc++ -lgcc -lrt CMakeFiles/cmTC_a8449.dir/testCCompiler.c.o -o cmTC_a8449 && :
FAILED: [code=1] cmTC_a8449
: && /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 -O2 -g -DNDEBUG -lstdc++ -lgcc -lrt CMakeFiles/cmTC_a8449.dir/testCCompiler.c.o -o cmTC_a8449 && :
ld.lld: error: unable to find library -lgcc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:8 (project)
-- Configuring incomplete, errors occurred!
FAILED: [code=1] CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure
cd /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build && /data/data/com.termux/files/usr/bin/cmake -C /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/initial-cache.txt -GNinja -C/data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build-prefix/tmp/CMakeProject-build-cache-Release.cmake -S /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/CMake-src -B /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build && /data/data/com.termux/files/usr/bin/cmake -E touch /data/data/com.termux/files/usr/tmp/pip-install-1hky4mdb/cmake_4f2ad222c3c149bea53388b0703322dc/build/py3-none-linux_aarch64/CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure
ninja: build stopped: subcommand failed.
*** CMake build failed
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cmake
Failed to build cmake
error: failed-wheel-build-for-install
× Failed to build installable wheels for some pyproject.toml based projects
╰─> cmake
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed to build 'igraph' when installing build dependencies for igraph
What steps will reproduce the bug?
pip install igraph But you have to have pip, python-cmake and cmake installed
What is the expected behavior?
No response
System information
Termux(fdroid version)
Try this
pip install --no-build-isolation --no-cache-dir igraph
and try again. that works for me
ld.lld: error: unable to find library -lgcc
There is a way to work around that error temporarily if it ever happens for you for something else, for some reason it's this:
echo 'INPUT(-lc)' > $PREFIX/lib/libgcc.so
however in this case, the above other commands worked instead, so that wasn't necessary for me. I don't know if that workaround is a good way or not for packaging in ndk-sysroot.
If you download termux from fdroid, install pip, python-cmake, cmake etc and then run pip install igraph it fails due to -lgcc not being available to the linker. Maybe a gcc package should be added to Termux?
You shouldn't need GCC specifically, Clang/LLVM should work just as well.
And clang++ is getting correctly picked up.
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/aarch64-linux-android-clang++ - skipped
There is also a gcc package available from the TUR.
But you shouldn't need it for this.
Robert's suggestion might work though
To be specific with the explanation, this error occurs with some Python packages with no arguments to pip, because something attempts to build a CMake as a build dependency of other things, and this command avoids that for me and results in successful installation of igraph
pip install --no-build-isolation --no-cache-dir igraph
Robert's solution worked after first running pip install setuptools. You are right that GCC shoun't be needed with clang present but it looks like the linker specifically tried to link against gcc with -lgcc.
it looks like the linker specifically tried to link against gcc with -lgcc.
well, that error you see is a difference I am aware of between the cross-compiler and the non-cross-compiler because the cross-compiler does contain a 64-bit ARM Android Clang version of a libgcc.a without actually being GCC so during cross-compilation of any packages of software that uses that linker argument, nothing goes wrong, but for some reason the non-cross-compiler doesn't have any libgcc.a or libgcc.so, so if it happens to you in the future again and is annoying then you can try the other workaround I showed which worked for me for something else
I forgot, the cross-compiler's libgcc.a is actually this so it's an INPUT(-lunwind) not an INPUT(-lc),
builder@dc7513f1f83a:~/termux-packages$ cat /home/builder/.termux-build/_cache/android-r28c-api-24-v2/sysroot/usr/lib/aarch64-linux-android/libgcc.a
INPUT(-lunwind)
builder@dc7513f1f83a:~/termux-packages$
but to be honest I never really knew why it's not provided in ndk-sysroot in this area, and I thought there might be some reason why it's not, so I just didn't mess with it
https://github.com/termux/termux-packages/blob/662292a5570c481c358528cafe2a70410fba256a/packages/ndk-sysroot/build.sh#L98-L102