我正在尝试编译 fontconfig 到android我已经成功编译了所有的依赖项,但我在fontconfig编译时遇到了一个奇怪的错误:
这是我运行的命令:
TOOLCHAIN="$NDK/sysroot/usr/include/$HOST"
TOOLS="arm-linux-androideabi-4.9"
export PKG_CONFIG="$(which pkg-config)"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
export CPP="${CROSS_PREFIX}cpp"
export CXX="${CROSS_PREFIX}g++"
export CC="${CROSS_PREFIX}gcc"
export LD="${CROSS_PREFIX}ld"
export AR="${CROSS_PREFIX}ar"
export NM="${CROSS_PREFIX}nm"
export RANLIB="${CROSS_PREFIX}ranlib"
export LDFLAGS="-L$PREFIX/lib -L$SYSROOT/usr/lib -L$NDK/sysroot/usr/lib/$HOST -fPIE -pie --sysroot=$SYSROOT "
export CFLAGS="$OPTIMIZE_CFLAGS -I$PREFIX/include -I$NDK/sysroot/usr/include -I$TOOLCHAIN -fPIE "
export CXXFLAGS="$CFLAGS "
export CPPFLAGS="-I$PREFIX/include -I$NDK/sysroot/usr/include -I$TOOLCHAIN --sysroot=$SYSROOT "
export STRIP=${CROSS_PREFIX}strip
export PATH="$PATH:$PREFIX/bin:$NDK/build:${PREBUILT_TOOLCHAIN}/bin"
export CROSS_SYSROOT="${SYSROOT}"
./configure PKG_CONFIG="$(which pkg-config)" PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig" \
--prefix=$PREFIX \
--host=$HOST \
--with-arch=$ARCH\
--with-sysroot=$SYSROOT \
--with-pic \
--disable-libxml2 \
--disable-iconv \
--enable-static \
--disable-shared \
--disable-docs \
--disable-nls \
--disable-rpath
make clean
make -j8
make install
错误是:
CCLD libfontconfig.la
libtool: warning: library '/home/rafa/Desktop/m3/build_dir/lib/libfreetype.la' was moved.
/bin/grep: /home/rafa/Desktop/missao/ndk17/platforms/android-27/arch-arm/home/rafa/Desktop/m3/build_dir/lib/libpng12.la: No such file or directory
/bin/sed: can't read /home/rafa/Desktop/missao/ndk17/platforms/android-27/arch-arm/home/rafa/Desktop/m3/build_dir/lib/libpng12.la: No such file or directory
libtool: error: '/home/rafa/Desktop/missao/ndk17/platforms/android-27/arch-arm/home/rafa/Desktop/m3/build_dir/lib/libpng12.la' is not a valid libtool archive
Makefile:596: recipe for target 'libfontconfig.la' failed
找不到/home/rafa/Desktop/missao/ndk17/platforms/android-27/arch-arm/home/rafa/Desktop/m3/build_dir/lib/libpng12.la
什么是真的,因为这个目录不存在,正确的目录是:/home/rafa/Desktop/m3/build_dir/lib/libpng12.la
调用错误路径的文件libfreetype.la
具有以下行:
dependency_libs=' -L/home/rafa/Desktop/m3/build_dir/lib -L=/usr/lib -L/home/rafa/Desktop/missao/ndk17/sysroot/usr/lib/arm-linux-androideabi =/home/rafa/Desktop/m3/build_dir/lib/libpng12.la -L=/usr/lib -lz -lm'
我有两个问题:
- 如何修复此错误?
- 上述项目中的所有库都是使用类似的脚本构建的,为什么makefile会生成错误的libfreetype.la
以及如何在我的剧本中修复它?
答案 0 :(得分:0)
您是否尝试在./configure
之前设置LIBPNG_CFLAGS和LIBPNG_LIBS?它可以解决您的问题。
export LIBPNG_CFLAGS="/home/rafa/Desktop/m3/build_dir/include"
export LIBPNG_LIBS="/home/rafa/Desktop/m3/build_dir/lib"