termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.33k stars 3.07k forks source link

[Package]: cqueues #7469

Closed dauuricus closed 3 years ago

dauuricus commented 3 years ago

Package description

https://github.com/wahern/cqueues

luarocks install http

Installing https://luarocks.org/http-0.4-0.all.rock
Missing dependencies for http 0.4-0:

cqueues >= 20161214 (not installed)

http 0.4-0 depends on cqueues >= 20161214 (not installed)
Installing https://luarocks.org/cqueues-20200726.53-0.src.rock
Warning: unmatched variable LUA_LIBDIR
luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix
luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix
luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix
luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix

cp /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/config.h.guess
/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/config.h                                                                               cp /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/config.h /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/config.h                                                                                 luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix
mkdir -p /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/5.3                                                                                      gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension -O2 -fPIC -DLUA_COMPAT_APIINTCASTS  -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/data/data/com.termux/files/usr/include" -I"/data/data/com.termux/files/usr/include" -DCOMPAT53_PREFIX=cqueues -DCQUEUES_VENDOR='"quae@daurnimator.com"' -DCQUEUES_VERSION=20200726L  -c -o /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/5.3/cqueues.o
/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/cqueues.c
/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/cqueues.c:47:10:
fatal error: 'lua.h' file not found
#include <lua.h> 
 ^~~~~~~
1 error generated.

make: *** [/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/GNUmakefile:88:
/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-6335977/cqueues-rel-20200726/src/5.3/cqueues.o] Error 1
Error: Failed installing dependency: https://luarocks.org/cqueues-20200726.53-0.src.rock - Build error: Failed building.

Home page URL

No response

Source code URL

https://github.com/wahern/cqueues

Packaging policy acknowledgement

Additional information

No response

Grimler91 commented 3 years ago

We generally do not package things that can be installed through other package managers.

It will probably work if you do export CFLAGS=" -I$PREFIX/include/lua#.#", where #.# is 5.2, 5.3 or 5.4 (depending on lua version you want to use). You might need export prefix=$PREFIX for it to install correctly as well

Grimler91 commented 3 years ago

The messages:

Warning: unmatched variable LUA_LIBDIR

and

luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix

look a bit omnious as well, not sure where they come from or if they will cause issues

dauuricus commented 3 years ago

thanks. but i fail.

now my ~/.profile

export PATH=$PATH:$HOME/nim-1.4.8/bin
#export PATH=$PATH:/data/data/com.termux/files/usr/bin/
export prefix=$PREFIX
export CFLAGS=" -I$PREFIX/include/lua5.3"

u0_a185@localhost ~ [1]> luarocks install cqueues Installing https://luarocks.org/cqueues-20200726.53-0.src.rock

Warning: unmatched variable LUA_LIBDIR luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix cp /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/config.h.guess /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/config.h cp /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/config.h /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/config.h luapath: /data/data/com.termux/files/usr/tmp/luapath-: unable to generate random suffix mkdir -p /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/5.3 gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension -O2 -fPIC -DLUA_COMPAT_APIINTCASTS -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/data/data/com.termux/files/usr/include" -I"/data/data/com.termux/files/usr/include" -DCOMPAT53_PREFIX=cqueues -DCQUEUES_VENDOR='"quae@daurnimator.com"' -DCQUEUES_VERSION=20200726L -c -o /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/5.3/cqueues.o /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/cqueues.c /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/cqueues.c:47:10: fatal error: 'lua.h' file not found

include

     ^~~~~~~

1 error generated. make: *** [/data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/GNUmakefile:88: /data/data/com.termux/files/usr/tmp/luarocks_cqueues-20200726.53-0-3099785/cqueues-rel-20200726/src/5.3/cqueues.o] Error 1

Error: Build error: Failed building.


maybe termux package luarocks suports only lua53.

dauuricus commented 3 years ago

Since it is a luarocks package, I can not request a package for the same reason, but it seems that this can not be built with the termux specifications.

Error: Build error: Failed building.

u0_a185@localhost ~ [1]> luarocks install xml Installing https://luarocks.org/xml-1.1.3-1.src.rock

