cross compile libxml2 for android has build errors - android-ndk

I am trying to cross compile libxml2 for android , since libxml need icu4c headers , Downloaded from the link https://github.com/android/platform_external_icu4c and included the unicode headers and tried to compiled using ndk-build,,.
But got the below errors .
obj/local/armeabi/objs/xsml2/encoding.o: In function `xmlUconvWrapper':
jni/encoding.c:1870: undefined reference to `ucnv_convertEx'
jni/encoding.c:1865: undefined reference to `ucnv_convertEx'
obj/local/armeabi/objs/xsml2/encoding.o: In function `closeIcuConverter':
jni/encoding.c:141: undefined reference to `ucnv_close'
jni/encoding.c:142: undefined reference to `ucnv_close'
obj/local/armeabi/objs/xsml2/encoding.o: In function `openIcuConverter':
jni/encoding.c:109: undefined reference to `ucnv_open'
jni/encoding.c:119: undefined reference to `ucnv_setFromUCallBack'
jni/encoding.c:126: undefined reference to `ucnv_open'
jni/encoding.c:132: undefined reference to `ucnv_close'
jni/encoding.c:115: undefined reference to `ucnv_setToUCallBack'
jni/encoding.c:115: undefined reference to `UCNV_FROM_U_CALLBACK_STOP'
jni/encoding.c:115: undefined reference to `UCNV_TO_U_CALLBACK_STOP'
For this errors I included the -L/Android/android-ndk-r8/external/libs -licui18n -licuuc in Android make file but I get the above errors .
Can some body suggests which version of icu4c libs has all these functions .
My final goal is to compile libxml2 for android .
Pls somebody through some light to proceed further .

Related

Issue with libudev library

I am getting the following libudev undefined reference errors while cross compiling to arm.
build_arm/lib//libCoreUtils.so: undefined reference to `udev_monitor_unref'
build_arm/lib//libCoreUtils.so: undefined reference to `udev_enumerate_scan_devices'
build_arm/lib//libCoreUtils.so: undefined reference to `udev_new'
build_arm/lib//libCoreUtils.so: undefined reference to `udev_list_entry_get_name'
...
I am using -ludev but also getting same error.
Can any anyone help me?

OpenSSL libssl.so error undefined reference to 'ssl3_cbc_remove_padding'

