Cyclic dependency when building openthread for buildroot

106 views Asked by At

I'm trying to build an openthread border router using buildroot for a beaglebone black, and I'm facing the following error:

CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
  "openthread-ftd" of type SHARED_LIBRARY
    depends on "tcplp-ftd" (weak)
  "tcplp-ftd" of type STATIC_LIBRARY
    depends on "openthread-ftd" (weak)
At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed.  Build files cannot be regenerated correctly.
make: *** [package/pkg-generic.mk:273: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/.stamp_configured] Error 1

I've configured buildroot to build both shared and static libraries, and both these libraries come from the openthread border router submodules. I'm using the same configurations provided by openthread for beaglebone (in examples/platforms/beagleboneblack/default.) I'm using cmake with ninja as the backend and building the binaries like the supported method does, so this issue has me stumped.

What could be causing this issue? I understand that openthread recommends using their setup script to setup openthread, but I'm using this as an exercise to deepdive into buildroots build systems. Please let me know if more information is required.

Full openthread build logs for reference:

>>> openthread thread-reference-20230710 Downloading
wget --passive-ftp -nd -t 3 -O '/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/.openthread-thread-reference-20230710.tar.gz.HQOQxh/output' 'https://github.com/openthread/ot-br-posix/archive/thread-reference-20230710/openthr
ead-thread-reference-20230710.tar.gz'
--2023-11-18 16:24:18--  https://github.com/openthread/ot-br-posix/archive/thread-reference-20230710/openthread-thread-reference-20230710.tar.gz
Resolving github.com (github.com)... 20.207.73.82
Connecting to github.com (github.com)|20.207.73.82|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/openthread/ot-br-posix/tar.gz/refs/tags/thread-reference-20230710 [following]
--2023-11-18 16:24:18--  https://codeload.github.com/openthread/ot-br-posix/tar.gz/refs/tags/thread-reference-20230710
Resolving codeload.github.com (codeload.github.com)... 20.207.73.88
Connecting to codeload.github.com (codeload.github.com)|20.207.73.88|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/.openthread-thread-reference-20230710.tar.gz.HQOQxh/output’

     0K .......... .......... .......... .......... ..........  983K
    50K .......... .......... .......... .......... .......... 1.94M
   100K .......... .......... .......... .......... .......... 29.9M
   150K .......... .......... .......... .......... .......... 2.01M
   200K .......... .......... .......... .......... .......... 22.0M
   250K .......... .......... .......... .......... .......... 40.9M
   300K .......... .......... .......... .......... .......... 43.0M
   350K .......... .......... .......... .......... .......... 42.6M
   400K .......... .......... .......... .......... .......... 2.09M
   450K .......... .......... .......... .......... .......... 32.2M
   500K .......... .......... .......... .......... .......... 59.2M
   550K .......... .......... .......... .......... .......... 33.2M
   600K .......... .......... .......... .......... .......... 72.7M
   650K .......... .......... .......... .......... .......... 65.6M
   700K .......... .......... .......... .......... .......... 66.4M
   750K .......... .......... .......... .......... .......... 54.8M
   800K .......... .......... .......... .......               54.6M=0.1s

2023-11-18 16:24:19 (5.91 MB/s) - ‘/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/.openthread-thread-reference-20230710.tar.gz.HQOQxh/output’ saved [857965]

WARNING: no hash file for openthread-thread-reference-20230710.tar.gz
>>> openthread thread-reference-20230710 Extracting
rm -rf /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710
(git clone https://github.com/openthread/ot-br-posix /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710 && cd /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-
reference-20230710 && git checkout thread-reference-20230710 && git submodule update --init --recursive --depth 1)
Cloning into '/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710'...
Note: switching to 'thread-reference-20230710'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 790dc77514 submodule: bump third_party/openthread/repo from `9fd1da5` to `8bc2504` (#1934)
Submodule 'third_party/cJSON/repo' (https://github.com/DaveGamble/cJSON.git) registered for path 'third_party/cJSON/repo'
Submodule 'third_party/http-parser/repo' (https://github.com/nodejs/http-parser.git) registered for path 'third_party/http-parser/repo'
Submodule 'third_party/openthread/repo' (https://github.com/openthread/openthread.git) registered for path 'third_party/openthread/repo'
Cloning into '/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/third_party/cJSON/repo'...
Cloning into '/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/third_party/http-parser/repo'...
Cloning into '/var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/third_party/openthread/repo'...
From https://github.com/DaveGamble/cJSON
 * branch            cf97c6f066d81fdbba4ef722cfd327bbbba2365c -> FETCH_HEAD
Submodule path 'third_party/cJSON/repo': checked out 'cf97c6f066d81fdbba4ef722cfd327bbbba2365c'
From https://github.com/nodejs/http-parser
 * branch            4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878 -> FETCH_HEAD
Submodule path 'third_party/http-parser/repo': checked out '4f15b7d510dc7c6361a26a7c6d2f7c3a17f8d878'
From https://github.com/openthread/openthread
 * branch            8bc25042ba5cde20605eec2a329c0dff575303f4 -> FETCH_HEAD
Submodule path 'third_party/openthread/repo': checked out '8bc25042ba5cde20605eec2a329c0dff575303f4'
touch /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/.stamp_downloaded
>>> openthread thread-reference-20230710 Patching
>>> openthread thread-reference-20230710 Configuring
(mkdir -p /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/ && cd /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/ && rm -f CMakeCache.tx
t && PATH="/var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin:/var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/sbin:/var/home/joshuajohn/.local/bin:/var/home/joshuajohn/.local/opt:/usr/local/sbin:/usr/local/bin:/
usr/sbin:/usr/bin:/sbin:/bin"  /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin/cmake /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/ -G"Unix Makefiles" -DCMAKE_TOOLCHAIN
_FILE="/var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/share/buildroot/toolchainfile.cmake" -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_INSTALL_RUNSTATEDIR="/run" -DCMAKE_COLOR_MAKEFILE=OFF -DBUILD_DOC=OFF -DBUILD_DOCS=OFF -DBUILD_
EXAMPLE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TEST=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON  -DBUILD_TESTING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=/var/home/joshuajohn/Workspaces/Legion/buildroot
/output/target/usr -DOTBR_DBUS=ON -DOTBR_FEATURE_FLAGS=ON -DOTBR_DNSSD_DISCOVERY_PROXY=ON -DOTBR_SRP_ADVERTISING_PROXY=ON -DOTBR_INFRA_IF_NAME=eth0 -DOTBR_MDNS=avahi -DOTBR_VERSION= -DOTBR_PACKAGE_VERSION= -DBACKBONE_ROUTER=ON -DOTBR_WEB=
ON )
-- The C compiler identification is GNU 12.3.0
-- The CXX compiler identification is GNU 12.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin/arm-buildroot-linux-gnueabihf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin/pkg-config (found version "1.6.3")
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.14.8
-- OTBR package name: OpenThread_BorderRouter
-- Version: 0.3.0-thread-reference-20230710
-- Checking for module 'systemd'
--   Found systemd, version 254
-- OpenThread Source Directory: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/build/openthread-thread-reference-20230710/third_party/openthread/repo
-- OT_APP_CLI=ON
-- OT_APP_NCP=ON
-- OT_APP_RCP=ON
-- OT_FTD=ON
-- OT_MTD=ON
-- OT_RCP=ON
-- OT_THREAD_VERSION=
-- OT_15_4=ON --> OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE=1
-- OT_ANDROID_NDK=""
-- OT_ANYCAST_LOCATOR=ON --> OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1
-- OT_ASSERT=""
-- OT_BACKBONE_ROUTER=OFF --> OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=0
-- OT_BACKBONE_ROUTER_DUA_NDPROXYING=OFF --> OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0
-- OT_BACKBONE_ROUTER_MULTICAST_ROUTING=""                                                                                                                                                                                  16:25:02 [90/1375]
-- OT_BORDER_AGENT=ON --> OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1
-- OT_BORDER_AGENT_ID=ON --> OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE=1
-- OT_BORDER_ROUTER=ON --> OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1
-- OT_BORDER_ROUTING=OFF --> OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=0
-- OT_BORDER_ROUTING_DHCP6_PD=OFF --> OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE=0
-- OT_BORDER_ROUTING_COUNTERS=ON --> OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE=1
-- OT_CHANNEL_MANAGER=""
-- OT_CHANNEL_MONITOR=""
-- OT_COAP=ON --> OPENTHREAD_CONFIG_COAP_API_ENABLE=1
-- OT_COAP_BLOCK=""
-- OT_COAP_OBSERVE=""
-- OT_COAPS=ON --> OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1
-- OT_COMMISSIONER=ON --> OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1
-- OT_CSL_AUTO_SYNC=""
-- OT_CSL_DEBUG=""
-- OT_CSL_RECEIVER=""
-- OT_DATASET_UPDATER=ON --> OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1
-- OT_DHCP6_CLIENT=""
-- OT_DHCP6_SERVER=""
-- OT_DIAGNOSTIC=""
-- OT_DNS_CLIENT=ON --> OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1
-- OT_DNS_CLIENT_OVER_TCP=""
-- OT_DNS_DSO=""
-- OT_DNS_UPSTREAM_QUERY=OFF --> OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE=0
-- OT_DNSSD_SERVER=ON --> OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1
-- OT_DUA=""
-- OT_ECDSA=ON --> OPENTHREAD_CONFIG_ECDSA_ENABLE=1
-- OT_EXTERNAL_HEAP=ON --> OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1
-- OT_FIREWALL=ON --> OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1
-- OT_HISTORY_TRACKER=ON --> OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1
-- OT_IP6_FRAGM=""
-- OT_JAM_DETECTION=""
-- OT_JOINER=ON --> OPENTHREAD_CONFIG_JOINER_ENABLE=1
-- OT_LINK_METRICS_INITIATOR=""
-- OT_LINK_METRICS_SUBJECT=ON --> OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1
-- OT_LINK_RAW=""
-- OT_LOG_LEVEL_DYNAMIC=ON --> OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1
-- OT_MAC_FILTER=ON --> OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1
-- OT_MESH_DIAG=""
-- OT_MESSAGE_USE_HEAP=""
-- OT_MLE_LONG_ROUTES=""
-- OT_MLR=ON --> OPENTHREAD_CONFIG_MLR_ENABLE=1
-- OT_MULTIPLE_INSTANCE=""
-- OT_NAT64_BORDER_ROUTING=OFF --> OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE=0
-- OT_NAT64_TRANSLATOR=OFF --> OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE=0
-- OT_NEIGHBOR_DISCOVERY_AGENT=""
-- OT_NETDATA_PUBLISHER=ON --> OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1
-- OT_NETDIAG_CLIENT=ON --> OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE=1
-- OT_OPERATIONAL_DATASET_AUTO_INIT=""
-- OT_OTNS=""
-- OT_PING_SENDER=ON --> OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1
-- OT_PLATFORM_NETIF=ON --> OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1
-- OT_PLATFORM_UDP=ON --> OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1
-- OT_REFERENCE_DEVICE=""
-- OT_SERVICE=ON --> OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1
-- OT_SETTINGS_RAM=""
-- OT_SLAAC=ON --> OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1
-- OT_SNTP_CLIENT=""
-- OT_SRP_CLIENT=ON --> OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1
-- OT_SRP_SERVER=ON --> OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1
-- OT_TCP=OFF --> OPENTHREAD_CONFIG_TCP_ENABLE=0
-- OT_TIME_SYNC=""
-- OT_TREL=OFF --> OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=0                                                                                                                                                               16:41:12 [27/1375]
-- OT_TX_BEACON_PAYLOAD=""
-- OT_UDP_FORWARD=OFF --> OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=0
-- OT_UPTIME=ON --> OPENTHREAD_CONFIG_UPTIME_ENABLE=1
-- OT_VENDOR_NAME=""
-- OT_VENDOR_MODEL=""
-- OT_VENDOR_SW_VERSION=""
-- OT_POWER_SUPPLY=""
-- OT_RCP_RESTORATION_MAX_COUNT=0
-- OpenThread CMake build type: Release
-- Package Name: OPENTHREAD
-- Setting default package version: 8bc2504
-- Package Version: 8bc2504
-- Thread Version: 1.3 (OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3)
-- OpenThread Config File: "openthread-core-posix-config.h"
-- Readline: readline
CMake Deprecation Warning at third_party/openthread/repo/third_party/mbedtls/repo/CMakeLists.txt:23 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at third_party/openthread/repo/third_party/mbedtls/repo/CMakeLists.txt:39 (project):
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    PROJECT_VERSION
    PROJECT_VERSION_MAJOR
    PROJECT_VERSION_MINOR
    PROJECT_VERSION_PATCH
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Python3: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/bin/python3.11 (found version "3.11.6") found components: Interpreter
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- Checking for module 'libsystemd'
--   Found libsystemd, version 254
-- Found Protobuf: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/libprotobuf.so (found version "3.21.12")
-- Checking for module 'jsoncpp'
--   Found jsoncpp, version 1.9.4
-- Found Boost: /var/home/joshuajohn/Workspaces/Legion/buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include (found version "1.82.0") found components: filesystem system
-- Configuring done (4.2s)
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
  "openthread-ftd" of type SHARED_LIBRARY
    depends on "tcplp-ftd" (weak)
  "tcplp-ftd" of type STATIC_LIBRARY
    depends on "openthread-ftd" (weak)
At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies are allowed only among static libraries.
CMake Generate step failed.  Build files cannot be regenerated correctly.
1

There are 1 answers

0
Joshua John On BEST ANSWER

I wasn't sure how to fix this, since I saw target_link_libraries and assumed that the project used shared libraries as well. I looked into building it with static libraries and came across this github issue. The solution is to pass -DBUILD_SHARED_LIBS=OFF to the cmake options.