Android NDK で使用する XZ-utils コードをコンパイルしようとしています。libogg および libtheora ライブラリーを正しくコンパイルするために使用したのと同じ手順に従います。ただし、XZ-Utils の liblzma ライブラリを作成することはできません。これは私が使用する手順です:
1) ライブラリ ソースを含むフォルダに移動します。
cd ~/Drivers/xz-5.0.5
2) Autotool makefile を次のように構成します。
./configure --prefix=/home/rb/Drivers/xz --host=arm-linux-androideabi --target=arm-linux-androideabi --disable-shared --enable-static --enable-debug
3) ライブラリを作成し、コンパイルに使用するツールチェーンを指定します (/opt/ndk/ にあります)。
make CC=/opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc CXX=/opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-g++ LD=/opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-ld
3 番目のコマンドを実行すると、次のエラーが発生します。
make all-recursive
make[1]: Entering directory `/home/rb/Drivers/xz-5.0.5'
Making all in src
make[2]: Entering directory `/home/rb/Drivers/xz-5.0.5/src'
Making all in liblzma
make[3]: Entering directory `/home/rb/Drivers/xz-5.0.5/src/liblzma'
Making all in api
make[4]: Entering directory `/home/rb/Drivers/xz-5.0.5/src/liblzma/api'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/home/rb/Drivers/xz-5.0.5/src/liblzma/api'
make[4]: Entering directory `/home/rb/Drivers/xz-5.0.5/src/liblzma'
/bin/bash ../../libtool --tag=CC --mode=compile /opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -MT liblzma_la-tuklib_physmem.lo -MD -MP -MF .deps/liblzma_la-tuklib_physmem.Tpo -c -o liblzma_la-tuklib_physmem.lo `test -f '../../src/common/tuklib_physmem.c' || echo './'`../../src/common/tuklib_physmem.c
libtool: compile: /opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -MT liblzma_la-tuklib_physmem.lo -MD -MP -MF .deps/liblzma_la-tuklib_physmem.Tpo -c ../../src/common/tuklib_physmem.c -o liblzma_la-tuklib_physmem.o
mv -f .deps/liblzma_la-tuklib_physmem.Tpo .deps/liblzma_la-tuklib_physmem.Plo
/bin/bash ../../libtool --tag=CC --mode=compile /opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c -o liblzma_la-common.lo `test -f 'common/common.c' || echo './'`common/common.c
libtool: compile: /opt/ndk/arm-linux-androideabi-4.4.3/bin/arm-linux-androideabi-gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/liblzma/api -I../../src/liblzma/common -I../../src/liblzma/check -I../../src/liblzma/lz -I../../src/liblzma/rangecoder -I../../src/liblzma/lzma -I../../src/liblzma/delta -I../../src/liblzma/simple -I../../src/common -DTUKLIB_SYMBOL_PREFIX=lzma_ -pthread -fvisibility=hidden -Wall -Wextra -Wvla -Wformat=2 -Winit-self -Wmissing-include-dirs -Wstrict-aliasing -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wredundant-decls -g -O2 -MT liblzma_la-common.lo -MD -MP -MF .deps/liblzma_la-common.Tpo -c common/common.c -o liblzma_la-common.o
In file included from common/common.c:13:
common/common.h:92: error: expected ';', ',' or ')' before 'in'
common/common.h:135: error: expected specifier-qualifier-list before 'lzma_code_function'
common/common.h:238: error: expected ';', ',' or ')' before 'in'
common/common.c:73: error: expected ';', ',' or ')' before 'in'
common/common.c: In function 'lzma_next_filter_update':
common/common.c:114: error: 'lzma_next_coder' has no member named 'update'
common/common.c:115: error: 'lzma_next_coder' has no member named 'update'
common/common.c: In function 'lzma_next_end':
common/common.c:126: error: 'lzma_next_coder' has no member named 'end'
common/common.c:127: error: 'lzma_next_coder' has no member named 'end'
common/common.c:133: error: unknown field 'code' specified in initializer
common/common.c:133: warning: initialization makes integer from pointer without a cast
common/common.c:133: warning: initialized field overwritten
common/common.c:133: warning: (near initialization for '(anonymous).init')
common/common.c:133: warning: initialized field overwritten
common/common.c:133: warning: (near initialization for '(anonymous).init')
common/common.c:133: error: unknown field 'end' specified in initializer
common/common.c:133: warning: excess elements in struct initializer
common/common.c:133: warning: (near initialization for '(anonymous)')
common/common.c:133: error: unknown field 'get_check' specified in initializer
common/common.c:133: warning: excess elements in struct initializer
common/common.c:133: warning: (near initialization for '(anonymous)')
common/common.c:133: error: unknown field 'memconfig' specified in initializer
common/common.c:133: warning: excess elements in struct initializer
common/common.c:133: warning: (near initialization for '(anonymous)')
common/common.c:133: error: unknown field 'update' specified in initializer
common/common.c:133: warning: excess elements in struct initializer
common/common.c:133: warning: (near initialization for '(anonymous)')
common/common.c: In function 'lzma_strm_init':
common/common.c:156: error: unknown field 'code' specified in initializer
common/common.c:156: warning: initialization makes integer from pointer without a cast
common/common.c:156: warning: initialized field overwritten
common/common.c:156: warning: (near initialization for '(anonymous).init')
common/common.c:156: warning: initialized field overwritten
common/common.c:156: warning: (near initialization for '(anonymous).init')
common/common.c:156: error: unknown field 'end' specified in initializer
common/common.c:156: warning: excess elements in struct initializer
common/common.c:156: warning: (near initialization for '(anonymous)')
common/common.c:156: error: unknown field 'get_check' specified in initializer
common/common.c:156: warning: excess elements in struct initializer
common/common.c:156: warning: (near initialization for '(anonymous)')
common/common.c:156: error: unknown field 'memconfig' specified in initializer
common/common.c:156: warning: excess elements in struct initializer
common/common.c:156: warning: (near initialization for '(anonymous)')
common/common.c:156: error: unknown field 'update' specified in initializer
common/common.c:156: warning: excess elements in struct initializer
common/common.c:156: warning: (near initialization for '(anonymous)')
common/common.c: In function 'lzma_code':
common/common.c:180: error: 'lzma_next_coder' has no member named 'code'
common/common.c:253: error: 'lzma_next_coder' has no member named 'code'
common/common.c: In function 'lzma_get_check':
common/common.c:331: error: 'lzma_next_coder' has no member named 'get_check'
common/common.c:334: error: 'lzma_next_coder' has no member named 'get_check'
common/common.c: In function 'lzma_memusage':
common/common.c:345: error: 'lzma_next_coder' has no member named 'memconfig'
common/common.c:346: error: 'lzma_next_coder' has no member named 'memconfig'
common/common.c: In function 'lzma_memlimit_get':
common/common.c:362: error: 'lzma_next_coder' has no member named 'memconfig'
common/common.c:363: error: 'lzma_next_coder' has no member named 'memconfig'
common/common.c: In function 'lzma_memlimit_set':
common/common.c:380: error: 'lzma_next_coder' has no member named 'memconfig'
common/common.c:386: error: 'lzma_next_coder' has no member named 'memconfig'
make[4]: *** [liblzma_la-common.lo] Error 1
make[4]: Leaving directory `/home/rb/Drivers/xz-5.0.5/src/liblzma'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/rb/Drivers/xz-5.0.5/src/liblzma'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rb/Drivers/xz-5.0.5/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rb/Drivers/xz-5.0.5'
make: *** [all] Error 2
このエラーの原因、さらに重要なことに、どのように解決できるのかわかりません。これらのエラーを検索しましたが、解決策が見つかりませんでした。私にとっては、ソース コードの common/common.c ファイルの間違いのように思えますが、他の誰かが間違いなく以前に見つけたはずなので、これは非常にありそうもないことだと思います。Android NDK の XZ Utils を正しくコンパイルする方法を知っている人はいますか?
更新 ライブラリをコンパイルしましたが、上記の手順の何が問題なのかまだわかりません。コンパイルは、メイクファイルを次のように構成することで機能しました
./configure --prefix=/home/rb/Drivers/xz --host=arm-linux-androideabi --target=arm-linux-androideabi --enable-static --with-pic --disable-xz --disable-xzdec --disable-lzmainfo --disable-scripts --disable-lzmadec --disable-shared
コマンドの代わりに、make
コマンドを直接使用しましたmake install
(同じコンパイラパスを使用)。