alibaba / MNN

MNN is a blazing fast, lightweight deep learning framework, battle-tested by business-critical use cases in Alibaba
http://www.mnn.zone/
8.58k stars 1.65k forks source link

Android 编译DEMO 出现 Target "MNN_CL_WRAP" of type OBJECT_LIBRARY may not be linked into another target #2902

Closed MZCretin closed 1 week ago

MZCretin commented 3 months ago

平台(如果交叉编译请再附上交叉编译目标平台):

纯Android编译

Github版本:

直接下载ZIP包请提供下载日期以及压缩包注释里的git版本(可通过7z l zip包路径命令并在输出信息中搜索Comment 获得,形如Comment = bc80b11110cd440aacdabbf59658d630527a7f2b)。 git clone请提供 git commit 第一行的commit id

下载日期:2024-06-06 GIT版本:61544666b47fd3374ca58c5ec0f82570688d1561

编译方式:

1、进入到 project/android/demo

2、按照readme执行操作 cd MNN mkdir build && cd build cmake -DMNN_BUILD_CONVERTER=ON .. make -j8 过程中均使用 sudo 权限,未报错,进度到100% [100%] Built target MNNDump2Json [100%] Built target MNNRevert2Buffer [100%] Built target MNNConvert [100%] Built target TestConvertResult [100%] Linking CXX executable ../../TestPassManager [100%] Built target TestPassManager

3、然后执行 sh ../tools/script/get_model.sh 过程中均使用 sudo 权限,未报错 输出如下: download and convert build/mobilenet_v1.caffe.caffemodel build/mobilenet_v1.caffe.prototxt downloading mobilenet_v1.caffe.caffemodel ... download mobilenet_v1.caffe.caffemodel failed download and convert build/mobilenet_v2.caffe.caffemodel build/mobilenet_v2.caffe.prototxt downloading mobilenet_v2.caffe.caffemodel ... download mobilenet_v2.caffe.caffemodel failed download and convert build/squeezenet_v1.0.caffe.caffemodel build/squeezenet_v1.0.caffe.prototxt downloading squeezenet_v1.0.caffe.caffemodel ... download squeezenet_v1.0.caffe.caffemodel failed download and convert build/squeezenet_v1.1.caffe.caffemodel build/squeezenet_v1.1.caffe.prototxt downloading squeezenet_v1.1.caffe.caffemodel ... download squeezenet_v1.1.caffe.caffemodel failed downloading mobilenet_v2_1.0_224.tflite.tgz ... hw.cpufamily: 3660830781 , size = 4 The device support i8sdot:1, support fp16:1, support i8mm: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 Start to Optimize the MNN Net... inputTensors : [ input, ] outputTensors: [ MobilenetV2/Predictions/Reshape_1, ] Converted Success! downloading mobilenet_v2_1.0_224_quant.tflite.tgz ... hw.cpufamily: 3660830781 , size = 4 The device support i8sdot:1, support fp16:1, support i8mm: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 Start to Optimize the MNN Net... inputTensors : [ input, ] outputTensors: [ output, ] Converted Success! downloading deeplabv3_257_mv_gpu.tflite ... hw.cpufamily: 3660830781 , size = 4 The device support i8sdot:1, support fp16:1, support i8mm: 0 Start to Convert Other Model Format To MNN Model..., target version: 2.9 Start to Optimize the MNN Net... inputTensors : [ sub_7, ] outputTensors: [ ResizeBilinear_3, ] Converted Success!

我这边的环境是: ndk:26.3.11579264 cmake:3.22.1

Android 项目demo中: jdk版本 1.8 gradle-plugin-version: 4.2.1 gradle-version: 6.7.1

编译日志:

Execution failed for task ':app:generateJsonModelDebug'.
> /Users/cretin/Desktop/MNN/CMakeLists.txt : C/C++ debug|arm64-v8a : CMake Error at /Users/cretin/Desktop/MNN/tools/cpp/CMakeLists.txt:10 (target_link_libraries):
    Target "MNN_CL_WRAP" of type OBJECT_LIBRARY may not be linked into another
    target.  One may link only to STATIC or SHARED libraries, or to executables
    with the ENABLE_EXPORTS property set.
  Call Stack (most recent call first):
    CMakeLists.txt:767 (include)
jxt1234 commented 2 months ago

编译失败的是 tools 目录,在 Android 上可以把 tools 编译关掉 (-DMNN_BUILD_TOOLS=OFF)

github-actions[bot] commented 2 weeks ago

Marking as stale. No activity in 60 days.