0

上一个问题的后续问题 -编译 ICS/JB 相机应用程序 - 本机库 jni-mosaic 错误

我一直在尝试从CyanogenMod 源构建 ICS 相机应用程序。我在 Windows 7 上,UAC 关闭。使用 Cygwin 和最新的 Android NDK。

在工作区上尝试了 chmod -R 777 ,将NDK_TOOLCHAIN_VERSION := 4.4.3and添加LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog到我的Android.mk文件中,但无论我做什么,我仍然收到此错误:

Compile++ thumb  : jni_mosaic <= feature_mos_jni.cpp
In file included from jni/feature_mos_jni.cpp:21:0:
C:/android-ndk/platforms/android-14/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4
Compile++ thumb  : jni_mosaic <= mosaic_renderer_jni.cpp
In file included from jni/mosaic_renderer_jni.cpp:19:0:
C:/android-ndk/platforms/android-14/arch-arm/usr/include/jni.h:592:13: note: the mangling of 'va_list' has changed in GCC 4.4
Compile++ thumb  : jni_mosaic <= trsMatrix.cpp
Compile++ thumb  : jni_mosaic <= AlignFeatures.cpp
Compile++ thumb  : jni_mosaic <= Blend.cpp
Compile++ thumb  : jni_mosaic <= Delaunay.cpp
Compile++ thumb  : jni_mosaic <= ImageUtils.cpp
Compile++ thumb  : jni_mosaic <= Mosaic.cpp
Compile++ thumb  : jni_mosaic <= Pyramid.cpp
Compile++ thumb  : jni_mosaic <= Renderer.cpp
Compile++ thumb  : jni_mosaic <= WarpRenderer.cpp
Compile++ thumb  : jni_mosaic <= SurfaceTextureRenderer.cpp
Compile++ thumb  : jni_mosaic <= YVURenderer.cpp
Compile++ thumb  : jni_mosaic <= FrameBuffer.cpp
Compile++ thumb  : jni_mosaic <= db_feature_detection.cpp
Compile++ thumb  : jni_mosaic <= db_feature_matching.cpp
Compile++ thumb  : jni_mosaic <= db_framestitching.cpp
Compile++ thumb  : jni_mosaic <= db_image_homography.cpp
Compile++ thumb  : jni_mosaic <= db_rob_image_homography.cpp
Compile++ thumb  : jni_mosaic <= db_utilities.cpp
Compile++ thumb  : jni_mosaic <= db_utilities_camera.cpp
Compile++ thumb  : jni_mosaic <= db_utilities_indexing.cpp
Compile++ thumb  : jni_mosaic <= db_utilities_linalg.cpp
Compile++ thumb  : jni_mosaic <= db_utilities_poly.cpp
Compile++ thumb  : jni_mosaic <= dbreg.cpp
Compile++ thumb  : jni_mosaic <= dbstabsmooth.cpp
Compile thumb  : jni_mosaic <= vp_motionmodel.c
SharedLibrary  : libjni_mosaic.so
./obj/local/armeabi/objs/jni_mosaic/mosaic_renderer_jni.o: In function `checkGLErrorDetail(char const*, int, char const*)':
D:\CMCam/jni/mosaic_renderer_jni.cpp:195: undefined reference to `glGetError'
./obj/local/armeabi/objs/jni_mosaic/mosaic_renderer_jni.o: In function `checkFramebufferStatus(char const*)':
D:\CMCam/jni/mosaic_renderer_jni.cpp:177: undefined reference to `glCheckFramebufferStatus'
./obj/local/armeabi/objs/jni_mosaic/mosaic_renderer_jni.o: In function `bindSurfaceTexture(unsigned int)':
D:\CMCam/jni/mosaic_renderer_jni.cpp:211: undefined reference to `glBindTexture'
D:\CMCam/jni/mosaic_renderer_jni.cpp:215: undefined reference to `glTexParameterf'
D:\CMCam/jni/mosaic_renderer_jni.cpp:217: undefined reference to `glTexParameterf'
D:\CMCam/jni/mosaic_renderer_jni.cpp:220: undefined reference to `glTexParameteri'
D:\CMCam/jni/mosaic_renderer_jni.cpp:222: undefined reference to `glTexParameteri'
./obj/local/armeabi/objs/jni_mosaic/mosaic_renderer_jni.o: In function `Java_com_android_camera_MosaicRenderer_init':
D:\CMCam/jni/mosaic_renderer_jni.cpp:528: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/mosaic_renderer_jni.cpp:530: undefined reference to `glGenTextures'
./obj/local/armeabi/objs/jni_mosaic/mosaic_renderer_jni.o: In function `Java_com_android_camera_MosaicRenderer_transferGPUtoCPU':
D:\CMCam/jni/mosaic_renderer_jni.cpp:695: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/mosaic_renderer_jni.cpp:703: undefined reference to `glReadPixels'
D:\CMCam/jni/mosaic_renderer_jni.cpp:708: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/mosaic_renderer_jni.cpp:716: undefined reference to `glReadPixels'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/Renderer.o: In function `Renderer::loadShader(unsigned int, char const*)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:39: undefined reference to `glCreateShader'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:41: undefined reference to `glShaderSource'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:42: undefined reference to `glCompileShader'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:44: undefined reference to `glGetShaderiv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:47: undefined reference to `glGetShaderiv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:51: undefined reference to `glGetShaderInfoLog'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:56: undefined reference to `glDeleteShader'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/Renderer.o: In function `Renderer::createProgram(char const*, char const*)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:78: undefined reference to `glCreateProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:81: undefined reference to `glAttachShader'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:83: undefined reference to `glAttachShader'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:86: undefined reference to `glLinkProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:88: undefined reference to `glGetProgramiv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:95: undefined reference to `glGetProgramiv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:106: undefined reference to `glDeleteProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:101: undefined reference to `glGetProgramInfoLog'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/Renderer.o: In function `Renderer::SetupGraphics(int, int)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:126: undefined reference to `glUseProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:129: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:135: undefined reference to `glViewport'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/Renderer.o: In function `Renderer::SetupGraphics(FrameBuffer*)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:157: undefined reference to `glUseProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:160: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:166: undefined reference to `glViewport'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/Renderer.o: In function `Renderer::Clear(float, float, float, float)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:185: undefined reference to `glClearColor'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/Renderer.cpp:186: undefined reference to `glClear'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/WarpRenderer.o: In function `WarpRenderer::InitializeGLProgram()':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:101: undefined reference to `glDeleteProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:82: undefined reference to `glUseProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:86: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:87: undefined reference to `glGetUniformLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:88: undefined reference to `glGetUniformLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:89: undefined reference to `glGetUniformLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:90: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:93: undefined reference to `glGetUniformLocation'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/WarpRenderer.o: In function `WarpRenderer::DrawTexture(float*)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:119: undefined reference to `glDisable'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:121: undefined reference to `glActiveTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:125: undefined reference to `glBindTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:129: undefined reference to `glUniform1i'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:133: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:137: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:139: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:140: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:143: undefined reference to `glUniformMatrix4fv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:144: undefined reference to `glUniformMatrix4fv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:145: undefined reference to `glUniformMatrix4fv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:148: undefined reference to `glDrawElements'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp:152: undefined reference to `glBindFramebuffer'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.o: In function `SurfaceTextureRenderer::InitializeGLProgram()':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:110: undefined reference to `glDeleteProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:92: undefined reference to `glUseProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:95: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:97: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:99: undefined reference to `glGetUniformLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:101: undefined reference to `glGetUniformLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:103: undefined reference to `glPixelStorei'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.o: In function `SurfaceTextureRenderer::DrawTexture(float*)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:128: undefined reference to `glDisable'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:130: undefined reference to `glActiveTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:134: undefined reference to `glBindTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:137: undefined reference to `glUniformMatrix4fv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:138: undefined reference to `glUniformMatrix4fv'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:142: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:143: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:146: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:147: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:150: undefined reference to `glDrawElements'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp:152: undefined reference to `glBindFramebuffer'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/YVURenderer.o: In function `YVURenderer::InitializeGLProgram()':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:70: undefined reference to `glDeleteProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:54: undefined reference to `glUseProgram'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:58: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:59: undefined reference to `glGetAttribLocation'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:62: undefined reference to `glGetUniformLocation'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/YVURenderer.o: In function `YVURenderer::DrawTexture()':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:88: undefined reference to `glDisable'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:90: undefined reference to `glActiveTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:94: undefined reference to `glBindTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:98: undefined reference to `glUniform1i'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:102: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:106: undefined reference to `glVertexAttribPointer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:108: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:109: undefined reference to `glEnableVertexAttribArray'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:112: undefined reference to `glDrawElements'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp:116: undefined reference to `glBindFramebuffer'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/FrameBuffer.o: In function `FrameBuffer::CreateBuffers()':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:72: undefined reference to `glGenFramebuffers'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:73: undefined reference to `glGenTextures'
./obj/local/armeabi/objs/jni_mosaic/feature_mos/src/mosaic_renderer/FrameBuffer.o: In function `FrameBuffer::Init(int, int, unsigned int)':
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:30: undefined reference to `glBindFramebuffer'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:31: undefined reference to `glBindTexture'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:41: undefined reference to `glTexImage2D'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:45: undefined reference to `glTexParameteri'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:46: undefined reference to `glTexParameteri'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:49: undefined reference to `glTexParameteri'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:50: undefined reference to `glTexParameteri'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:57: undefined reference to `glFramebufferTexture2D'
D:\CMCam/jni/feature_mos/src/mosaic_renderer/FrameBuffer.cpp:67: undefined reference to `glBindFramebuffer'
collect2: ld returned 1 exit status
/cygdrive/c/android-ndk/build/core/build-binary.mk:378: recipe for target `obj/local/armeabi/libjni_mosaic.so' failed
make: *** [obj/local/armeabi/libjni_mosaic.so] Error 1