I am currently patching a older version of OpenSSL to the latest stable 1.0.0o build (via import_openssl.sh)for use with a Android application via the NDK r10c.
While building the libssl.so sharedlibrary i am presented with the following errors.
[armeabi] SharedLibrary : libssl.so
jni/openssl/ssl/s3_enc.c:542: error: undefined reference to 'ssl3_cbc_remove_padding'
jni/openssl/ssl/s3_enc.c:739: error: undefined reference to 'ssl3_cbc_record_digest_supported'
jni/openssl/ssl/s3_enc.c:764: error: undefined reference to 'ssl3_cbc_digest_record'
jni/openssl/ssl/s3_pkt.c:464: error: undefined reference to 'ssl3_cbc_copy_mac'
jni/openssl/ssl/t1_enc.c:763: error: undefined reference to 'tls1_cbc_remove_padding'
jni/openssl/ssl/t1_enc.c:919: error: undefined reference to 'ssl3_cbc_record_digest_supported'
jni/openssl/ssl/t1_enc.c:925: error: undefined reference to 'ssl3_cbc_digest_record'
jni/openssl/ssl/ssl_lib.c:1058: error: undefined reference to 'dtls1_min_mtu'
Taking the first error for example, i can see a reference in the file s3_enc.c (https://github.com/openssl/openssl/blob/OpenSSL_1_0_0-stable/ssl/s3_enc.c) to a function 'ssl3_cbc_remove_padding' but the actual function is nowhere to be seen, only a prototype in ssl_locl.h (https://github.com/openssl/openssl/blob/OpenSSL_1_0_0-stable/ssl/ssl_lib.c) so i am a little confused.
Any help or previous experience would be greatly appreciated in order to get these errors cleared. if you need me to elaborate further, please ask.
Check the files (s3_enc.c, t1_enc.c, ssl_lib.c), included in their respective .mk files or not. In my case it was not included so I just add these source files in ssl/Android.mk under LOCAL_SRC_FILES section.

Installing pciutils on Cygwin and makefile error

I want to run a project that communicates with a USB device using libusb. I already have it on Linux, and it works great there, so I want to run it on Windows with Cygwin. I installed libusb for Windows and libusb in Cygwin, then tried to compile it. It turns out that you need pciutils, unlike on Linux in which it's really easy to get it. In Cygwin it's a problem.
After overcoming some difficulties I managed to get further with my purpose of compiling pciutil in the Cygwin environment. I follwed these steps:
Download winio package for Windows and went to Winio\Binaries and copied winio32.dll and winio32.sys to the pciutil directory.
Copy config.h/mk from ../win32 to ../lib
Go to ..\lib\i386-io-winodws.h and change line 39 to "lib = LoadLibrary("WinIo32.dll");"
$ make
The make step didn't work. It showed me a makefile error, so I tried to play with it without any luck.
I got this error:
gcc lspci.o ls-vpd.o ls-caps.o ls-ecaps.o ls-kernel.o ls-tree.o ls-map.o common.o lib/libpci.a -o lspci
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x95): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xd3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0xf1): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x110): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x170): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x184): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x1af): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x204): undefined reference to `_outpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x218): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x242): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x259): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x2d5): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x30c): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x328): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x348): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3b2): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3c6): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x3ed): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x417): undefined reference to `_inpw'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x42f): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x447): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x457): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x65a): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x666): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x67c): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x688): undefined reference to `_inpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x69f): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x6c3): undefined reference to `_outpd'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x729): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x73d): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x751): undefined reference to `_outp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x75d): undefined reference to `_inp'
lib/libpci.a(i386-ports.o):i386-ports.c:(.text+0x778): undefined reference to `_inp'
collect2: error: ld returned 1 exit status
Makefile:96: recipe for target 'lspci' failed
make: *** [lspci] Error 1
I went to the Makefile, line 96, but I didn't understand what to change there in order to make it work (if you like, I could post the entire makefile too):
%: %.o
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $#
Since you're using a 32-bit version of Windows you can use the Cygwin port of pciutils. The files in the win32 subdirectory are actually for the MinGW port, and that's why you get the link errors.
The first thing you should do unpack the source files to a new directory so you can start from fresh. Your changes and modifications aren't necessary to compile it using Cygwin. Be sure not to copy any of the files in the win32 directory this time, they're not needed. Also don't copy the winio32 files, you don't need them either. Don't make any changes to any of the files.
The next thing to do is to install the ioperm package using Cygwin's setup-x86.exe. Type ioperm in the search box to quickly find it amongst all the other packages. Once it's been installed run ioperm -i from the Cygwin prompt to install the driver that allows applications to do direct I/O.
Next change directory to where you unpacked the fresh copy of pciutils and run the following command from the Cygwin shell:
make HOST=i386-pc-cygwin
That should be all you need to do to create the library and utilities.

Error "collect2: error: ld returned 1 exit status" shows while compiling vim (Versin>=7.4.399) from Cygwin

I've tired to maintenance the latest VIM/GVIM for windows, here is my OpenSource project.
However, I found the compile always failed by cygwin since the vim version higher than v7.4.399 (including v7.4.399).
Version less than v7.4.399 can be compiled with the same command successfully!
Failed Information:
obj/ex_docmd.o:ex_docmd.c:(.text+0x45f): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xbb7): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0xbe6): undefined reference to `crypt_encode_alloc'
obj/fileio.o:fileio.c:(.text+0xd69): undefined reference to `crypt_encode_inplace'
obj/fileio.o:fileio.c:(.text+0x69e3): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c66): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0x6c97): undefined reference to `crypt_free_key'
obj/fileio.o:fileio.c:(.text+0x716f): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x7177): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x8e48): undefined reference to `crypt_works_inplace'
obj/fileio.o:fileio.c:(.text+0x8e73): undefined reference to `crypt_decode_inplace'
obj/fileio.o:fileio.c:(.text+0x906d): undefined reference to `crypt_method_nr_from_magic'
obj/fileio.o:fileio.c:(.text+0x9098): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90c8): undefined reference to `crypt_create_from_header'
obj/fileio.o:fileio.c:(.text+0x90df): undefined reference to `crypt_set_cm_option'
obj/fileio.o:fileio.c:(.text+0x90e7): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0x9158): undefined reference to `crypt_decode_alloc'
obj/fileio.o:fileio.c:(.text+0x9e3f): undefined reference to `crypt_append_msg'
obj/fileio.o:fileio.c:(.text+0x9ed4): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0x9edc): undefined reference to `crypt_get_header_len'
obj/fileio.o:fileio.c:(.text+0xa5bc): undefined reference to `crypt_get_key'
obj/fileio.o:fileio.c:(.text+0xca32): undefined reference to `crypt_free_state'
obj/fileio.o:fileio.c:(.text+0xdd15): undefined reference to `crypt_get_method_nr'
obj/fileio.o:fileio.c:(.text+0xdd37): undefined reference to `crypt_create_for_writing'
obj/fileio.o:fileio.c:(.text+0xe2d2): undefined reference to `crypt_append_msg'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: obj/fileio.o: bad reloc address 0x2e8 in section `.rdata'
/usr/lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Make_cyg.mak:603: recipe for target 'vim.exe' failed
make: *** [vim.exe] Error 1
The compile command:
make -B -f Make_cyg.mak PYTHON=/cygdrive/c/Marslo/MyProgramFiles/Python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=/cygdrive/c/Marslo/MyProgramFiles/Python34 DYNAMIC_PYTHON3=yes PYTHON3_VER=34 FEATURES=huge IME=yes GIME=yes MBYTE=yes CSCOPE=yes USERNAME=Marslo.Jiao USERDOMAIN=China GUI=no
I checked the difference between v7-4-398 and v7-4-399, and found there something updated with encryption. Then I added the libs and other stuff about crypt in cygwin as below, but the compile still CANNOT work....
What should I do can compile the higher version vim ?
Environments:
Cygwin version: Latest setup-x86_64.exe, mintty 1.2-beta1 (x86_64-pc-cygwin)
Have you tried compiling with all the patches that are currently available. I think Bram Moolenaar (Maintainer for vim) forgot to add some of the files in one of the patches and one of the later one fixes that. If not post to vim_dev#vim.org
This was also reported to at https://groups.google.com/forum/#!topic/vim_dev/D8FyRd0EwlE.
Patch 7.4.401 should fix it https://groups.google.com/forum/#!topic/vim_dev/q0dbl0_9k9U
Got this issue again on CentOS 7, Python 2.7.10, 64bit.
According to this answer, this issue has been fixed;
export vi_cv_path_python_plibs="-L/<python_config_path> ..."
For example in my situation:
export vi_cv_path_python_plibs="-L/usr/local/lib/python2.7/config ..."
Compile command:
$ ./configure --prefix=$HOME/.marslo/myprograms/vim74 --enable-pythoninterp --with-python-config-dir=/usr/local/lib/python2.7/config --with-features=huge --disable-smack --enable-cscope --with-tlib=ncurses --with-compiledby=marslo#china
$ cd src && make first
$ cd .. && make
$ make install
You can disable sodium library in ./configure such as :
./configure -disable-libsodium

