You are here Android > 开发者 > 开发讨论 > 急!! 请高手解惑:Cygwin+NDK,make APP报错,无法生成.so

机器人


93.089%

disconnected
登录后回复主题 | 跳到回复(1)

急!! 请高手解惑:Cygwin+NDK,make APP报错,无法生成.so

... by 机器人 ... 29 月 9 天前 ... 1083 次点击

Cygwin安装在C盘根目录下;
NDK版本:1.6,在E盘;

在Cygwin下make范例Hello-jni,未果。
具体报错如下:
$ make APP=hello-jni
Android NDK: Building for application 'hello-jni'
Compile thumb??: hello-jni <= apps/hello-jni/project/jni/hello-jni.c
SharedLibrary??: libhello-jni.so
arm-eabi-gcc: C:/cygwin/cygdrive/e/Android/My.Platform/android-ndk-1.6_r1-windows/build/prebuilt/windows/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a: No such file or directory
make: *** [out/apps/hello-jni//libhello-jni.so] Error 1

跟踪下来发现:
直接输入下列命令行可以生成libsanangeles.so:
build/prebuilt/windows/arm-eabi-4.2.1/bin/arm-eabi-gcc -nostdlib -Wl,-soname,libsanangeles.so -Wl,-shared,-Bsymbolic??out/apps/san-angeles//objs/sanangeles/importgl.o out/apps/san-angeles//objs/sanangeles/demo.o out/apps/san-angeles//objs/sanangeles/app-android.o -Wl,--whole-archive??-Wl,--no-whole-archive? ?build/platforms/android-4/arch-arm/usr/lib/libc.so build/platforms/android-4/arch-arm/usr/lib/libstdc++.so build/platforms/android-4/arch-arm/usr/lib/libm.so? ?-Wl,--no-undefined -Lbuild/platforms/android-4/arch-arm/usr/lib -lGLESv1_CM -ldl -llog -Wl,-rpath-link=build/platforms/android-4/arch-arm/usr/lib /cygdrive/e/Android/My.Platform/android-ndk-1.6_r1-windows/build/prebuilt/windows/arm-eabi-4.2.1/bin/../lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a -o out/apps/san-angeles//libsanangeles.so

但是一旦该命令包含在.mk中用make操作,参数/cygdrive/e/Android/My.Platform/android-ndk-1.6_r1-windows...... 就会被转换为:C:/cygwin/cygdrive/e/Android/My.Platform/android-ndk-1.6_r1-windows......,
随即报错:arm-eabi-gcc: C:/cygwin/cygdrive/e/Android/My.Platform/android-ndk-1.6_r1-windows/build/prebuilt/windows/arm-eabi-4.2.1/lib/gcc/arm-eabi/4.2.1/interwork/libgcc.a: No such file or directory。

请高手指点如何解决此问题?为什么会自动在参数前面加上:C:/cygwin?

1 - 2011-2-23 14:16
heihei1252 地球
参考一下吧:

It's because the new Windows toolchain doesn't support Cygwin's drive
mapping (i.e. /cygdrive/c/ instead of C:/)
There is however a new function, called host-path, that you can use to
perform the translation from cygwin to windows,


you should call it as:


$(call host-path,<your-path>)


Note that this is a temporary measure. A future release of the NDK will
completely get rid of Cygwin (but host-path will still be provided and will
be a no-op).


Final note, host-path is automatically applied to the content of
LOCAL_C_INCLUDES (and LOCAL_EXPORT_C_INCLUDES). This is not the case for
LOCAL_CFLAGS or LOCAL_CPPFLAGS


On Fri, Dec 10, 2010 at 10:08 AM, lifelessonline <lifelessonl...@hotmail.com




- 隐藏被引用文字 -
- 显示引用的文字 -

> wrote:

> Hi all,


> I have a project that I have been successfully compiling with ndk r4.
> I just got my NDK r5 and it is having some troubles finding one of my
> precompiled libraries.


> This is the message ndk-build gives:


> --------------------------------------------------------------
> $ ndk-build
> SharedLibrary : libMYLIB.so
> arm-linux-androideabi-g++.exe: /cygdrive/d/Development/MyProject/build/
> Android/jni/MyProject/Externals/precompiled/lib/Android/precompiled.a:
> No such file or directory
> make: *** [/cygdrive/d/Development/MyProject/build/Android/obj/local/
> armeabi/libMYLIB.so] Error 1
> --------------------------------------------------------------


> And this is the relevant portion of the makefile:


> --------------------------------------------------------------
> LOCAL_LDLIBS := \
> -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib \
> -L$(MYPROJECTS)/Externals/precompiled/lib/Android \
> -llog -lz -ldl -lgcc -lprecompiled



First, the -L$(NDK_PLATFORMS_ROOT)/$(TARGET_PLATFORM)/arch-arm/usr/lib is
not needed.
Second, you can replace the second line with:

-L$(call host-path,$(MYPROJECTS)/Externals/precompiled/lib/Android) \


Note that NDK r5 now supports prebuilt libraries and module import. They are
probably a better way to achieve what you need here, since you have
precompiled stuff.
看完之后有话想说?那就帮楼主加盖一层吧!

在回复之前你需要先进行登录
电子邮件或昵称
密码
当前热门主题  有谁想学习利用ksoap2连接webService远程接口吗? ... 12 篇回复
© 2009 A Nanshapo Production   -   About
a site powered by Project Babel