将不胜感激任何帮助!

4

1 回答 1

5

为了更好地理解 NDK 如何解释你的Android.mk,你可以运行

ndk-build V=1

这将回显所有执行的命令,包括编译和链接,以及 NDK 构建分配的所有参数。

通常,NDK 会包含目录C:/android-ndk/platforms/android-14/arch-arm/usr/lib/。如果出于某种原因未在链接命令行上指定此路径(请参见上面的V=1),则应LOCAL_LDLIBS手动添加它。

LOCAL_LDLIBS += C:/android-ndk/platforms/android-14/arch-arm/usr/lib

cyanogen tree 中的 make 文件没有为ndk-build. 它不使用打包在 NDK 中的预构建系统库,而是引用预期在lunchbrunch. 这就是为什么它有这条线

LOCAL_SHARED_LIBRARIES := liblog libnativehelper libGLESv2

你不建树;因此,这些库不是本地的。但是,您必须将它们全部提供给链接器:

LOCAL_LDLIBS += -llog -lnativehelper -lGLESv2

不幸的是,NDK 只提供了两个。libnativehelper.so不是公共 API 的一部分。这意味着理论上,你不应该依赖它。但实际上,这个库存在于所有设备上,并且它的界面非常稳定。

您可以从您的设备中提取此二进制文件,甚至可以使用命令从模拟器中提取此二进制文件

adb pull /system/lib/libnativehelper.so C:/android-ndk/platforms/android-14/arch-arm/usr/lib
于 2012-10-28T21:08:37.523 回答