Skip to content

[android] Cannot specify link libraries for target "mdk" which is not built by this #10

Closed

Description

@abdelaziz-mahdy
* What went wrong:
Execution failed for task ':fvp:configureCMakeDebug'.
> C/C++: /Users/AbdelazizMahdy/.pub-cache/hosted/pub.dev/fvp-0.1.0/android/CMakeLists.txt debug|armeabi-v7a : CMake Error at /Users/AbdelazizMahdy/.pub-cache/hosted/pub.dev/fvp-0.1.0/android/mdk-sdk/lib/cmake/FindMDK.cmake:260 (target_link_libraries):
    Cannot specify link libraries for target "mdk" which is not built by this
    project.
  Call Stack (most recent call first):
    CMakeLists.txt:67 (include)
    

Activity

  1. wang-bin commented on Aug 21, 2023

    @wang-bin
    Owner

    what's your cmake version?

  2. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    what's your cmake version?

    i dont know how to check it, can you let me know.

    in terminal its cmake version 3.27.1

    but i dont know if that what flutter uses

  3. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    You are running version 3.10.2 this is the cmake version flutter is using when building

    also this is the line causing the problem target_link_libraries(mdk INTERFACE mdk-ffmpeg) # ensure libffmpeg.so will be copied by gradle

    in the findMDK.cmake

    also i tried to play with the configs abit

    like setting in find mdk

    cmake_minimum_required(VERSION 3.10)
    
    # Project-level configuration.
    set(PROJECT_NAME "mdk")
    project(${PROJECT_NAME} LANGUAGES CXX)
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    

    but i made more errors appear i think

      -- Build files have been written to: /Users/AbdelazizMahdy/flutter_projects/fvp/android/.cxx/Debug/1x3s5o22/armeabi-v7a
      [1/3] Building CXX object CMakeFiles/fvp_plugin.dir/fvp_plugin.cpp.o
      FAILED: CMakeFiles/fvp_plugin.dir/fvp_plugin.cpp.o 
      /Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi16 --gcc-toolchain=/Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot  -DDART_SHARED_LIB -DFLUTTER_PLUGIN_IMPL -Dfvp_plugin_EXPORTS  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -fPIC -fvisibility=hidden   -std=gnu++1z -MD -MT CMakeFiles/fvp_plugin.dir/fvp_plugin.cpp.o -MF CMakeFiles/fvp_plugin.dir/fvp_plugin.cpp.o.d -o CMakeFiles/fvp_plugin.dir/fvp_plugin.cpp.o -c ../../../../fvp_plugin.cpp
      ../../../../fvp_plugin.cpp:10:10: fatal error: 'mdk/Player.h' file not found
      #include <mdk/Player.h>
               ^~~~~~~~~~~~~~
      1 error generated.
      [2/3] Building CXX object CMakeFiles/fvp_plugin.dir/Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp.o
      FAILED: CMakeFiles/fvp_plugin.dir/Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp.o 
      /Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi16 --gcc-toolchain=/Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/Users/AbdelazizMahdy/Library/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/darwin-x86_64/sysroot  -DDART_SHARED_LIB -DFLUTTER_PLUGIN_IMPL -Dfvp_plugin_EXPORTS  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -fPIC -fvisibility=hidden   -std=gnu++1z -MD -MT CMakeFiles/fvp_plugin.dir/Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp.o -MF CMakeFiles/fvp_plugin.dir/Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp.o.d -o CMakeFiles/fvp_plugin.dir/Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp.o -c /Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp
      /Users/AbdelazizMahdy/flutter_projects/fvp/lib/src/callbacks.cpp:5:10: fatal error: 'mdk/Player.h' file not found
      #include "mdk/Player.h"
               ^~~~~~~~~~~~~~
      1 error generated.
      ninja: build stopped: subcommand failed.
    
    
  4. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    i just cloned the repo and it works on your example, which is weird,

    since using i am using the package locally on both cases while trying.

    the only reason i think it maybe failing is gradle versions or cmake versions, since your was using cmake 3.22 mine was 3.10

  5. wang-bin commented on Aug 21, 2023

    @wang-bin
    Owner

    What about upgrading your cmake?

  6. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    i dont know how to do it in flutter, does setting the ndk version does that?

  7. wang-bin commented on Aug 21, 2023

    @wang-bin
    Owner

    btw, you have to upgrade ndk too. I use ndk 25, but ndk 23 breaks abi, you must use ndk 23 or later

  8. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    i did set the ndk version for ndkVersion "25.2.9519653"
    but the cmake is still version 3.10.2

  9. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    setting version "3.22.1"
    in your package

      externalNativeBuild {
           cmake {
               // version "Your.CMake.Version"
           
               path "CMakeLists.txt"
               // The default CMake version for the Android Gradle Plugin is 3.10.2.
               // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
               //
               // The Flutter tooling requires that developers have CMake 3.10 or later
               // installed. You should not increase this version, as doing so will cause
               // the plugin to fail to compile for some customers of the plugin.
               // version "3.10.2"
               version "3.22.1"
           }
       }
    

    made it compile without errors finally i think thats not a valid fix since it just has to be higher than 3.20 correct?

    but at least now we know what is the problem

  10. wang-bin commented on Aug 21, 2023

    @wang-bin
    Owner

    i need to know how cmake version is selected. If use ndk 23 or later is installed, then higher version of ndk and cmake will be used.

  11. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    when i did use ndkVersion "25.2.9519653" alone it was still using cmake 3.10.2

    setting the cmake like mentioned was the only fix that worked for my case

    i updated the pr to allow anything after 3.22.0, do you think we should set the ndk version in the package to make sure all people has the cmake version updated?

  12. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    maybe this is the cause
    https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
    image

    your example uses classpath 'com.android.tools.build:gradle:8.0.2'

    and mine uses classpath 'com.android.tools.build:gradle:7.0.4'

    so from the image by default i use the 21.4.7075529 this is the main problem i think

  13. AnonymHK commented on Aug 21, 2023

    @AnonymHK

    Okay, I'll give it a try !

  14. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    updating from classpath 'com.android.tools.build:gradle:7.0.4'
    to classpath 'com.android.tools.build:gradle:7.4.2' fixed the error also i updated to version 0.2.0

  15. AnonymHK commented on Aug 21, 2023

    @AnonymHK

    This solution is not valid for me. I will try again after your new version is released!

  16. abdelaziz-mahdy commented on Aug 21, 2023

    @abdelaziz-mahdy
    ContributorAuthor

    This solution is not valid for me. I will try again after your new version is released!

    your issue is related to this #13
    so its okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions