Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Ninja missing and no known rule to make it
Forum Updated to NodeBB v4.3 + New Features

Ninja missing and no known rule to make it

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 13.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AkshayFP
    wrote on last edited by
    #1

    I have a project that looks like -

    root
    |
    |- CMakeList.txt
    |- Project_A <- shared object
    |  `- CMakeList.txt
    `- Project_B <- actual app
       `- CMakeList.txt
    

    Now, Project_B depends on Project_A. Project_A builds the a shared object - libProject_A_x86_64.so, but on Ubuntu, libProject_A_x86_64.so is not being generated. On windows it works fine.

    I have a cmake configuration something like this:

    ...
    target_include_directories(cook-ui-modular-qt PUBLIC
        ../Project_A
    )
    if(UNIX AND NOT ANDROID)
        target_link_libraries(cook-ui-modular-qt PUBLIC
            ${CMAKE_CURRENT_BINARY_DIR}/../Project_A/libProject_A.so.1
        )
    endif()
    ...
    

    And this is the error I get:

    13:56:04: Running steps for project cook-ui-modular-qt...
    13:56:04: Starting: "/opt/Qt/Tools/CMake/bin/cmake" --build /home/akshay/Code/build-cook-ui-modular-qt-Desktop_Qt_6_2_2_GCC_64bit-Debug --target all
    ninja: error: 'App/Project_A/libProject_A.so.1', needed by 'App/Project_B/cook-ui-modular-qt', missing and no known rule to make it
    13:56:04: The process "/opt/Qt/Tools/CMake/bin/cmake" exited with code 1.
    Error while building/deploying project cook-ui-modular-qt (kit: Desktop Qt 6.2.2 GCC 64bit)
    When executing step "Build"
    13:56:04: Elapsed time: 00:00.
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by
      #5

      Use add_library(...) in your 'projectA' instead of qt_add_executable(...).

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        You should link against the target you build, not against the created library. -> target_link_libraries(cook-ui-modular-qt PUBLIC Project_A)
        Also target_include_libraries(cook-ui-modular-qt PUBLIC ../Project_A) is wrong here. This has to be defined for Project_A so cmake can automatically add this include path when the library is used.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        A 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          You should link against the target you build, not against the created library. -> target_link_libraries(cook-ui-modular-qt PUBLIC Project_A)
          Also target_include_libraries(cook-ui-modular-qt PUBLIC ../Project_A) is wrong here. This has to be defined for Project_A so cmake can automatically add this include path when the library is used.

          A Offline
          A Offline
          AkshayFP
          wrote on last edited by
          #3

          @Christian-Ehrlicher I get this error now:

          /home/akshay/Code/cook-ui-modular-qt/App/Project_B/CMakeLists.txt:156: error: Target "Project_A" of type EXECUTABLE may not be linked into another target.  One may link only to INTERFACE, OBJECT, STATIC or SHARED libraries, or to executables with the ENABLE_EXPORTS property set.
          

          Original cmake file for the complete project:

          root CMakeLists.txt

          cmake_minimum_required(VERSION 3.21)
          
          project(cook-ui-modular-qt)
          
          if(UNIX)
              add_subdirectory(App/ConnectedSocket) # this is Project_A
          endif()
          
          add_subdirectory(App/UserInterface)# this is Project_B
          

          ConnectedSocket - CMakeList.txt

          cmake_minimum_required(VERSION 3.16)
          project(ConnectedSocket LANGUAGES CXX)
          
          set(CMAKE_INCLUDE_CURRENT_DIR ON)
          
          set(CMAKE_AUTOMOC ON)
          set(CMAKE_AUTORCC ON)
          set(CMAKE_AUTOUIC ON)
          
          add_definitions ( -Wall )
          
          if(NOT DEFINED INSTALL_EXAMPLESDIR)
            set(INSTALL_EXAMPLESDIR "examples")
          endif()
          
          set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
          
          find_package(Qt6 COMPONENTS Core)
          find_package(Qt6 COMPONENTS Gui)
          
          qt_add_executable(ConnectedSocket
          # ... all C and C++ files
          )
          target_include_directories(ConnectedSocket PUBLIC
              connected.socket/lib/applcommon/Action
              connected.socket/lib/applcommon/Alignment
              connected.socket/lib/applcommon/Allocator
              connected.socket/lib/applcommon/Alt
              connected.socket/lib/applcommon/ApplianceApi
              connected.socket/lib/applcommon/ApplianceUpdate
              connected.socket/lib/applcommon/ApplianceUpdate/Adaptors
              connected.socket/lib/applcommon/ApplianceUpdate/ChunkGenerators
              connected.socket/lib/applcommon/ApplianceUpdate/DeviceInterfaces
              connected.socket/lib/applcommon/ApplianceUpdate/Devices
              connected.socket/lib/applcommon/ApplianceUpdate/Helpers
              connected.socket/lib/applcommon/ApplianceUpdate/ImageInfo
              connected.socket/lib/applcommon/ApplianceUpdate/Parsers
              connected.socket/lib/applcommon/ApplianceUpdate/Services
              connected.socket/lib/applcommon/ApplianceUpdateV2
              connected.socket/lib/applcommon/Assert
              connected.socket/lib/applcommon/Audio
              connected.socket/lib/applcommon/BootLoader
              connected.socket/lib/applcommon/BootLoader/FileSystem
              connected.socket/lib/applcommon/Communications
              connected.socket/lib/applcommon/Communications/Gea2
              connected.socket/lib/applcommon/Communications/Gea2/Commands
              connected.socket/lib/applcommon/Communications/Gea2/MessageLayer
              connected.socket/lib/applcommon/Communications/Gea2/PacketLayer
              connected.socket/lib/applcommon/Communications/Gea3
              connected.socket/lib/applcommon/Communications/Geax
              connected.socket/lib/applcommon/Communications/Geax/PacketLayer
              connected.socket/lib/applcommon/Communications/Geax/TransportLayer
              connected.socket/lib/applcommon/Communications/Geax/TransportLayer/GeaxAssuredDelivery
              connected.socket/lib/applcommon/Constants
              connected.socket/lib/applcommon/CoreEnhancedCloud
              connected.socket/lib/applcommon/Crc
              connected.socket/lib/applcommon/CycleEngine
              connected.socket/lib/applcommon/CycleEngine/Extensions
              connected.socket/lib/applcommon/CycleEngine/Extensions/RemainingTime
              connected.socket/lib/applcommon/DataAccess
              connected.socket/lib/applcommon/DataModel
              connected.socket/lib/applcommon/DataSource
              connected.socket/lib/applcommon/DataSource/Packet
              connected.socket/lib/applcommon/DataSource/Packet/Async
              connected.socket/lib/applcommon/DataSource/Packet/ReadWrite
              connected.socket/lib/applcommon/DataSource/Packet/Subscriptions
              connected.socket/lib/applcommon/DataStructures
              connected.socket/lib/applcommon/DataStructures/LinkedList
              connected.socket/lib/applcommon/DataStructures/Queue
              connected.socket/lib/applcommon/DataStructures/RingBuffer
              connected.socket/lib/applcommon/DateTime
              connected.socket/lib/applcommon/Debounce
              connected.socket/lib/applcommon/Deprecated
              connected.socket/lib/applcommon/Diagnostics
              connected.socket/lib/applcommon/Display
              connected.socket/lib/applcommon/Endianness
              connected.socket/lib/applcommon/ErdOverrideService
              connected.socket/lib/applcommon/ErdStream
              connected.socket/lib/applcommon/Event
              connected.socket/lib/applcommon/Fct
              connected.socket/lib/applcommon/FileSystem
              connected.socket/lib/applcommon/Filter
              connected.socket/lib/applcommon/Flasher
              connected.socket/lib/applcommon/Git
              connected.socket/lib/applcommon/Hardware
              connected.socket/lib/applcommon/HardwareInterfaces
              connected.socket/lib/applcommon/HardwareInterfaces/Adapters
              connected.socket/lib/applcommon/HardwareInterfaces/Relays
              connected.socket/lib/applcommon/Image
              connected.socket/lib/applcommon/KeyManager
              connected.socket/lib/applcommon/Mapper
              connected.socket/lib/applcommon/Md5
              connected.socket/lib/applcommon/Motors
              connected.socket/lib/applcommon/NonVolatile
              connected.socket/lib/applcommon/OverrideArbiter
              connected.socket/lib/applcommon/Personality
              connected.socket/lib/applcommon/RecordStorage
              connected.socket/lib/applcommon/ResourceWatchdog
              connected.socket/lib/applcommon/Selector
              connected.socket/lib/applcommon/ServiceMode
              connected.socket/lib/applcommon/Sha256
              connected.socket/lib/applcommon/SharedResource
              connected.socket/lib/applcommon/Signal
              connected.socket/lib/applcommon/Sorter
              connected.socket/lib/applcommon/StateMachines
              connected.socket/lib/applcommon/Testing
              connected.socket/lib/applcommon/Testing/Utilities
              connected.socket/lib/applcommon/Time
              connected.socket/lib/applcommon/TimeOfDay
              connected.socket/lib/applcommon/Ui
              connected.socket/lib/applcommon/Ui/Draw
              connected.socket/lib/applcommon/Ui/Utilities
              connected.socket/lib/applcommon/Ul
              connected.socket/lib/applcommon/Utilities
              connected.socket/lib/applcommon/Validator
              connected.socket/lib/applcommon/VariableLengthDataPacket
              connected.socket/lib/applcommon/WiFi
              connected.socket/src/Application
              connected.socket/src/Application/Client
              connected.socket/src/Application/Client/HardwareStubs
              connected.socket/src/Application/DataSource
              connected.socket/src/Application/Gea
              connected.socket/src/Application/Server
              connected.socket/src/Application/Server/HardwareStubs
              connected.socket/src/Application/TimerModule
              connected.socket/src/Application/UDS
          )
          
          target_link_libraries(ConnectedSocket PUBLIC
              Qt::Core
              Qt::Gui
          )
          
          if(UNIX AND NOT ANDROID)
              target_compile_definitions(ConnectedSocket PUBLIC
                  TESTAPP
              )
          endif()
          
          install(TARGETS ConnectedSocket
              RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
              BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
              LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
          )
          

          UserInterface - CMakeList.txt

          cmake_minimum_required(VERSION 3.16)
          project(cook-ui-modular-qt LANGUAGES CXX)
          
          set(CMAKE_INCLUDE_CURRENT_DIR ON)
          
          set(CMAKE_AUTOMOC ON)
          set(CMAKE_AUTORCC ON)
          set(CMAKE_AUTOUIC ON)
          
          if(NOT DEFINED INSTALL_EXAMPLESDIR)
            set(INSTALL_EXAMPLESDIR "examples")
          endif()
          
          set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}")
          
          find_package(Qt6 COMPONENTS Core)
          find_package(Qt6 COMPONENTS Gui)
          find_package(Qt6 COMPONENTS Quick)
          
          qt_add_executable(cook-ui-modular-qt WIN32 MACOSX_BUNDLE
              Clock.cpp Clock.h
              ${CMAKE_SOURCE_DIR}/App/ConnectedSocket/ConnectedSocket.h
              ConnectedSocketClient.cpp ConnectedSocketClient.h
              DrawerItems.cpp DrawerItems.h
              ErdBridge.cpp ErdBridge.h
              Settings.cpp Settings.h
              backend.cpp backend.h
              main.cpp
          )
          
          #target_include_directories(cook-ui-modular-qt PUBLIC
          #    ../ConnectedSocket
          #)
          
          # Resources:
          set(qml_resource_files
              "Common/QML/FpaModule/Constants/Constants.qml"
              "Common/QML/FpaModule/Constants/qmldir"
              "Common/QML/FpaModule/Item/BackgroundClock.qml"
              "Common/QML/FpaModule/Item/BackgroundEmpty.qml"
              "Common/QML/FpaModule/Item/ItemBack.qml"
              "Common/QML/FpaModule/Item/ItemButton.qml"
              "Common/QML/FpaModule/Item/ItemCardGrid.qml"
              "Common/QML/FpaModule/Item/ItemClock.qml"
              "Common/QML/FpaModule/Item/ItemClockTumbler.qml"
              "Common/QML/FpaModule/Item/ItemClose.qml"
              "Common/QML/FpaModule/Item/ItemDemoModeButton.qml"
              "Common/QML/FpaModule/Item/ItemDrawer.qml"
              "Common/QML/FpaModule/Item/ItemDrawerGrid.qml"
              "Common/QML/FpaModule/Item/ItemFlatTumbler.qml"
              "Common/QML/FpaModule/Item/ItemFlatTumblerSelector.qml"
              "Common/QML/FpaModule/Item/ItemHorizontalScroller.qml"
              "Common/QML/FpaModule/Item/ItemPickerGrid.qml"
              "Common/QML/FpaModule/Item/ItemProgressBar.qml"
              "Common/QML/FpaModule/Item/ItemSettingsSlider.qml"
              "Common/QML/FpaModule/Item/ItemStepOverview.qml"
              "Common/QML/FpaModule/Item/ItemTimerSelector.qml"
              "Common/QML/FpaModule/Item/ItemTimerStatus.qml"
              "Common/QML/FpaModule/Item/ItemTimerTumbler.qml"
              "Common/QML/FpaModule/Item/ItemTumblerDivider.qml"
              "Common/QML/FpaModule/Item/ItemWrapTumbler.qml"
              "Common/QML/FpaModule/Item/ScreenTemplate.qml"
              "Common/QML/FpaModule/Item/TextCustom.qml"
              "Common/QML/FpaModule/Item/qmldir"
              "Common/QML/FpaModule/Popup/PopupDemoMode.qml"
              "Common/QML/FpaModule/Popup/PopupStatus.qml"
              "Common/QML/FpaModule/Popup/qmldir"
              "Common/QML/FpaModule/Screen/ScreenGenericPrompt.qml"
              "Common/QML/FpaModule/Screen/ScreenGenericSetting.qml"
              "Common/QML/FpaModule/Screen/ScreenSettingsTime.qml"
              "Common/QML/FpaModule/Screen/ScreenSingleButtonPrompt.qml"
              "Common/QML/FpaModule/Screen/ScreenSliderSetting.qml"
              "Common/QML/FpaModule/Screen/ScreenSlideshow.qml"
              "Common/QML/FpaModule/Screen/ScreenSpinner.qml"
              "Common/QML/FpaModule/Screen/qmldir"
              "Images/Features/auto_off_36p.png"
              "Images/Features/change_function_36p.png"
              "Images/Features/clean.png"
              "Images/Features/connecting_spinner.png"
              "Images/Features/delayed_cook_36p.png"
              "Images/Features/food_probe_36p.png"
              "Images/Features/light.png"
              "Images/Features/lock.png"
              "Images/Features/placeholder.png"
              "Images/Features/remote.png"
              "Images/Features/settings.png"
              "Images/Features/timer.png"
              "Images/Features/timer_large.png"
              "Images/Features/timer_small.png"
              "Images/Modules/gas_module.png"
              "Images/Modules/layout.png"
              "Images/Modules/master_module.png"
              "Images/Modules/teppan_module.png"
              "Images/Navigation/arrow.png"
              "Images/Navigation/arrow_grey.png"
              "Images/Navigation/back.png"
              "Images/Navigation/close_white.png"
              "Images/Navigation/hamburger.png"
              "Images/Navigation/slide_left.png"
              "Images/Notifications/info_white.png"
              "Images/Notifications/tick.png"
              "QML/Screens/ScreenAddModule.qml"
              "QML/Screens/ScreenAddModuleConfirm.qml"
              "QML/Screens/ScreenAddModuleFinish.qml"
              "QML/Screens/ScreenAssistedCooking.qml"
              "QML/Screens/ScreenConnectModule.qml"
              "QML/Screens/ScreenDrawer.qml"
              "QML/Screens/ScreenHome.qml"
              "QML/Screens/ScreenOptions.qml"
              "QML/Screens/ScreenSetpoint.qml"
              "QML/Screens/ScreenSettings.qml"
              "QML/Screens/ScreenSetup.qml"
              "QML/Screens/ScreenStandby.qml"
              "QML/Screens/ScreenZoneLimitReached.qml"
              "QML/Screens/qmldir"
              "QML/main.qml"
          )
          
          qt6_add_resources(cook-ui-modular-qt "qml"
              PREFIX
                  "/"
              FILES
                  ${qml_resource_files}
          )
          set_source_files_properties("Common/Fonts/tabular_gotham_book.ttf"
              PROPERTIES QT_RESOURCE_ALIAS "tabular_gotham_book.ttf"
          )
          set_source_files_properties("Common/Fonts/tabular_gotham_extra_light.ttf"
              PROPERTIES QT_RESOURCE_ALIAS "tabular_gotham_extra_light.ttf"
          )
          set_source_files_properties("Common/Fonts/tabular_gotham_light.ttf"
              PROPERTIES QT_RESOURCE_ALIAS "tabular_gotham_light.ttf"
          )
          set_source_files_properties("Common/Fonts/tabular_gotham_medium.ttf"
              PROPERTIES QT_RESOURCE_ALIAS "tabular_gotham_medium.ttf"
          )
          set_source_files_properties("Common/Fonts/tabular_gotham_thin.ttf"
              PROPERTIES QT_RESOURCE_ALIAS "tabular_gotham_thin.ttf"
          )
          set(fonts_resource_files
              "Common/Fonts/tabular_gotham_book.ttf"
              "Common/Fonts/tabular_gotham_extra_light.ttf"
              "Common/Fonts/tabular_gotham_light.ttf"
              "Common/Fonts/tabular_gotham_medium.ttf"
              "Common/Fonts/tabular_gotham_thin.ttf"
          )
          
          qt6_add_resources(cook-ui-modular-qt "fonts"
              PREFIX
                  "/"
              FILES
                  ${fonts_resource_files}
          )
          
          if(UNIX AND NOT ANDROID)
              target_link_libraries(cook-ui-modular-qt PUBLIC
                  ConnectedSocket
              )
          
          endif()
          
          if(ANDROID)
              set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android" CACHE INTERNAL "")
              set(LIBS ${CMAKE_BINARY_DIR}/App/ConnectedSocket/libConnectedSocket_${ANDROID_ABI}.so)
          
              target_link_libraries(cook-ui-modular-qt PUBLIC ${LIBS})
              set(ANDROID_EXTRA_LIBS ${LIBS} CACHE INTERNAL "")
          endif()
          
          if(ANDROID)
              add_custom_command(TARGET cook-ui-modular-qt POST_BUILD
                  COMMAND ${CMAKE_COMMAND} -E copy
                  ${CMAKE_BINARY_DIR}/App/ConnectedSocket/libConnectedSocket_${ANDROID_ABI}.so
                  ${CMAKE_BINARY_DIR}/App/UserInterface/android-build/libs/${ANDROID_ABI}/libConnectedSocket_${ANDROID_ABI}.so
                  )
          endif()
          
          install(TARGETS cook-ui-modular-qt
              RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
              BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
              LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
          )
          
          target_compile_definitions(cook-ui-modular-qt
              PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
          target_link_libraries(cook-ui-modular-qt PUBLIC
              Qt::Core
              Qt::Gui
              Qt::Quick
          )
          

          This is running fine on windows and Android but breaks on Linux.

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            I don't know what I should add to the error message - you can not link an executable to another executable. You can only link a library to an executable.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mchinand
              wrote on last edited by
              #5

              Use add_library(...) in your 'projectA' instead of qt_add_executable(...).

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved