交叉编译Freetype 2.5.3 for Android

交叉编译Freetype 2.5.3 for Android,第1张

概述我正在尝试交叉编译Freetype 2.5.3,所以我可以将它用于我的 Android NDK Opengl ES 2项目,但我不知道该怎么做.我在Windows上使用Cygwin.我已经搜索并阅读了很多关于它的内容,但我仍然需要帮助. 我在cygwin中导出了一些标志: $export NDK_TOOLCHAIN=/cygdrive/d/Development/Android/ndk-stand 我正在尝试交叉编译Freetype 2.5.3,所以我可以将它用于我的 Android NDK Opengl ES 2项目,但我不知道该怎么做.我在windows上使用Cygwin.我已经搜索并阅读了很多关于它的内容,但我仍然需要帮助.

我在cygwin中导出了一些标志:

$export NDK_TOolCHAIN=/cygdrive/d/Development/AndroID/ndk-standalone-15$export PATH="$NDK_TOolCHAIN/bin/:$PATH"$export HOST=arm-linux-androIDeabi$export CC=$HOST-gcc$export CXX=$HOST-g++$export AR=$HOST-ar$export LD=$HOST-ld$export AS=$HOST-as$export NM=$HOST-nm$export STRIP=$HOST-strip$export RANliB=$HOST-ranlib$export OBJDUMP=$HOST-objdump$export CPPFLAGS="--sysroot=$NDK_TOolCHAIN/sysroot -I$NDK_TOolCHAIN/sysroot/usr/include -I$NDK_TOolCHAIN/include"$export LDFLAGS="-L$NDK_TOolCHAIN/sysroot/usr/lib -L$NDK_TOolCHAIN/lib"

然后我尝试交叉编译freetype:

$./configure --with-sysroot=/cygdrive/d/Development/AndroID/ndk-standalone-15/sysroot --host=$HOST --prefix=/ft2tmp --build=$BUILD --without-zlib --with-png=no

但是我收到了一个错误:

FreeType build system — automatic system detection

The following settings are used:

platform unix compiler
arm-linux-androIDeabi-gcc configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk

