android-ndk之Ndk 工具链提示缺少 lrt 选项

98°冷暖 阅读:23 2024-02-27 23:08:18 评论:0

在 NDK-build 上出现以下错误

/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux -androideabi/bin/ld: 错误:找不到 -lrt

我为 lrt 的绝对路径更新了 Android.mk 但问题没有解决

我的 Android.mk 在这里

LOCAL_PATH := $(call my-dir)     
THIS_PATH  := $(LOCAL_PATH)     
include $(CLEAR_VARS)     
OPENCV_CAMERA_MODULES   := off     
OPENCV_INSTALL_MODULES  := off     
OPENCV_LIB_TYPE         := STATIC     
OPENCV_ANDROID_SDK_HOME := /home/Ravikant/Desktop/OpenCV-android-sdk     
include $(OPENCV_ANDROID_SDK_HOME)/sdk/native/jni/OpenCV.mk     
OPENCV_INCLUDE_DIR        := $(OPENCV_ANDROID_SDK_HOME)/sdk/native/jni/include     
OPENCV_LIBS_DIR           := $(OPENCV_ANDROID_SDK_HOME)/sdk/native/libs/$(TARGET_ARCH_ABI)   
OPENCV_3RD_PARTY_LIBS_DIR := $(OPENCV_ANDROID_SDK_HOME)/sdk/native/3rdparty/libs/$(TARGET_ARCH_ABI) 
 
LOCAL_MODULE    := myModule     
LOCAL_CFLAGS := -w     
LOCAL_SRC_FILES := searchPath.cpp auxiliary.cpp       
LOCAL_LDFLAGS := -fopenmp -llog -ljnigraphics -L$(OPENCV_LIBS_DIR)     
LOCAL_SHARED_LIBRARIES += prebuilt_for_opencv_java     
    -lopencv_core         \     
    -lopencv_highgui      \     
    -lopencv_objdetect    \     
    -lopencv_imgproc      \     
    -lopencv_imgcodecs    \     
    -lopencv_photo     
 
    include $(BUILD_SHARED_LIBRARY) 
 
 
 
LOCAL_PATH := $(call my-dir) 
 
include $(CLEAR_VARS) 
 
LOCAL_MODULE    := prebuilt_for_opencv_java 
 
LOCAL_SRC_FILES := $(OPENCV_LIBS_DIR)/libopencv_java3.so 
 
include $(PREBUILT_SHARED_LIBRARY) 

任何人都可以知道它的 ndk 配置问题还是不同的东西。

请您参考如下方法:

我之前遇到过类似的问题。

-fopenmp flag implies both the -lgomp and -lrt



所以只需更换 -fopenmp-lgomp然后它应该可以工作


标签:Android
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号