Undefined reference errors when including external library libxml2 in android ndk

I'm trying to use libxml2 with android ndk. When I run the make file, I got errors saying that file 'unicode/ucnv.h' does not exist. I've seen 'unicode/ucnv.h' is included in one of the files and no such header file is present. So I downloaded unicode header files from http://site.icu-project.org/ and placed them in include folder.
Now the previous error is gone but I've got these errors.
SharedLibrary : libxml2.so
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `openIcuConverter':
C:\test\hello-jni/jni/encoding.c:109: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:115: undefined reference to `ucnv_setToUCallBack_49'
C:\test\hello-jni/jni/encoding.c:119: undefined reference to `ucnv_setFromUCallBack_49'
C:\test\hello-jni/jni/encoding.c:126: undefined reference to `ucnv_open_49'
C:\test\hello-jni/jni/encoding.c:132: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_TO_U_CALLBACK_STOP_49'
C:\test\hello-jni/jni/encoding.c:135: undefined reference to `UCNV_FROM_U_CALLBACK_STOP_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `closeIcuConverter':
C:\test\hello-jni/jni/encoding.c:141: undefined reference to `ucnv_close_49'
C:\test\hello-jni/jni/encoding.c:142: undefined reference to `ucnv_close_49'
./obj/local/armeabi/objs-debug/xml2/encoding.o: In function `xmlUconvWrapper':
C:\test\hello-jni/jni/encoding.c:1865: undefined reference to `ucnv_convertEx_49'
C:\test\hello-jni/jni/encoding.c:1870: undefined reference to `ucnv_convertEx_49'
collect2: ld returned 1 exit status
make: * [obj/local/armeabi/libxml2.so] Error 1
I didn't find function ucnv_open_49 in any of the files.
Am I the only one who is facing this problem?
Build unicode library (icu) along with libxml2 and mention in LOCAL_SHARED_LIBRARIES.
That's it!
Are you intending to link libxml2 against ICU (e.g. use it for conversion)? It's optional but currently you have it enabled. With such you'll need ICU to be linked in as well rather static or dynamic. See the libxml2's configure script for options. Some of which are iconv or even no converters if you intend to work with UTF-8 only.

Resources