0

When i follow instructions here, i get this error when running latest instruction that is "make":

make[1]: Entering directory '/home/fasegiar/Downloads/openconnect-8.08'
  CC       libopenconnect_la-ssl.lo
In file included from ssl.c:41:
In file included from ./openconnect-internal.h:102:
In file included from /usr/include/libxml2/libxml/tree.h:1307:
In file included from /usr/include/libxml2/libxml/xmlmemory.h:218:
In file included from /usr/include/libxml2/libxml/threads.h:35:
In file included from /usr/include/libxml2/libxml/globals.h:18:
In file included from /usr/include/libxml2/libxml/parser.h:810:
/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: 'unicode/ucnv.h' file not found
#include <unicode/ucnv.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
Makefile:1037: recipe for target 'libopenconnect_la-ssl.lo' failed
make[1]: *** [libopenconnect_la-ssl.lo] Error 1
make[1]: Leaving directory '/home/fasegiar/Downloads/openconnect-8.08'
Makefile:749: recipe for target 'all' failed
make: *** [all] Error 2

The TARGET that i use is: armv7a-linux-androideabi

My TOOLCHAIN is: /home/fasegiar/Documents/android-ndk-r21/toolchains/llvm/prebuilt/linux-x86_64

Here is the output of the config.log after ./configure call

  • Please show the *full* output of your configure and make call. "Make error 1" is a useless diagnostic. – Botje Apr 20 '20 at 07:04
  • @Botje I update with full output – Armel Gildas Fagbedji Apr 20 '20 at 10:03
  • Is that the full output of calling configure and make? I doubt that. – Botje Apr 20 '20 at 12:19
  • Edit your question. Please add the **FULL INVOCATION AND OUTPUT OF CONFIGURE AND MAKE** not just the last few lines. – Botje Apr 20 '20 at 13:00
  • @Botje i upate my question with your need – Armel Gildas Fagbedji Apr 20 '20 at 13:13
  • Your link is broken. – Botje Apr 20 '20 at 13:35
  • @Botje i update it – Armel Gildas Fagbedji Apr 20 '20 at 14:04
  • @Botje i find ucnv.h in /usr/include/unicode/ucnv.h, but why in compilation time it said `/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: 'unicode/ucnv.h' file not found #include ` i dont understand – Armel Gildas Fagbedji Apr 20 '20 at 14:55
  • This is expected behavior: A cross compiler should not use files from your system, because they are not compatible! The cross compilers that come with Android only look inside the `sysroot`. Check for yourself with `./armv7a-linux-androideabi21-clang -Wp,-v -fsyntax-only -x c - < /dev/null` . The configure script picked up libxml2 from your system by accident, which is why it _is_ looking at `/usr/include/libxml2`. Please read my answer and a [guide to cross compilation](https://clang.llvm.org/docs/CrossCompilation.html). – Botje Apr 20 '20 at 15:07

1 Answers1

3

From the snippet you posted I can already tell you this is not going to work. When cross-compiling you need to cross-compile all dependencies first for your target platform (ie Android) and then tell the configure script where to find the installed dependencies. For openconnect the dependencies are:

Required:

  • libxml2 (this in turn requires libicu, as your error points out)
  • zlib (this is bundled)
  • Either OpenSSL or GnuTLS (v3.2.10+) (see NDKPorts)

Optional:

  • p11-kit (for PKCS#11 support)
  • libp11 (also needed for PKCS#11 support if using OpenSSL)
  • libproxy
  • trousers (for TPMv1 support if using GnuTLS)
  • libtasn1 and either tss2-esys or IBM's TPM 2.0 TSS. (for TPMv2 support if using GnuTLS)
  • libstoken (for SecurID software token support)
  • libpskc (for RFC6030 PSKC file storage of HOTP/TOTP keys)
  • libpcsclite (for Yubikey hardware HOTP/HOTP support)
Botje
  • 26,269
  • 3
  • 31
  • 41
  • Hi @Botje, i think that is what instructions under android/ folder do. But i run into this [error](https://docs.google.com/document/d/1MN5rEF3vOJvrbNSs01crDfoGblZtgz4NfUvv98V-dUE/edit?usp=sharing) – Armel Gildas Fagbedji Apr 21 '20 at 06:28
  • 1
    ["Note that on Android, unlike Linux, there are no separate libpthread libraries. That functionality is included directly in libc, which does not need to be explicitly linked against."](https://developer.android.com/ndk/guides/stable_apis#core_cc) As for iconv, you will need to figure out which component drags it in. – Botje Apr 21 '20 at 06:34
  • Is that means that I need to install a libc library on my machine? – Armel Gildas Fagbedji Apr 21 '20 at 06:37
  • 1
    It means you may not specify `-lpthread` when linking code for android. – Botje Apr 21 '20 at 06:38
  • As it is make script that I run, I don’t find where it is specified to remove it, have you any idea please? – Armel Gildas Fagbedji Apr 21 '20 at 06:56
  • I find where -lpthread is, have need to not specify -liconv too? – Armel Gildas Fagbedji Apr 21 '20 at 07:31
  • 1
    You need to either build iconv or tell whatever dependency that needs it to not use it. – Botje Apr 21 '20 at 07:32