I have been trying to build the package libical for some time without success. I have tried version 1.0.0, 1.0.1, 2.0.0, 3.0.0, 3.0.1 from their official releases page https://github.com/libical/libical/releases.
This is the script I used to build, nothing special:
apt install -y autoconf automake clang cmake glib glib-bin glib-dev libicu libicu-dev libtool libxml2 libxml2-dev make patch p7zip perl sed wget yasm
# [...]
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/data/data/com.termux/files/usr -DCMAKE_BUILD_TYPE=Release ..
make
make test
make install
These are the errors I get:
# 1.0.0: make
# [ 91%] Linking C executable stow
# CMakeFiles/stow.dir/stow.o: In function `get_options':
# /data/data/com.termux/files/home/build/libical-1.0.0/src/test/stow.c:(.text+0xd10): undefined reference to `getpwent'
# clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
# make[2]: *** [src/test/CMakeFiles/stow.dir/build.make:97: src/test/stow] Error 1
# make[1]: *** [CMakeFiles/Makefile2:706: src/test/CMakeFiles/stow.dir/all] Error 2
# make: *** [Makefile:141: all] Error 2
# 1.0.1: make test
# Test project /data/data/com.termux/files/home/build/libical-1.0.1/build
# Start 1: regression
# 1/7 Test #1: regression .......................***Exception: Other 0.13 sec
# Start 2: recur
# 2/7 Test #2: recur ............................***Exception: Other 0.13 sec
# Start 3: icalrecurtest
# 3/7 Test #3: icalrecurtest ....................***Failed 0.20 sec
# Start 4: testmime
# 4/7 Test #4: testmime .........................***Exception: Other 0.13 sec
# Start 5: testvcal
# 5/7 Test #5: testvcal .........................***Exception: Other 0.14 sec
# Start 6: process
# 6/7 Test #6: process ..........................***Exception: Other 0.13 sec
# Start 7: timezones
# 7/7 Test #7: timezones ........................***Exception: Other 0.17 sec
# 0% tests passed, 7 tests failed out of 7
# Total Test time (real) = 1.05 sec
# The following tests FAILED:
# 1 - regression (OTHER_FAULT)
# 2 - recur (OTHER_FAULT)
# 3 - icalrecurtest (Failed)
# 4 - testmime (OTHER_FAULT)
# 5 - testvcal (OTHER_FAULT)
# 6 - process (OTHER_FAULT)
# 7 - timezones (OTHER_FAULT)
# Errors while running CTest
# make: *** [Makefile:130: test] Error 8
md5-11a4a3620ac0b5ca9ec45cbc4dd82921
# 2.0.0: make
# [87%] Building C object src/test/CMakeFiles/stow.dir/stow.c.o
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:565:22: warning:
# implicit declaration of function 'getpwent' is invalid
# in C99 [-Wimplicit-function-declaration]
# while ((pw = getpwent()) != 0) {
# ^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:565:20: warning:
# incompatible integer to pointer conversion assigning
# to 'struct passwd *' from 'int' [-Wint-conversion]
# while ((pw = getpwent()) != 0) {
# ^ ~~~~~~~~~~
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:566:32: error:
# incomplete definition of type 'struct passwd'
# if (strcmp(user, pw->pw_name) == 0) {
# ~~^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:555:16: note:
# forward declaration of 'struct passwd'
# struct passwd *pw;
# ^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:579:15: error:
# incomplete definition of type 'struct passwd'
# if (pw->pw_dir == 0) {
# ~~^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:555:16: note:
# forward declaration of 'struct passwd'
# struct passwd *pw;
# ^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:587:53: error:
# incomplete definition of type 'struct passwd'
# snprintf(file, MAXPATHLEN, "%s/.facs/%s", pw->pw_dir...
# ~~^
# /data/data/com.termux/files/home/build/libical-2.0.0/src/test/stow.c:555:16: note:
# forward declaration of 'struct passwd'
# struct passwd *pw;
# ^
# 2 warnings and 3 errors generated.
# make[2]: *** [src/test/CMakeFiles/stow.dir/build.make:63: src/test/CMakeFiles/stow.dir/stow.c.o] Error 1
# make[1]: *** [CMakeFiles/Makefile2:897: src/test/CMakeFiles/stow.dir/all] Error 2
# make: *** [Makefile:141: all] Error 2
md5-11a4a3620ac0b5ca9ec45cbc4dd82921
# 3.0.0: cmake
# CMake Error at CMakeLists.txt:387 (message):
# You requested to build libical-glib, but the necessary development packages
# are missing or too low a version (glib 2.32 and libxml 2.7.3 or higher are
# required)
md5-11a4a3620ac0b5ca9ec45cbc4dd82921
# 3.0.1: cmake
# CMake Error at CMakeLists.txt:387 (message):
# You requested to build libical-glib, but the necessary development packages
# are missing or too low a version (glib 2.32 and libxml 2.7.3 or higher are
# required)
Version 1.0.1 is built but fails tests with exceptions. If I install it and debug a program that uses the generated shared library, I get a SEGFAULT for strlen() in /system/lib64/libc.so.
Since I have successfully built version 1.0.1 on Windows 7 x64 (using msys), on Cygwin x64 (on the same host machine) and on debian stretch (on a virtual machine hosted in Windows 7 x64), I guess the errors must be special to termux (or to the way termux works within Android). I'm using a OnePlus 3T with stock Nougat (aarch64).
Any help would be appreciated.
Thanks in advance!
I build it with gcc on termux but you can do make clean and then make -j9 and then make install try it:+1: and tell me!
https://mega.nz/#!VuoSyCTb!mmaW3ex2U-U5IlVZigdAYQGq9WGRtnRysgeU4mz4Wl4
Thanks for your help! Unfortunately I could not get it to work with your build. I extracted the contents under home/bio and tried make test, make install and make - j9, but I got errors for every command (output attached)
make.test.txt
make.install.txt
make.j9.txt
@valpogus I managed to cross-compile it (see https://github.com/Grimler91/termux-packages/tree/libical/packages/libical).
I haven't tested it but have built debs for arm and aarch64 available here:
libical_3.0.1_aarch64.deb
libical_3.0.1_arm.deb
Could you please try it before I open a pull request?
Thanks a lot! Could you please include in the deb packages the other files and directories that are generated by a "make install" of libical? Like for example the "include" directory? I need the libical headers to build my program which uses the libical library. Then I can test if everything works.
I tried myself to compile version 3.0.1 on termux using your patch and build options, by it failed and I sadly don't know how to cross-compile on other platforms for termux.
The headers are automatically put into a "libical-dev" package (which I didn't upload). I've uploaded them now, see
libical-dev_3.0.1_arm.deb
and
libical-dev_3.0.1_aarch64.deb.
Wow, awesome! I installed your libcal and libcal-dev and successfully built and tested my program. The only thing which does not work in my program is timezone support, but that is a known problem on termux/Android due to not having a (/data/data/com.termux/files)/usr/(local/)share/zoneinfo directory, so I guess that's a problem for me to fix in my program, not in the libical library.
Thanks a lot for your help! :)
I just have a last question, to further show my ignorance XD: when you make a pull request and it is accepted and merged, does that mean that the packages libical and libical-dev will be available in the termux repository and could be installed with apt/apt-get/pkg?
@valpogus yeah, as soon as the pull request has been merged (and the package built), it will be available through apt.
About the timezone, there was some option about it in the libical configure options, so I guess there could be something that should be changed/patched there as well.
glib contains a timezone patch if you need some inspiration for how it might be patched.
@Grimler91 @valpogus The package is now available from the apt repo, install it with pkg in libical.
-DUSE_BUILTIN_TZDATA=true parameter to avoid the problem with share/zoneinfo for now.Thanks a lot! I compiled my program and now timezones work :+1:
_Advice for developers using libical:_
Since termux uses a prefixed directory structure, you have to explicitly define the path to the zoneinfo directory in your code:
set_zone_directory("/data/data/com.termux/files/usr/share/libical/zoneinfo");
@valpogus Hm, it would be nice to make this work out of the box without needing to call set_zone_directory(). Could you share a short example program that fails without that call so I can try things out?
@valpogus I added a patch to libical that hopefully makes the library work without needing to call set_zone_directory().
Could you try installing the updated 3.0.1-2 version by running pkg up and see if that fixes the need for calling set_zone_directory()?
I updated the libical packages to 3.0.1-2 and compiled my program without calling set_zone_directory() and timezones do work. Thanks again!