Error: Could not find library file for STDCPP No file libstdc++.a in /data/data/com.termux/files/usr/local/lib No file libstdc++.a in /data/data/com.termux/files/usr/local/lib64 No file libstdc++.so in /data/data/com.termux/files/usr/local/lib No file libstdc++.so in /data/data/com.termux/files/usr/local/lib64 No file matching libstdc++.so. in /data/data/com.termux/files/usr/local/lib No file matching libstdc++.so. in /data/data/com.termux/files/usr/local/lib64 No file libstdc++.a in /data/data/com.termux/files/usr/lib No file libstdc++.a in /data/data/com.termux/files/usr/lib64 No file libstdc++.so in /data/data/com.termux/files/usr/lib No file libstdc++.so in /data/data/com.termux/files/usr/lib64 No file matching libstdc++.so. in /data/data/com.termux/files/usr/lib No file matching libstdc++.so. in /data/data/com.termux/files/usr/lib64 You may have to install STDCPP in your system and/or pass STDCPP_DIR or STDCPP_LIBDIR to the luarocks command. Example: luarocks install xml STDCPP_DIR=/usr/local


dauuricus commented 3 years ago

Now I got GCC on termux

u0_a185@localhost ~ [1]> cd $PREFIX/../cctools-toolchain/bin/
u0_a185@localhost /d/d/c/f/c/bin> ls
addr2line                         c++      gcc-ar-10      ld
ar                                c++-10   gcc-nm         ld.bfd
arm-linux-androideabi-c++         c++filt  gcc-nm-10      lto-dump-10
arm-linux-androideabi-cpp         cpp      gcc-ranlib     nm
arm-linux-androideabi-g++         cpp-10   gcc-ranlib-10  objcopy
arm-linux-androideabi-gcc         elfedit  gcov-10        objdump
arm-linux-androideabi-gcc-ar      g++      gcov-dump-10   ranlib
arm-linux-androideabi-gcc-nm      g++-10   gcov-tool-10   readelf
arm-linux-androideabi-gcc-ranlib  gcc      gfortran       size
arm-linux-androideabi-gfortran    gcc-10   gfortran-10    strings
as                                gcc-ar   gprof          strip
u0_a185@localhost /d/d/c/f/c/bin [1]> cd $PREFIX/../cctools-toolchain/
u0_a185@localhost /d/d/c/f/cctools-toolchain> ls
aarch64-linux-android  arm-linux-androideabi  bin  include  lib  share
u0_a185@localhost /d/d/c/f/cctools-toolchain> cd $PREFIX/../cctools-toolchain/lib
u0_a185@localhost /d/d/c/f/c/lib> ls
armv7-a       libbfd.a          libgomp.a     libopcodes.a        libstdc++fs.a
bfd-plugins   libbfd.la         libgomp.la    libopcodes.la       libstdc++fs.la
gcc           libgfortran.a     libgomp.spec  libstdc++.a         libsupc++.a
libatomic.a   libgfortran.la    libobjc.a     libstdc++.a-gdb.py  libsupc++.la
libatomic.la  libgfortran.spec  libobjc.la    libstdc++.la        thumb

Rf.

https://android.stackexchange.com/questions/182130/use-gcc-compiler-in-termux#186223

.https://cctools.info/index.php/Termux_repository_with_cctools_packages_(gcc_with_fortran_support_etc)

and then I got error ...

u0_a185@localhost ~> luarocks install xml STDCPP_LIBDIR=$PREFIX/../cctools-toolchain/lib
Installing https://luarocks.org/xml-1.1.3-1.src.rock

gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
In file included from include/xml/Parser.h:33,
                 from src/Parser.cpp:1:
src/bind/dub/dub.h:32:10: fatal error: string.h: No such file or directory
   32 | #include <string.h>  // strlen strcmp
      |          ^~~~~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/Parser.o
dauuricus commented 3 years ago

OK.I clear Lua 'xml' case :

I just exit Termux, then login and try same as defore.

~ $ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
u0_a185@localhost ~> luarocks install xml STDCPP_LIBDIR=$PREFIX/../cctools-toolchain/lib
Installing https://luarocks.org/xml-1.1.3-1.src.rock

gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/dub/dub.cpp -o src/bind/dub/dub.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/xml_Parser.cpp -o src/bind/xml_Parser.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/xml_core.cpp -o src/bind/xml_core.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -shared -o xml/core.so src/Parser.o src/bind/dub/dub.o src/bind/xml_Parser.o src/bind/xml_core.o -L/data/data/com.termux/files/usr/../cctools-toolchain/lib -Wl,-rpath,/data/data/com.termux/files/usr/../cctools-toolchain/lib -lstdc++
xml 1.1.3-1 is now installed in /data/data/com.termux/files/usr (license: MIT)

then back to cqueuse case : maybe I did misunderstand that comment ...

