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

I cannot install G4F in termux using the command: pip install g4f #1107

Closed
MAX1MDEV opened this issue Oct 20, 2023 · 17 comments
Closed

I cannot install G4F in termux using the command: pip install g4f #1107

MAX1MDEV opened this issue Oct 20, 2023 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@MAX1MDEV
Copy link

I'm trying to install g4f, but instead of installing I get this error:
DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/g4f-0.1.6.8-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/duckduckgo_search-3.9.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/PyExecJS-1.5.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/typing_extensions-4.8.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/Flask_Cors-4.0.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/flask-3.0.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/Js2Py-0.74-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/websockets-11.0.3-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /data/data/com.termux/files/usr/lib/python3.11/site-packages/browser_cookie3-0.19.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 Requirement already satisfied: g4f in /data/data/com.termux/files/usr/lib/python3.11/site-packages/g4f-0.1.6.8-py3.11.egg (0.1.6.8) Requirement already satisfied: requests in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from g4f) (2.31.0) Collecting pycryptodome (from g4f) Using cached pycryptodome-3.19.0-cp35-abi3-linux_aarch64.whl Collecting curl_cffi (from g4f) Using cached curl_cffi-0.5.9.tar.gz (32 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: aiohttp in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from g4f) (3.8.5) Requirement already satisfied: certifi in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from g4f) (2023.7.22) Requirement already satisfied: browser_cookie3 in /data/data/com.termux/files/usr/lib/python3.11/site-packages/browser_cookie3-0.19.1-py3.11.egg (from g4f) (0.19.1) Requirement already satisfied: websockets in /data/data/com.termux/files/usr/lib/python3.11/site-packages/websockets-11.0.3-py3.11.egg (from g4f) (11.0.3) Requirement already satisfied: js2py in /data/data/com.termux/files/usr/lib/python3.11/site-packages/Js2Py-0.74-py3.11.egg (from g4f) (0.74) Requirement already satisfied: flask in /data/data/com.termux/files/usr/lib/python3.11/site-packages/flask-3.0.0-py3.11.egg (from g4f) (3.0.0) Requirement already satisfied: flask-cors in /data/data/com.termux/files/usr/lib/python3.11/site-packages/Flask_Cors-4.0.0-py3.11.egg (from g4f) (4.0.0) Requirement already satisfied: typing-extensions in /data/data/com.termux/files/usr/lib/python3.11/site-packages/typing_extensions-4.8.0-py3.11.egg (from g4f) (4.8.0) Requirement already satisfied: PyExecJS in /data/data/com.termux/files/usr/lib/python3.11/site-packages/PyExecJS-1.5.1-py3.11.egg (from g4f) (1.5.1) Requirement already satisfied: duckduckgo-search in /data/data/com.termux/files/usr/lib/python3.11/site-packages/duckduckgo_search-3.9.3-py3.11.egg (from g4f) (3.9.3) Requirement already satisfied: attrs>=17.3.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (23.1.0) Requirement already satisfied: charset-normalizer<4.0,>=2.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (3.3.0) Requirement already satisfied: multidict<7.0,>=4.5 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (6.0.4) Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (4.0.3) Requirement already satisfied: yarl<2.0,>=1.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (1.9.2) Requirement already satisfied: frozenlist>=1.1.1 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (1.4.0) Requirement already satisfied: aiosignal>=1.1.2 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from aiohttp->g4f) (1.3.1) Collecting lz4 (from browser_cookie3->g4f) Using cached lz4-4.3.2-cp311-cp311-linux_aarch64.whlCollecting pycryptodomex (from browser_cookie3->g4f) Using cached pycryptodomex-3.19.0-cp35-abi3-linux_aarch64.whl Collecting jeepney (from browser_cookie3->g4f) Using cached jeepney-0.8.0-py3-none-any.whl (48 kB) Requirement already satisfied: cffi>=1.12.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from curl_cffi->g4f) (1.14.6) Collecting aiofiles>=23.2.1 (from duckduckgo-search->g4f) Using cached aiofiles-23.2.1-py3-none-any.whl.metadata (9.7 kB) Collecting click>=8.1.7 (from duckduckgo-search->g4f) Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB) Collecting lxml>=4.9.3 (from duckduckgo-search->g4f) Using cached lxml-4.9.3-cp311-cp311-linux_aarch64.whl Requirement already satisfied: httpx>=0.25.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) (0.25.0) Collecting Werkzeug>=3.0.0 (from flask->g4f) Using cached werkzeug-3.0.0-py3-none-any.whl.metadata (4.1 kB) Collecting Jinja2>=3.1.2 (from flask->g4f) Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting itsdangerous>=2.1.2 (from flask->g4f) Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB) Collecting blinker>=1.6.2 (from flask->g4f) Using cached blinker-1.6.3-py3-none-any.whl.metadata (1.9 kB) Collecting tzlocal>=1.2 (from js2py->g4f) Using cached tzlocal-5.1-py3-none-any.whl.metadata (16 kB) Requirement already satisfied: six>=1.10 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from js2py->g4f) (1.16.0) Collecting pyjsparser>=2.5.1 (from js2py->g4f) Using cached pyjsparser-2.7.1-py3-none-any.whl Requirement already satisfied: idna<4,>=2.5 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from requests->g4f) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from requests->g4f) (2.0.5) Requirement already satisfied: pycparser in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from cffi>=1.12.0->curl_cffi->g4f) (2.21) Requirement already satisfied: httpcore<0.19.0,>=0.18.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from httpx>=0.25.0->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) (0.18.0) Requirement already satisfied: sniffio in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from httpx>=0.25.0->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) (1.3.0) Collecting brotli (from httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) Using cached Brotli-1.1.0-cp311-cp311-linux_aarch64.whl Collecting h2<5,>=3 (from httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) Using cached h2-4.1.0-py3-none-any.whl (57 kB) Collecting socksio==1.* (from httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) Using cached socksio-1.0.0-py3-none-any.whl (12 kB) Collecting MarkupSafe>=2.0 (from Jinja2>=3.1.2->flask->g4f) Using cached MarkupSafe-2.1.3-cp311-cp311-linux_aarch64.whl Collecting hyperframe<7,>=6.0 (from h2<5,>=3->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) Using cached hyperframe-6.0.1-py3-none-any.whl (12 kB) Collecting hpack<5,>=4.0 (from h2<5,>=3->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) Using cached hpack-4.0.0-py3-none-any.whl (32 kB) Requirement already satisfied: anyio<5.0,>=3.0 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from httpcore<0.19.0,>=0.18.0->httpx>=0.25.0->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) (4.0.0) Requirement already satisfied: h11<0.15,>=0.13 in /data/data/com.termux/files/usr/lib/python3.11/site-packages (from httpcore<0.19.0,>=0.18.0->httpx>=0.25.0->httpx[brotli,http2,socks]>=0.25.0->duckduckgo-search->g4f) (0.14.0) Using cached aiofiles-23.2.1-py3-none-any.whl (15 kB) Using cached blinker-1.6.3-py3-none-any.whl (13 kB) Using cached click-8.1.7-py3-none-any.whl (97 kB) Using cached tzlocal-5.1-py3-none-any.whl (21 kB) Using cached werkzeug-3.0.0-py3-none-any.whl (226 kB) Building wheels for collected packages: curl_cffi Building wheel for curl_cffi (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for curl_cffi (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [92 lines of output] running bdist_wheel running build running build_py creating build creating build/lib.linux-aarch64-cpython-311 creating build/lib.linux-aarch64-cpython-311/curl_cffi copying curl_cffi/__init__.py -> build/lib.linux-aarch64-cpython-311/curl_cffi copying curl_cffi/aio.py -> build/lib.linux-aarch64-cpython-311/curl_cffi copying curl_cffi/build.py -> build/lib.linux-aarch64-cpython-311/curl_cffi copying curl_cffi/const.py -> build/lib.linux-aarch64-cpython-311/curl_cffi copying curl_cffi/curl.py -> build/lib.linux-aarch64-cpython-311/curl_cffi creating build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/__init__.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/cookies.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/errors.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/headers.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/models.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests copying curl_cffi/requests/session.py -> build/lib.linux-aarch64-cpython-311/curl_cffi/requests running egg_info writing curl_cffi.egg-info/PKG-INFO writing dependency_links to curl_cffi.egg-info/dependency_links.txt writing requirements to curl_cffi.egg-info/requires.txt writing top-level names to curl_cffi.egg-info/top_level.txt reading manifest file 'curl_cffi.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching 'curl_cffi/cacert.pem' warning: no files found matching 'curl_cffi/_wrapper.*' warning: no files found matching 'curl_cffi/include/curl/*' adding license file 'LICENSE' writing manifest file 'curl_cffi.egg-info/SOURCES.txt' /data/data/com.termux/files/usr/tmp/pip-build-env-e9khg1zz/overlay/lib/python3.11/site-packages/setuptools/command/build_py.py:204: _Warning: Package 'curl_cffi.ffi' is absent from the packagesconfiguration. !! ******************************************************************************** ############################ # Package would be ignored # ############################ Python recognizes 'curl_cffi.ffi' as an importable package[^1], but it is absent from setuptools'packagesconfiguration. This leads to an ambiguous overall configuration. If you want to distribute this package, please make sure that 'curl_cffi.ffi' is explicitly added to thepackagesconfiguration field. Alternatively, you can also rely on setuptools' discovery methods (for example by usingfind_namespace_packages(...)/find_namespace: instead offind_packages(...)/find:). You can read more about "package discovery" on setuptools documentation page: - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html If you don't want 'curl_cffi.ffi' to be distributed and are already explicitly excluding 'curl_cffi.ffi' via find_namespace_packages(...)/find_namespaceorfind_packages(...)/find, you can try to use exclude_package_data, or include-package-data=Falsein combination with a more fine grainedpackage-dataconfiguration. You can read more about "package data files" on setuptools documentation page: - https://setuptools.pypa.io/en/latest/userguide/datafiles.html [^1]: For Python, any directory (with suitable naming) can be imported, even if it does not contain any.py files. On the other hand, currently there is no concept of package data directory, all directories are treated like packages. ******************************************************************************** !! check.warn(importable) creating build/lib.linux-aarch64-cpython-311/curl_cffi/ffi copying curl_cffi/ffi/cdef.c -> build/lib.linux-aarch64-cpython-311/curl_cffi/ffi copying curl_cffi/ffi/shim.c -> build/lib.linux-aarch64-cpython-311/curl_cffi/ffi copying curl_cffi/ffi/shim.h -> build/lib.linux-aarch64-cpython-311/curl_cffi/ffi running build_ext generating cffi module 'build/temp.linux-aarch64-cpython-311/curl_cffi._wrapper.c' creating build/temp.linux-aarch64-cpython-311 building 'curl_cffi._wrapper' extension creating build/temp.linux-aarch64-cpython-311/build creating build/temp.linux-aarch64-cpython-311/build/temp.linux-aarch64-cpython-311 creating build/temp.linux-aarch64-cpython-311/curl_cffi creating build/temp.linux-aarch64-cpython-311/curl_cffi/ffi aarch64-linux-android-clang -DNDEBUG -g -fwrapv -O3 -Wall -fstack-protector-strong -O3 -fstack-protector-strong -O3 -fPIC -Icurl_cffi/include -Icurl_cffi/ffi -I/data/data/com.termux/files/usr/include/python3.11 -c build/temp.linux-aarch64-cpython-311/curl_cffi._wrapper.c -o build/temp.linux-aarch64-cpython-311/build/temp.linux-aarch64-cpython-311/curl_cffi._wrapper.o build/temp.linux-aarch64-cpython-311/curl_cffi._wrapper.c:888:10: error: call to undeclared function 'curl_easy_impersonate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 888 | return curl_easy_impersonate(x0, x1, x2); | ^ build/temp.linux-aarch64-cpython-311/curl_cffi._wrapper.c:932:14: error: call to undeclared function 'curl_easy_impersonate'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 932 | { result = curl_easy_impersonate(x0, x1, x2); } | ^ 2 errors generated. error: command '/data/data/com.termux/files/usr/bin/aarch64-linux-android-clang' failed with exit code 1 [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for curl_cffi Failed to build curl_cffi ERROR: Could not build wheels for curl_cffi, which is required to install pyproject.toml-based projects
Python version - 3.11.6
Pip version - 23.3
All my requirements:
aiogram==2.23.1 aiohttp==3.8.5 aiosignal==1.3.1 anyio==4.0.0 asttokens==2.4.0 async-timeout==4.0.3 attrs==23.1.0 Babel==2.9.1 browser-cookie3==0.19.1 certifi==2023.7.22 cffi==1.14.6 charset-normalizer==3.3.0 colorama==0.4.6 config==0.5.1 discord==2.3.2 discord.py==2.3.2 docopt==0.6.2
duckduckgo-search==3.9.3 et-xmlfile==1.1.0
executing==2.0.0 fake-useragent==1.3.0
Flask==3.0.0 Flask-Cors==4.0.0 frozenlist==1.4.0 g4f==0.1.6.8 GrabzIt==3.5.2 h11==0.14.0 httpcore==0.18.0 httpx==0.25.0 icecream==2.1.3 idna==3.4 Js2Py==0.74 magic-filter==1.0.12 markdown-it-py==3.0.0 mdurl==0.1.2 multidict==6.0.4 openai==0.28.1 openpyxl==3.1.2 pick==2.2.0 psm==0.1.2 pycparser==2.21 PyExecJS==1.5.1 Pygments==2.16.1 pyTelegramBotAPI==4.14.0 python-telegram-bot==20.6 pytz==2023.3.post1 requests==2.31.0 rich==13.6.0 simple-term-menu==1.6.1 six==1.16.0 sniffio==1.3.0 telebot==0.0.5 telegram==0.0.1 tqdm==4.66.1 typing_extensions==4.8.0 urllib3==2.0.5 websockets==11.0.3 yarl==1.9.2

@MAX1MDEV MAX1MDEV added the bug Something isn't working label Oct 20, 2023
@romanovj
Copy link

romanovj commented Oct 20, 2023

for curl_cffi you need to build libcurl-impersonate-chrome.so
https://github.com/lwthiker/curl-impersonate

@xtekky
Copy link
Owner

xtekky commented Oct 20, 2023

you might use another environment for g4f

@xtekky xtekky closed this as completed Oct 20, 2023
@romanovj
Copy link

romanovj commented Oct 20, 2023

@xtekky termux without chroot/proot, no problems with installation
pip install -U g4f
after compiling libcurl-impersonate-chrome.so
Screenshot_20231021-020513_Termux
Screenshot_20231021-020917_Браузер

@George-Seven
Copy link

George-Seven commented Oct 29, 2023

@romanovj when make chrome-build for curl-impersonate natively in Termux, I get error when it reaches boringssl. Pls help

[193/433] Building C object crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o
FAILED: crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o
/data/data/com.termux/files/usr/bin/gcc -DBORINGSSL_IMPLEMENTATION -I/data/data/com.termux/files/home/tmp/curl-impersonate/build/boringssl/third_party/googletest/include -I/data/data/com.termux/files/home/tmp/curl-impersonate/build/boringssl/crypto/../include -Wno-unknown-warning-option -Wno-stringop-overflow -Wno-array-bounds -Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -ggdb -Wall -fvisibility=hidden -fno-common -Wnewline-eof -fcolor-diagnostics -Wimplicit-fallthrough -Wmissing-prototypes -Wold-style-definition -Wstrict-prototypes -D_XOPEN_SOURCE=700 -O3 -DNDEBUG -fPIC -MD -MT crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o -MF crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o.d -o crypto/CMakeFiles/crypto.dir/x509/t_x509.c.o -c /data/data/com.termux/files/home/tmp/curl-impersonate/build/boringssl/crypto/x509/t_x509.c
/data/data/com.termux/files/home/tmp/curl-impersonate/build/boringssl/crypto/x509/t_x509.c:321:18: error: variable 'l' set but not used [-Werror,-Wunused-but-set-variable]
  321 |     int ret = 0, l, i;
      |                  ^
1 error generated.

@romanovj
Copy link

romanovj commented Oct 30, 2023

@George-Seven
open curl-impersonate/boringssl/CMakeLists.txt
search "set(C_CXX_FLAGS"
remove "-Werror"

open curl-impersonate/boringssl/ssl/test/handshake_util.h
delete "&& !defined(OPENSSL_ANDROID)"

@George-Seven
Copy link

@romanovj after the changes build continues, then later gives -

~/curl-impersonate/build $ make chrome-build
cd curl-8.1.1
# Don't pass this Makefile's MAKEFLAGS
make MAKEFLAGS=
make[1]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1'
Making all in lib
make[2]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
make  all-am
make[3]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
  CC       vtls/libcurl_impersonate_chrome_la-openssl.lo
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:329:13: error: typedef redefinition with different types ('int' vs 'struct crypto_threadid_st')
  329 | typedef int CRYPTO_THREADID;
      |             ^
/data/data/com.termux/files/usr/include/openssl/crypto.h:308:3: note: previous definition is here
  308 | } CRYPTO_THREADID;
      |   ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:333:29: error: typedef redefinition with different types ('struct asn1_null_st' vs 'int')
  333 | typedef struct asn1_null_st ASN1_NULL;
      |                             ^
/data/data/com.termux/files/usr/include/openssl/types.h:74:13: note: previous definition is here
   74 | typedef int ASN1_NULL;
      |             ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:391:30: error: typedef redefinition with different types ('struct conf_value_st' vs 'struct CONF_VALUE')
  391 | typedef struct conf_value_st CONF_VALUE;
      |                              ^
/data/data/com.termux/files/usr/include/openssl/conf.h:42:3: note: previous definition is here
   42 | } CONF_VALUE;
      |   ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:400:29: error: typedef redefinition with different types ('struct ecdsa_sig_st' vs 'struct ECDSA_SIG_st')
  400 | typedef struct ecdsa_sig_st ECDSA_SIG;
      |                             ^
/data/data/com.termux/files/usr/include/openssl/ec.h:1307:29: note: previous definition is here
 1307 | typedef struct ECDSA_SIG_st ECDSA_SIG;
      |                             ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:402:30: error: typedef redefinition with different types ('struct env_md_ctx_st' vs 'struct evp_md_ctx_st')
  402 | typedef struct env_md_ctx_st EVP_MD_CTX;
      |                              ^
/data/data/com.termux/files/usr/include/openssl/types.h:107:30: note: previous definition is here
  107 | typedef struct evp_md_ctx_st EVP_MD_CTX;
      |                              ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:403:26: error: typedef redefinition with different types ('struct env_md_st' vs 'struct evp_md_st')
  403 | typedef struct env_md_st EVP_MD;
      |                          ^
/data/data/com.termux/files/usr/include/openssl/types.h:106:26: note: previous definition is here
  106 | typedef struct evp_md_st EVP_MD;
      |                          ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:407:34: error: typedef redefinition with different types ('struct evp_encode_ctx_st' vs 'struct evp_Encode_Ctx_st')
  407 | typedef struct evp_encode_ctx_st EVP_ENCODE_CTX;
      |                                  ^
/data/data/com.termux/files/usr/include/openssl/types.h:133:34: note: previous definition is here
  133 | typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX;
      |                                  ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:419:29: error: typedef redefinition with different types ('struct md5_state_st' vs 'struct MD5state_st')
  419 | typedef struct md5_state_st MD5_CTX;
      |                             ^
/data/data/com.termux/files/usr/include/openssl/md5.h:46:3: note: previous definition is here
   46 | } MD5_CTX;
      |   ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:421:26: error: typedef redefinition with different types ('struct pkcs12_st' vs 'struct PKCS12_st')
  421 | typedef struct pkcs12_st PKCS12;
      |                          ^
/data/data/com.termux/files/usr/include/openssl/pkcs12.h:60:26: note: previous definition is here
   60 | typedef struct PKCS12_st PKCS12;
      |                          ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:429:32: error: typedef redefinition with different types ('struct sha256_state_st' vs 'struct SHA256state_st')
  429 | typedef struct sha256_state_st SHA256_CTX;
      |                                ^
/data/data/com.termux/files/usr/include/openssl/sha.h:67:3: note: previous definition is here
   67 | } SHA256_CTX;
      |   ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:430:32: error: typedef redefinition with different types ('struct sha512_state_st' vs 'struct SHA512state_st')
  430 | typedef struct sha512_state_st SHA512_CTX;
      |                                ^
/data/data/com.termux/files/usr/include/openssl/sha.h:117:3: note: previous definition is here
  117 | } SHA512_CTX;
      |   ^
In file included from vtls/openssl.c:82:
In file included from /data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/pool.h:18:
/data/data/com.termux/files/home/curl-impersonate/build/boringssl/build/include/openssl/base.h:431:29: error: typedef redefinition with different types ('struct sha_state_st' vs 'struct SHAstate_st')
  431 | typedef struct sha_state_st SHA_CTX;
      |                             ^
/data/data/com.termux/files/usr/include/openssl/sha.h:47:3: note: previous definition is here
   47 | } SHA_CTX;
      |   ^
vtls/openssl.c:290:6: error: use of undeclared identifier 'SSL_SIGN_RSA_PKCS1_MD5_SHA1'
  290 |     {SSL_SIGN_RSA_PKCS1_MD5_SHA1, "rsa_pkcs1_md5_sha1"},
      |      ^
vtls/openssl.c:291:6: error: use of undeclared identifier 'SSL_SIGN_RSA_PKCS1_SHA1'
  291 |     {SSL_SIGN_RSA_PKCS1_SHA1, "rsa_pkcs1_sha1"},
      |      ^
vtls/openssl.c:292:6: error: use of undeclared identifier 'SSL_SIGN_RSA_PKCS1_SHA256'
  292 |     {SSL_SIGN_RSA_PKCS1_SHA256, "rsa_pkcs1_sha256"},
      |      ^
vtls/openssl.c:293:6: error: use of undeclared identifier 'SSL_SIGN_RSA_PKCS1_SHA384'
  293 |     {SSL_SIGN_RSA_PKCS1_SHA384, "rsa_pkcs1_sha384"},
      |      ^
vtls/openssl.c:294:6: error: use of undeclared identifier 'SSL_SIGN_RSA_PKCS1_SHA512'
  294 |     {SSL_SIGN_RSA_PKCS1_SHA512, "rsa_pkcs1_sha512"},
      |      ^
vtls/openssl.c:295:6: error: use of undeclared identifier 'SSL_SIGN_ECDSA_SHA1'
  295 |     {SSL_SIGN_ECDSA_SHA1, "ecdsa_sha1"},
      |      ^
vtls/openssl.c:296:6: error: use of undeclared identifier 'SSL_SIGN_ECDSA_SECP256R1_SHA256'
  296 |     {SSL_SIGN_ECDSA_SECP256R1_SHA256, "ecdsa_secp256r1_sha256"},
      |      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [Makefile:3324: vtls/libcurl_impersonate_chrome_la-openssl.lo] Error 1
make[3]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
make[2]: *** [Makefile:1615: all] Error 2
make[2]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
make[1]: *** [Makefile:1269: all-recursive] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1'
make: *** [Makefile:117: chrome-build] Error 2

@romanovj
Copy link

@George-Seven rename folder /data/data/com.termux/files/usr/include/openssl

@George-Seven
Copy link

George-Seven commented Oct 31, 2023

@romanovj the ./curl-8.1.1/lib/.libs/libcurl-impersonate-chrome.so has been compiled but the next step give error -

~/curl-impersonate/build $ make chrome-build
cd curl-8.1.1                                                                                                                                           # Don't pass this Makefile's MAKEFLAGS
make MAKEFLAGS=
make[1]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1'                                                        Making all in lib
make[2]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'                                                    make  all-am
make[3]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
make[3]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
make[2]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/lib'
Making all in src                                                                                                                                       make[2]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/src'
Making all in ../docs
make[3]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs'                                                   Making all in .
make[4]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs'
make[4]: Nothing to be done for 'all-am'.                                                                                                               make[4]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs'
Making all in cmdline-opts                                                                                                                              make[4]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs/cmdline-opts'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs/cmdline-opts'
make[3]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/docs'
make[3]: Entering directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/src'
  CCLD     curl-impersonate-chrome
ld.lld: error: undefined reference due to --no-allow-shlib-undefined: EVP_MD_CTX_create                                                                 >>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: EVP_MD_CTX_destroy                                                                >>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sk_num
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: BIO_get_mem_data
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: BIO_reset
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so                                                                                            
ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sk_value
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: BIO_get_mem_ptr
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: EVP_PKEY_id                                                                       >>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: SSL_CTX_clear_chain_certs
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: SSL_CTX_add0_chain_cert                                                           >>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so
                                                                                                                                                        ld.lld: error: undefined reference due to --no-allow-shlib-undefined: BIO_read_filename
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sk_pop
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: SSL_CTX_add_extra_chain_cert
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so
                                                                                                                                                        ld.lld: error: undefined reference due to --no-allow-shlib-undefined: sk_pop_free_ex
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so                                                                                            
ld.lld: error: undefined reference due to --no-allow-shlib-undefined: OPENSSL_malloc
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so
                                                                                                                                                        ld.lld: error: undefined reference due to --no-allow-shlib-undefined: OPENSSL_free
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so                                                                                            
ld.lld: error: undefined reference due to --no-allow-shlib-undefined: CRYPTO_BUFFER_alloc
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: CRYPTO_BUFFER_free
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: SSL_CTX_set_mode
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: undefined reference due to --no-allow-shlib-undefined: SSL_CTX_set_msg_callback_arg
>>> referenced by ../lib/.libs/libcurl-impersonate-chrome.so

ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
gcc: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [Makefile:1018: curl-impersonate-chrome] Error 1
make[3]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/src'
make[2]: *** [Makefile:1496: all-recursive] Error 1
make[2]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1/src'
make[1]: *** [Makefile:1269: all-recursive] Error 1
make[1]: Leaving directory '/data/data/com.termux/files/home/curl-impersonate/build/curl-8.1.1'
make: *** [Makefile:117: chrome-build] Error 2

@romanovj
Copy link

romanovj commented Oct 31, 2023

most dumb way:
1)reinstall openssl
pkg rei openssl openssl-static
2)open and scroll to the bottom curl-impersonate/Makefile
delete everything after ./configure $$config_flags LIBS="$$add_libs"
3) delete and start again, no building here, only configure

rm -r curl-8.1.1
make chrome-build
  1. delete libs and headers for now
    rm -r $PREFIX/lib/libssl.* $PREFIX/lib/libcrypto.* $PREFIX/include/openssl
  2. build lib
cd curl-8.1.1
make -j8
  1. reinstall openssl
    pkg rei openssl openssl-static

  2. copy builded lib curl-8.1.1/lib/.libs/libcurl-impersonate-chrome.so.4.8.0 to $PREFIX/lib

  3. replace curl headers with curl-impersonate curl-8.1.1/include/curl -> $PREFIX/include/curl

now you are ready to build curl_cffi, don't forget to return original curl headers

@George-Seven
Copy link

@romanovj

Thanks so much, it's working perfectly👍

Tested the GUI with -

python -m g4f.gui.run -port 4447

And it's up on -

http://127.0.0.1:4447/chat/

and successfully running natively in Termux.

Screenshot_2023-11-01-06-34-58-807_com termux

@Mylinde
Copy link

Mylinde commented Jan 17, 2024

@George-Seven

@romanovj

Thanks so much, it's working perfectly👍

Tested the GUI with -

python -m g4f.gui.run -port 4447

And it's up on -

http://127.0.0.1:4447/chat/

and successfully running natively in Termux.

Screenshot_2023-11-01-06-34-58-807_com termux

Can you share your libcurl-impersonate-chrome.so?

@Def-Try
Copy link

Def-Try commented Jan 24, 2024

Finally compiled curl-impersonate. If anyone needs, here are the files that made g4f work:
libcurl-impersonate.zip

curl folder goes to $PREFIX/include/curl instead of already existing files,
everything except that to $PREFIX/lib

@Mylinde
Copy link

Mylinde commented Feb 14, 2024

Thanks alot, runs.

Screenshot_2024-02-14-14-18-58-674_com termux

@George-Seven
Copy link

George-Seven commented Apr 6, 2024

In Termux/PyDroid3 environment, dependencies of g4f either break, cannot install or not fully work even if install.

I found that in Termux we can use the g4f docker image with dependencies already baked-in, without root.

To streamline it more -

https://github.com/George-Seven/gpt4free-Termux

@hlohaus
Copy link
Collaborator

hlohaus commented Apr 7, 2024

@George-Seven this thead is 6 month old. Todays you can run g4f on termux/PyDroid

@richardhttps
Copy link

richardhttps commented Feb 8, 2025

@George-Seven this thead is 6 month old. Todays you can run g4f on termux/PyDroid

I still can′t install it on Termux.

I had to install Rust. Then xml2. Then when I run pip install g4f[all] Termux crashes when it′s building lxml wheel.

@hlohaus
Copy link
Collaborator

hlohaus commented Feb 8, 2025

@richardhttps
Try to install:
pip install -U g4f[slim]
The issue with curl_cffi still exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants