3

所以我的 Android.mk 上有以下内容....

...
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include /Users/myname/Development/Android/android-ndk-r8c/platforms/android-14/arch-arm/usr/include
...
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog

但是,当我尝试运行 ndk-build 时,我得到以下信息......

/Users/myname/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/.. /../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): 在函数 GLES_CreateRenderer:jni/SDL/src/render/opengles /SDL_render_gles.c:189:错误:未定义对“glDisableClientState”collect2 的引用:ld 返回 1 个退出状态

这当然似乎是一个链接问题,但是,编译器工作得很好。我对为什么链接不起作用但编译会感到困惑。Anyonw知道我该如何解决它?

从 ndk-build V=1 >Build.log输出

更新:

好的,所以我正在使用这里找到的代码,这编译得很好,但是,我正在尝试升级到 PRBoom+,所以我从这里dl 代码并调整 Android.mk 以包含新类。完成此操作后,它似乎可以正常编译,但是无法正确链接。我看到有两个主要错误...

首先是涉及多个定义,但是,原始(编译链接良好)代码具有相同的多个定义....

/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/.. /../../../arm-linux-androideabi/bin/ld: 错误: ./obj/local/armeabi/objs-debug/prboom_jni/w_mmap.o: 'W_InitCache' 的多个定义

另一种类型是OpenGL问题......

/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/.. /../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): 在函数 GLES_ResetState:/Users/jackiegleason/Development/Code/ prboom4android-base/jni/SDL/src/render/opengles/SDL_render_gles.c:181:错误:未定义对“glDisable”的引用

如果我将所有内容复制回来(使用 prboom4android 代码),所有内容都可以编译和链接。

这是 2 个 Android.mk 文件的差异...

< LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include $(LOCAL_PATH)/MUSIC $(LOCAL_PATH)/MUSIC/include $(LOCAL_PATH)/TEXTSCREEN $(LOCAL_PATH)/TEXTSCREEN/include
---
> LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include
28c28
<   f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c i_capture.c \
---
>   f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c \
31,36c31,33
<   m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c s_advsound.c memio.c \
<   d_client.c i_video.c i_network.c i_system.c PCSOUND/pcsound.c PCSOUND/pcsound_sdl.c SDL/i_sshot.c \
<   i_main.c sc_man.c SDL/i_sound.c jni_doom.c mus2mid.c pcm2wav.c e6y.c SDL/i_joy.c \
<         r_screenmultiply.c hu_tracers.c i_smp.c g_overflow.c i_pcsound.c \
<         MUSIC/dbopl.c MUSIC/flplayer.c MUSIC/portmidiplayer.c MUSIC/midifile.c MUSIC/opl_queue.c MUSIC/vorbisplayer.c MUSIC/dumbplayer.c MUSIC/oplplayer.c MUSIC/madplayer.c MUSIC/opl.c \
<         TEXTSCREEN/txt_button.c TEXTSCREEN/txt_separator.c TEXTSCREEN/txt_gui.c TEXTSCREEN/txt_widget.c TEXTSCREEN/txt_checkbox.c TEXTSCREEN/txt_radiobutton.c TEXTSCREEN/txt_inputbox.c TEXTSCREEN/txt_spinctrl.c TEXTSCREEN/txt_window.c TEXTSCREEN/txt_desktop.c TEXTSCREEN/txt_scrollpane.c TEXTSCREEN/txt_io.c TEXTSCREEN/txt_strut.c TEXTSCREEN/txt_window_action.c TEXTSCREEN/txt_dropdown.c TEXTSCREEN/txt_sdl.c TEXTSCREEN/txt_label.c  TEXTSCREEN/txt_table.c 
---
>   m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c \
>   d_client.c i_video.c i_network.c i_system.c \
>   i_main.c i_sound.c jni_doom.c mmus2mid.c pcm2wav.c
4

1 回答 1

2

是的,我可以下载你的Build.log

您的构建使用APP_PLATFORM = android-3,它没有必要的 GL 库。您可以APP_PLATFORM = android-14Application.mk中设置,或者为您的 Android 项目设置目标平台(Eclipse 将更新project.properties文件)。

您不应在Android.mk中手动添加 android-14 包含。当您拥有正确的APP_PLATFORM时,将相应地调整包含路径。

于 2013-05-14T07:33:15.900 回答