It will probably work if you do export CFLAGS=" -I$PREFIX/include/lua#.#", where #.# is 5.2, 5.3 or 5.4 (depending on lua version you want to use). You might need export prefix=$PREFIX for it to install correctly as well

sorry.I have to understand luarocks more details.

Grimler91 commented 3 years ago

now my ~/.profile

Yeah, I don't think .profile is sourced by bash, .bash_profile would have worked

Remove this arg, it will cause issues: STDCPP_LIBDIR=$PREFIX/../cctools-toolchain/lib. libstdc++ is in /system/lib(64), if it is not found then add -L/system/lib or -L/system/lib64 to LDFLAGS. It should, probably, work to compile with clang, no need for gcc

gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
In file included from include/xml/Parser.h:33,
                 from src/Parser.cpp:1:
src/bind/dub/dub.h:32:10: fatal error: string.h: No such file or directory
   32 | #include <string.h>  // strlen strcmp
      |          ^~~~~~~~~~
compilation terminated.

It failed to find string.h here because -I/data/data/com.termux/files/usr/include is missing from CFLAGS or CPPFLAGS (as seen in the compilation argument).

dauuricus commented 3 years ago

I remove cctools.

~ $ gcc -v clang version 12.0.1 Target: armv7a-unknown-linux-android24 Thread model: posix InstalledDir: /data/data/com.termux/files/usr/bin ~ $ g++ -v clang version 12.0.1 Target: armv7a-unknown-linux-android24 Thread model: posix InstalledDir: /data/data/com.termux/files/usr/bin

~ $ vim .profile

export PATH=$PATH:$HOME/nim-1.4.8/bin
export PATH=$PATH:/data/data/com.termux/files/usr/bin/
export prefix=$PREFIX
export CFLAGS=' -I$PREFIX/include/lua5.3'
export LDFLAGS=' -L/system/lib'
export LDFLAGS=' -L/system/lib64'
~ $ vim .profile
~ $ source .profile
~ $ luarocks install xml STDCPP_LIBDIR=/usr/local

Installing https://luarocks.org/xml-1.1.3-1.src.rock

Error: Could not find library file for STDCPP
  No file libstdc++.a in /usr/local
  No file libstdc++.so in /usr/local
  No file matching libstdc++.so.* in /usr/local
You may have to install STDCPP in your system and/or pass STDCPP_DIR or STDCPP_LIBDIR to the luarocks command.
Example: luarocks install xml STDCPP_DIR=/usr/local

missing.

Grimler91 commented 3 years ago

lua is such a mess :roll_eyes:

You have an arm device, so remove export LDFLAGS=' -L/system/lib64'. Could try setting STDCPP_LIBDIR=/system/lib as the message suggests, and if that does not work export LD_LIBRARY_PATH=' -L/system/lib64'

dauuricus commented 3 years ago

nice

u0_a185@localhost ~/luatest [1]> luarocks install xml STDCPP_LIBDIR=/system/lib
Installing https://luarocks.org/xml-1.1.3-1.src.rock

gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/dub/dub.cpp -o src/bind/dub/dub.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/xml_Parser.cpp -o src/bind/xml_Parser.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c src/bind/xml_core.cpp -o src/bind/xml_core.o -Iinclude -Isrc/bind -Isrc/vendor
gcc -shared -o xml/core.so src/Parser.o src/bind/dub/dub.o src/bind/xml_Parser.o src/bind/xml_core.o -L/system/lib -Wl,-rpath,/system/lib -lstdc++
xml 1.1.3-1 is now installed in /data/data/com.termux/files/home/luatest/./lua_modules (license: MIT)

Missing dependencies for http 0.4-0:
   cqueues >= 20161214 (not installed)
dauuricus commented 3 years ago

Still struggling. cqueues ... (and more example 'lua-cjson')

These are difficult, because just as termux can't know about packages offered by other package managers, the community of other package managers thinks termux is a complex customized "non-linux". There is a perception that the platform does not cover support, and even if it is due to a range of problems in linux, it may be difficult to resolve ...

Grimler91 commented 3 years ago

Many other package managers can handle termux without much issues (pip, gem, tlmgr, cargo, ...), though some of them requires some patches.

If the issues can be fixed in luarocks then we can happily apply patches to it to fix the issue (I am not really familiar with luarocks so don't know if that is possible)

dauuricus commented 3 years ago

but i could't solve any .

/system/lib and -L/system/lib64 There is such a difference.

I don't have this kind of knowledge. Thank you very much.