在连接标志非系统库 [英] non-system libraries in linker flags

查看:521
本文介绍了在连接标志非系统库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完全工作的应用程序使用了一些C ++和OpenCV。编译和运行成功。现在我只是想整理我的code和更改删除所有的警告在编译时。但有一个警告,我不明白。这似乎是我的android.mk一个问题。

当我编译,控制台输出如下:

  6时58分21秒****配置默认的项目的议案增量构建****
C:\\的Andr​​oid NDK,R9C \\ NDK-build.cmd全
Android的NDK:警告:JNI / Android.mk:mixed_sample:在连接标志非系统库:-lopencv_java
机器人NDK:这很可能导致不正确的构建。尝试使用LOCAL_STATIC_LIBRARIES
Android的NDK:或LOCAL_SHARED_LIBRARIES来列出的库的依赖关系
Android的NDK:当前模块
[armeabi-V7A] ++编译大拇指:mixed_sample< = cpp_part.cpp
[armeabi-V7A] SharedLibrary:libmixed_sample.so
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/$p$pbuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe:警告:在隐藏符号'__aeabi_atexit C:/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o)被引用的DSO C:/opencv-2.4.8-android-sdk/sdk/native/jni /../库/ armeabi-V7A / libopencv_java.so
[armeabi-V7A]安装:libmixed_sample.so =>库/ armeabi-V7A / libmixed_sample.so

6点58分24秒生成成品(带2s.515ms)
 

我的android.mk如下:

  LOCAL_PATH:= $(叫我-DIR)

#与分析编译
LOCAL_CFLAGS:= -pg

包括$(CLEAR_VARS)

 OPENCV_CAMERA_MODULES:=关闭
 OPENCV_INSTALL_MODULES:=上
 OPENCV_LIB_TYPE:=共享

包括C:\ OpenCV的-2.4.8-Android的SDK / SDK /本地/ JNI / OpenCV.mk

LOCAL_MODULE:= mixed_sample
LOCAL_SRC_FILES:= cpp_part.cpp
LOCAL_LDLIBS + = -llog -ldl -lz

LOCAL_STATIC_LIBRARIES:=的Andr​​oid NDK,分析器

包括$(BUILD_SHARED_LIBRARY)

$(呼叫进口模块,Android的NDK廓)
 

我甚至不能工作,哪里出了-lopencv_java链接器标志的来源,它不会在任何地方android.mk出现。

任何想法?

编辑:在回应亚历克斯·科恩的提问。如果我添加$(资讯== $(OPENCV_INSTALL_MODULES)==)行中的preceding包括$(CLEAR_VARS),然后在控制台报告如下:

 八时39分34秒****配置默认的项目的议案增量构建****
C:\\的Andr​​oid NDK,R9C \\ NDK-build.cmd全
====
Android的NDK:警告:JNI / Android.mk:mixed_sample:在连接标志非系统库:-lopencv_java
机器人NDK:这很可能导致不正确的构建。尝试使用LOCAL_STATIC_LIBRARIES
Android的NDK:或LOCAL_SHARED_LIBRARIES来列出的库的依赖关系
Android的NDK:当前模块
[armeabi-V7A] ++编译大拇指:mixed_sample< = cpp_part.cpp
[armeabi-V7A] SharedLibrary:libmixed_sample.so
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/$p$pbuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe:警告:在隐藏符号'__aeabi_atexit C:/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o)被引用的DSO C:/opencv-2.4.8-android-sdk/sdk/native/jni /../库/ armeabi-V7A / libopencv_java.so
[armeabi-V7A]安装:libmixed_sample.so =>库/ armeabi-V7A / libmixed_sample.so

8点39分36秒生成成品(带2s.564ms)
 

解决方案

在你包括 OpenCV.mk,你必须确保 $( OPENCV_INSTALL_MODULES)等于。你有行 OPENCV_INSTALL_MODULES:在 Android.mk 文件,但由于某种原因它没有工作=。没有挖掘到所有可能的(不可能的)问题,一个简单的方法来解决这个问题是写

 覆盖OPENCV_INSTALL_MODULES:=上
 

Android.mk ;另 - 运行

  NDK-建立OPENCV_INSTALL_MODULES =上
 

这是命令行。

I have a fully working app employing some C++ and OpenCV. It compiles and runs successfully. Right now I am just trying to tidy my code and make changes to remove all warnings at compile time. But there is one warning I don't understand. It appears to be a problem with my android.mk.

When I compile, the console output is as follows:

06:58:21 **** Incremental Build of configuration Default for project Motion ****
"C:\\android-ndk-r9c\\ndk-build.cmd" all 
Android NDK: WARNING:jni/Android.mk:mixed_sample: non-system libraries in linker flags: -lopencv_java    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi-v7a] Compile++ thumb: mixed_sample <= cpp_part.cpp
[armeabi-v7a] SharedLibrary  : libmixed_sample.so
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: warning: hidden symbol '__aeabi_atexit' in C:/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO c:/opencv-2.4.8-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_java.so
[armeabi-v7a] Install        : libmixed_sample.so => libs/armeabi-v7a/libmixed_sample.so

06:58:24 Build Finished (took 2s.515ms)

My android.mk is as follows:

LOCAL_PATH := $(call my-dir)

# compile with profiling
LOCAL_CFLAGS := -pg

include $(CLEAR_VARS)

 OPENCV_CAMERA_MODULES:=off 
 OPENCV_INSTALL_MODULES:=on 
 OPENCV_LIB_TYPE:=SHARED

include c:\opencv-2.4.8-android-sdk/sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := mixed_sample
LOCAL_SRC_FILES := cpp_part.cpp
LOCAL_LDLIBS +=  -llog -ldl -lz

LOCAL_STATIC_LIBRARIES := android-ndk-profiler

include $(BUILD_SHARED_LIBRARY)

$(call import-module,android-ndk-profiler)

I can't even work out where the "-lopencv_java" linker flag comes from, it doesn't appear anywhere in android.mk.

Any ideas?

EDIT: In response to Alex Cohn's question. If I add "$(info ==$(OPENCV_INSTALL_MODULES)==)" in the line preceding "include $(CLEAR_VARS)" then the console reports the following:

08:39:34 **** Incremental Build of configuration Default for project Motion ****
"C:\\android-ndk-r9c\\ndk-build.cmd" all 
====
Android NDK: WARNING:jni/Android.mk:mixed_sample: non-system libraries in linker flags: -lopencv_java    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module    
[armeabi-v7a] Compile++ thumb: mixed_sample <= cpp_part.cpp
[armeabi-v7a] SharedLibrary  : libmixed_sample.so
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: warning: hidden symbol '__aeabi_atexit' in C:/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO c:/opencv-2.4.8-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_java.so
[armeabi-v7a] Install        : libmixed_sample.so => libs/armeabi-v7a/libmixed_sample.so

08:39:36 Build Finished (took 2s.564ms)

解决方案

Before you include OpenCV.mk, you must make sure that $(OPENCV_INSTALL_MODULES) is equal on. You have the line OPENCV_INSTALL_MODULES:=on in your Android.mk file, but for some reason it did not work. Without digging into all possible (and impossible) problems, an easy way to fix the problem is to write

override OPENCV_INSTALL_MODULES:=on

in your Android.mk; another - to run

ndk-build OPENCV_INSTALL_MODULES=on

from command line.

这篇关于在连接标志非系统库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