If this does not correspond to your system or settings please remove
the file `config.mk’ from this directory then read the INSTALL file
for help.

Otherwise,simply type make' again to build the library,ormake
refdoc’ to build the API reference (the latter needs python).

cd builds/unix; /bin/sh ./configure
‘–with-sysroot=/cygdrive/d/Development/AndroID/ndk-standalone-15/sysroot’
‘–host=arm-linux-androIDeabi’ ‘–prefix=/ft2tmp’ ‘–build=’
‘–without-zlib’ ‘–with-png=no’ checking build system type…
x86_64-unkNown-cygwin checking host system type…
arm-unkNown-linux-androIDeabi checking for
arm-linux-androIDeabi-gcc… arm-linux-androIDeabi-gcc checking
whether the C compiler works… no configure: error: in
/cygdrive/d/Development/tmp/freetype2/builds/unix': configure: error:
C compiler cannot create executables
See
config.log’ for more details
builds/unix/detect.mk:86: recipe for target ‘setup’ Failed make: *
[setup] Error 77

一些config.log文件:

gcc version 4.8 (GCC) configure:2925: $? = 0 configure:2914:
arm-linux-androIDeabi-gcc -V >&5 arm-linux-androIDeabi-gcc.exe: error:
unrecognized command line option ‘-V’ arm-linux-androIDeabi-gcc.exe:
Fatal error: no input files compilation terminated. configure:2925: $?
= 1 configure:2914: arm-linux-androIDeabi-gcc -qversion >&5 arm-linux-androIDeabi-gcc.exe: error: unrecognized command line option
‘-qversion’ arm-linux-androIDeabi-gcc.exe: Fatal error: no input files
compilation terminated. configure:2925: $? = 1 configure:2945:
checking whether the C compiler works configure:2967:
arm-linux-androIDeabi-gcc
–sysroot=/cygdrive/d/Development/AndroID/ndk-standalone-15//sysroot -I/cygdrive/d/Development/AndroID/ndk-standalone-15//sysroot/usr/include
-I/cygdrive/d/Development/AndroID/ndk-standalone-15//include -L/cygdrive/d/Development/AndroID/ndk-standalone-15//sysroot/usr/lib -L/cygdrive/d/Development/AndroID/ndk-standalone-15//lib conftest.c >&5 d:/development/androID/ndk-standalone-15/bin/../lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld.exe:
error: cannot open crtbegin_dynamic.o: No such file or directory
d:/development/androID/ndk-standalone-15/bin/../lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld.exe:
error: cannot open crtend_androID.o: No such file or directory
d:/development/androID/ndk-standalone-15/bin/../lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld.exe:
error: cannot find -lc
d:/development/androID/ndk-standalone-15/bin/../lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld.exe:
error: cannot find -ldl collect2.exe: error: ld returned 1 exit status
configure:2971: $? = 1 configure:3009: result: no configure: Failed

所以我的问题是我该如何正确地做到这一点?

编辑:

我在CPPFLAGS和LDFLAGS上使用了unset,并使用带有–with-sysroot标志的./configure,现在它正常运行.
接下来的问题是,当我使用时

make

我收到以下错误:

$make ./builds/unix/libtool –mode=compile arm-linux-androIDeabi-gcc
-pedantic -ansi -I/cygdrive/d/Development/tmp/freetype2/obJs -I./builds/unix -I/cygdrive/d/Development/tmp/freetype2/include -c -Wall -g -O2 -DFT_CONfig_OPTION_SYstem_ZliB -DFT_CONfig_CONfig_H=”” -DFT2_BUILD_liBRARY -DFT_CONfig_MODulES_H=”” -o /cygdrive/d/Development/tmp/freetype2/obJs/ftsystem.lo
/cygdrive/d/Development/tmp/freetype2/src/base/ftsystem.c libtool:
compile: arm-linux-androIDeabi-gcc -pedantic -ansi
-I/cygdrive/d/Development/tmp/freetype2/obJs -I./builds/unix -I/cygdrive/d/Development/tmp/freetype2/include -c -Wall -g -O2 -DFT_CONfig_OPTION_SYstem_ZliB “-DFT_CONfig_CONfig_H=” -DFT2_BUILD_liBRARY “-DFT_CONfig_MODulES_H=” /cygdrive/d/Development/tmp/freetype2/src/base/ftsystem.c -fPIC -DPIC
-o /cygdrive/d/Development/tmp/freetype2/obJs/.libs/ftsystem.o arm-linux-androIDeabi-gcc.exe: error:
/cygdrive/d/Development/tmp/freetype2/src/base/ftsystem.c: No such
file or directory arm-linux-androIDeabi-gcc.exe: Fatal error: no input
files compilation terminated.
/cygdrive/d/Development/tmp/freetype2/builds/freetype.mk:207: recipe
for target ‘/cygdrive/d/Development/tmp/freetype2/obJs/ftsystem.lo’
Failed make: *
[/cygdrive/d/Development/tmp/freetype2/obJs/ftsystem.lo] Error 1

解决方法 您必须设置windows样式路径,提供freetype2所在的位置.以下是如何在windows环境路径中包含您在 Android中用于开发的库和文件.您需要为 freetype2做同样的事情.

您可能会发现检查这些引用很有用:

> Android NDK Cross-Compile Setup (libpng and freetype)
> OpenGL Programming/Installation/Android NDK
> Setting up Native OpenGL ES* on Android* Platforms
> Calling OpenGL from C on Android,Using the NDK

您可能会观察到,开发AndroID应用程序的大部分最佳material都在linux上:

如果您对AndroID开发非常认真,那么考虑将您的开发转移到linux平台是值得的.

您还应该看一下OpenGL Getting Started,它提供了有关如何在Linux,windows和MacOS上使用OpenGL的几个教程.采用温和的step by step方法可以更有效地成功提高您的OpenGL开发技能.

总结

以上是内存溢出为你收集整理的交叉编译Freetype 2.5.3 for Android全部内容,希望文章能够帮你解决交叉编译Freetype 2.5.3 for Android所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1135999.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存