android NDK 问题

R小菜鸟R 2013-03-11 01:57:22
各位大神们 小弟最近研究android NDK 在编译apv的pdfview2.so时候出现问题如下:
环境是win7 + cygwin ;相应的libfreetype.a和头文件都已经导入到jni下的对应目录里。需要的LOCAL_STATIC_LIBRARIES := mupdf fitz mupdf fitzdraw jpeg这些static lib都对应生成了。

错误提示 找不到freetype这个库,我不知道是cygwin路径问题还是什么,都放到对应的地方了 怎么还找不到呢?
//----------------------------------------------------------------------
SharedLibrary : libpdfview2.so
E:/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: error: cannot find -lfreetype

//----------------------------------------------------------------------
这是android.mk的内容
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

# $(LOCAL_PATH)/include/cairo
# -lcairo -lpixman-1 -

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mupdf/fitz $(LOCAL_PATH)/../mupdf/mupdf $(LOCAL_PATH)/include
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -lz -llog -L$(LOCAL_PATH)/lib -lfreetype
#out/apps/pdfview2/libpng.a
LOCAL_STATIC_LIBRARIES := mupdf fitz mupdf fitzdraw jpeg
LOCAL_MODULE := pdfview2
LOCAL_SRC_FILES := pdfview2.c

include $(BUILD_SHARED_LIBRARY)
//-------------------------------------------------------------------------------



以下是对freetype的congfigure信息。
$ ./configure --prefix="/target/dir" --host=arm-linux --disable-shared --enable-static
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler cc
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,
or `make refdoc' to build the API reference (the latter needs python).

Generating modules list in ./objs/ftmodule.h...
* module: truetype (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1 (Postscript font files with extension *.pfa or *.pfb)
* module: cff (OpenType fonts with extension *.otf)
* module: cid (Postscript CID-keyed fonts, no known extension)
* module: pfr (PFR/TrueDoc font files with extension *.pfr)
* module: type42 (Type 42 font files with no known extension)
* module: winfnt (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf (pcf bitmap fonts)
* module: bdf (bdf bitmap fonts)
* module: sfnt (helper module for TrueType & OpenType formats)
* module: autofit (automatic hinting module)
* module: pshinter (Postscript hinter module)
* module: raster (monochrome bitmap renderer)
* module: smooth (anti-aliased bitmap renderer)
* module: smooth (anti-aliased bitmap renderer for LCDs)
* module: smooth (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux (Postscript Type 1 & Type 2 helper module)
* module: psnames (Postscript & Unicode Glyph name handling)
done.
cd builds/unix; ./configure '--prefix=/target/dir' '--host=arm-linux' '--disable-shared' '--enable-static'
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking build system type... i686-pc-cygwin
checking host system type... arm-unknown-linux-gnu
checking for arm-linux-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for rm... rm -f
checking for rmdir... rmdir
checking for a BSD-compatible install... /usr/bin/install -c
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking size of int... 4
checking size of long... 4
checking cpp computation of bit length in ftconfig.in works... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether munmap is declared... yes
checking for munmap's first parameter type... void *
checking for memcpy... yes
checking for memmove... yes
checking for gzsetparams in -lz... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/i686-pc-cygwin/bin/ld.exe
checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm-linux-dumpbin... no
checking for arm-linux-link... no
checking for dumpbin... no
checking for link... link -dump -symbols
checking the name lister (link -dump -symbols) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 8192
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/i686-pc-cygwin/bin/ld.exe option to reload object files... -r
checking for arm-linux-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm-linux-ar... no
checking for ar... ar
checking for arm-linux-strip... no
checking for strip... strip
checking for arm-linux-ranlib... no
checking for ranlib... ranlib
checking command to parse link -dump -symbols output from gcc object... failed
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... no
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
configure: creating ./config.status
config.status: creating unix-cc.mk
config.status: creating unix-def.mk
config.status: creating freetype-config
config.status: creating freetype2.pc
config.status: creating ftconfig.h
config.status: executing libtool commands
在make之后freetype的目录下也objs/.libs/也有对应的libfreetype.a
这是什么原因呢? 求大神们指点下,刚接触比较菜。
多谢各位。

...全文
374 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
BeN--lph 2014-03-04
  • 打赏
  • 举报
回复
引用 2 楼 lsk0372 的回复:
编译器的问题,android下的程序用c完成后必须用ndk-build来编译,它所需要的任何库也必须用其来编译,但是你缺少的libfreetype.so是用gcc编译完成的,所以它不识别
那我想请问一下我要把这个.so库也编译了要怎么做啊?
lsk0372 2013-03-12
  • 打赏
  • 举报
回复
引用 3 楼 RrMoon 的回复:
引用 2 楼 lsk0372 的回复:编译器的问题,android下的程序用c完成后必须用ndk-build来编译,它所需要的任何库也必须用其来编译,但是你缺少的libfreetype.so是用gcc编译完成的,所以它不识别 兄弟。。一句惊醒梦中人啊。。多谢了
太客气了,呵呵,楼主给分就行
R小菜鸟R 2013-03-11
  • 打赏
  • 举报
回复
引用 2 楼 lsk0372 的回复:
编译器的问题,android下的程序用c完成后必须用ndk-build来编译,它所需要的任何库也必须用其来编译,但是你缺少的libfreetype.so是用gcc编译完成的,所以它不识别
兄弟。。一句惊醒梦中人啊。。多谢了
lsk0372 2013-03-11
  • 打赏
  • 举报
回复
编译器的问题,android下的程序用c完成后必须用ndk-build来编译,它所需要的任何库也必须用其来编译,但是你缺少的libfreetype.so是用gcc编译完成的,所以它不识别
R小菜鸟R 2013-03-11
  • 打赏
  • 举报
回复
自己顶一个 求大神关注下

80,352

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