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

/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory #7153

Closed
liukangcc opened this issue Jul 17, 2021 · 12 comments

Comments

@liukangcc
Copy link

liukangcc commented Jul 17, 2021

Not found crypt.h: No such file or directory

~/python $ gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

~/python $ nuitka3 --module hello.py --output-dir=out
Nuitka-Options:INFO: Used command line options: --module hello.py --output-dir=out
Nuitka:INFO: Starting Python compilation with Nuitka '0.6.16.2' on Python '3.9' commercial None.
Nuitka:INFO: Completed Python level compilation and optimization.
Nuitka:INFO: Generating source code for C backend compiler.
Nuitka:INFO: Running data composer tool for optimal constant value handling.
Nuitka:INFO: Running C level backend compilation via Scons.
Nuitka-Scons:INFO: Backend C compiler: gcc (gcc).
Backend C:   0%|                                                                           | 0/11In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from __constants.c:2:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
Backend C:  18%|█████████████▋                                                             | 2/11In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from __helpers.c:4:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
In file included from __loader.c:4:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from module.hello.c:19:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
Backend C:  36%|███████████████████████████▎                                               | 4/11scons: *** [__constants.os] Error 1
scons: *** [__helpers.os] Error 1
scons: *** [__loader.os] Error 1
scons: *** [module.hello.os] Error 1
In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from static_src/CompiledCellType.c:19:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
scons: *** [static_src/CompiledCellType.os] Error 1
In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from static_src/CompiledFunctionType.c:19:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
scons: *** [static_src/CompiledFunctionType.os] Error 1
In file included from /data/data/com.termux/files/usr/lib/python3.9/site-packages/nuitka/build/include/nuitka/prelude.h:47,
                 from static_src/CompiledGeneratorType.c:28:
/data/data/com.termux/files/usr/include/python3.9/Python.h:44:10: fatal error: crypt.h: No such file or directory
   44 | #include <crypt.h>
      |          ^~~~~~~~~
compilation terminated.
Backend C:  73%|██████████████████████████████████████████████████████▌                    | 8/11scons: *** [static_src/CompiledGeneratorType.os] Error 1
~/python $ pkg install python-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python

E: Package 'python-dev' has no installation candidate
~/python $ pkg install libcrypt-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libcrypt-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  libcrypt

E: Package 'libcrypt-dev' has no installation candidate
~/python $
@ghost
Copy link

ghost commented Jul 17, 2021

pkg install libcrypt

Also there no dev packages. Termux no longer does splitting. So libcrypt-dev == libcrypt, same with other packages.

@ghost ghost closed this as completed Jul 17, 2021
@liukangcc
Copy link
Author

pkg install libcrypt

Also there no dev packages. Termux no longer does splitting. So libcrypt-dev == libcrypt, same with other packages.

My question is : error: crypt.h: No such file or directory

@suhan-paradkar
Copy link
Contributor

suhan-paradkar commented Jul 17, 2021

My question is : error: crypt.h: No such file or directory

Yea.. that can be solved by pkg install libcrypt

@liukangcc
Copy link
Author

liukangcc commented Jul 17, 2021

My question is : error: crypt.h: No such file or directory

Yea.. that can be solved by pkg install libcrypt

I have already installed libcrypt


$ pkg install libcrypt
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libcrypt is already the newest version (0.2-3).
The following package was automatically installed and is no longer required:
  zstd
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

$ apt list
libcroco-static/stable,stable 0.6.13-5 aarch64
libcroco/stable,stable 0.6.13-5 aarch64
libcrypt/stable,stable,now 0.2-3 aarch64 [installed]
libcue/stable,stable 2.2.1-1 aarch64
libcunit-static/stable,stable 2.1.3 aarch64
libcunit/stable,stable 2.1.3 aarch64
libcurl-static/stable,stable 7.77.0-3 aarch64
libcurl/stable,stable,now 7.77.0-3 aarch64 [installed]
libczmq-static/stable,stable 4.2.1 aarch64
libczmq/stable,stable 4.2.1 aarch64
libdav1d/stable,stable 0.9.0 aarch64

@suhan-paradkar
Copy link
Contributor

suhan-paradkar commented Jul 17, 2021

You may need to manually specify CPPFLAGS..
Pointing to $PREFIX/include

@ghost
Copy link

ghost commented Jul 17, 2021

Yes, crypt.h is in $PREFIX/include.

You may also try termux-chroot, if your build tool tries to use locations like /usr/include which do not exist in Termux because it is not FHS-compliant.

@liukangcc
Copy link
Author

Yes, crypt.h is in $PREFIX/include.

You may also try termux-chroot, if your build tool tries to use locations like /usr/include which do not exist in Termux because it is not FHS-compliant.

Amazing, It's work! Thanks for your help!

@liukangcc
Copy link
Author

Yes, crypt.h is in $PREFIX/include.
You may also try termux-chroot, if your build tool tries to use locations like /usr/include which do not exist in Termux because it is not FHS-compliant.

Amazing, It's work! Thanks for your help!

Other problems arose:

image

@suhan-paradkar
Copy link
Contributor

Maybe disabling nls may help

@ghost
Copy link

ghost commented Jul 17, 2021

@suhan-paradkar There issues with threading, not with NLS. Termux (Android) has limited support for pthreads. Many stuff is missing.

gcc isn't supported by Termux officially, this could also lead to problems. clang should be used instead. The right use of gcc is only for GNU extensions of C language, which are not parts of the standard C. Though nowadays only rare software relies on GNU extensions.

@liukangcc
Copy link
Author

There issues with threading, not with NLS. Termux (Android) has limited support for pthreads. Many stuff is missing.

gcc isn't supported by Termux officially, this could also lead to problems. clang should be used instead. The right use of gcc is only for GNU extensions of C language, which are not parts of the standard C. Though nowadays only rare software relies on GNU extensions.

Does Termux's Python support packaging as a dynamic library? Then use my C code to call the Python generated .so file?

I have tested some Python packaging tools and found that the resulting.so file cannot be called. such as: Nuitka.

I asked the author of Nuitka, and this is his response: Nuitka/Nuitka#1163.

What's different about the Python environment on the Termux?

@ghost
Copy link

ghost commented Jul 22, 2021

Yes, our Python supports dynamic libraries.

Your issue is most likely android/ndk#201. Binary doesn't expose symbols to loaded shared libraries. You should link your .so file with libpython to obtain symbols, otherwise it would not work. Android dynamic linker is not same as on normal Linux distributions - that's one of major differences you should know when using Termux.

If you need a traditional behavior, then use proot'ed or chroot'ed variants of Linux distributions inside Termux either through proot-distro or third-party installers.

This issue was closed.
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

2 participants