project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.47k stars 2k forks source link

[Build] 'darwin-arm64-all-clusters-no-ble-asan' is not a valid target name #29094

Closed petetnt closed 1 year ago

petetnt commented 1 year ago

Build issue(s)

In the Matter Linux/Mac All Clusters Example there's a line for compiling the example on Arm64 based macs:

https://github.com/project-chip/connectedhomeip/tree/ba45f9ca99c826c1e35cc2a410bc39374ac3b69e/examples/all-clusters-app/linux#compiling-all-clusters-app-for-testing-on-linux-and-mac

To compile on an Arm Mac, which can only be done using the system clang, run:

$ ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py --target darwin-arm64-all-clusters-no-ble-asan build"

However no such target exists, only the darwin-x64 targets are listed when running ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py targets --format=json"

    {
        "name": "darwin",
        "shorthand": "darwin-x64-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,darwin-framework-tool}[-nodeps][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui]",
        "parts": [
            [
                {
                    "name": "x64",
                    "build_arguments": {
                        "board": "HostBoard.NATIVE"
                    }
                }
            ],
            [
                {
                    "name": "rpc-console",
                    "build_arguments": {
                        "app": "HostApp.RPC_CONSOLE"
                    },
                    "only_if_re": "x64-"
                },
                {
                    "name": "all-clusters",
                    "build_arguments": {
                        "app": "HostApp.ALL_CLUSTERS"
                    }
                },
                {
                    "name": "all-clusters-minimal",
                    "build_arguments": {
                        "app": "HostApp.ALL_CLUSTERS_MINIMAL"
                    }
                },
                {
                    "name": "chip-tool",
                    "build_arguments": {
                        "app": "HostApp.CHIP_TOOL"
                    }
                },
                {
                    "name": "thermostat",
                    "build_arguments": {
                        "app": "HostApp.THERMOSTAT"
                    }
                },
                {
                    "name": "java-matter-controller",
                    "build_arguments": {
                        "app": "HostApp.JAVA_MATTER_CONTROLLER"
                    }
                },
                {
                    "name": "minmdns",
                    "build_arguments": {
                        "app": "HostApp.MIN_MDNS"
                    }
                },
                {
                    "name": "light",
                    "build_arguments": {
                        "app": "HostApp.LIGHT"
                    }
                },
                {
                    "name": "lock",
                    "build_arguments": {
                        "app": "HostApp.LOCK"
                    }
                },
                {
                    "name": "shell",
                    "build_arguments": {
                        "app": "HostApp.SHELL"
                    }
                },
                {
                    "name": "ota-provider",
                    "build_arguments": {
                        "app": "HostApp.OTA_PROVIDER",
                        "enable_ble": "False"
                    }
                },
                {
                    "name": "ota-requestor",
                    "build_arguments": {
                        "app": "HostApp.OTA_REQUESTOR",
                        "enable_ble": "False"
                    }
                },
                {
                    "name": "simulated-app1",
                    "build_arguments": {
                        "app": "HostApp.SIMULATED_APP1",
                        "enable_ble": "False"
                    }
                },
                {
                    "name": "simulated-app2",
                    "build_arguments": {
                        "app": "HostApp.SIMULATED_APP2",
                        "enable_ble": "False"
                    }
                },
                {
                    "name": "python-bindings",
                    "build_arguments": {
                        "app": "HostApp.PYTHON_BINDINGS"
                    }
                },
                {
                    "name": "tv-app",
                    "build_arguments": {
                        "app": "HostApp.TV_APP"
                    }
                },
                {
                    "name": "tv-casting-app",
                    "build_arguments": {
                        "app": "HostApp.TV_CASTING"
                    }
                },
                {
                    "name": "bridge",
                    "build_arguments": {
                        "app": "HostApp.BRIDGE"
                    }
                },
                {
                    "name": "tests",
                    "build_arguments": {
                        "app": "HostApp.TESTS"
                    }
                },
                {
                    "name": "chip-cert",
                    "build_arguments": {
                        "app": "HostApp.CERT_TOOL"
                    }
                },
                {
                    "name": "address-resolve-tool",
                    "build_arguments": {
                        "app": "HostApp.ADDRESS_RESOLVE"
                    }
                },
                {
                    "name": "contact-sensor",
                    "build_arguments": {
                        "app": "HostApp.CONTACT_SENSOR"
                    }
                },
                {
                    "name": "dishwasher",
                    "build_arguments": {
                        "app": "HostApp.DISHWASHER"
                    }
                },
                {
                    "name": "darwin-framework-tool",
                    "build_arguments": {
                        "app": "HostApp.CHIP_TOOL_DARWIN"
                    }
                }
            ]
        ],
        "modifiers": [
            {
                "name": "nodeps",
                "build_arguments": {
                    "enable_ble": "False",
                    "enable_wifi": "False",
                    "enable_thread": "False",
                    "crypto_library": "HostCryptoLibrary.MBEDTLS",
                    "use_clang": "True"
                },
                "except_if_re": "-(clang|noble|boringssl|mbedtls)"
            },
            {
                "name": "platform-mdns",
                "build_arguments": {
                    "use_platform_mdns": "True"
                }
            },
            {
                "name": "minmdns-verbose",
                "build_arguments": {
                    "minmdns_high_verbosity": "True"
                }
            },
            {
                "name": "libnl",
                "build_arguments": {
                    "minmdns_address_policy": "libnl"
                }
            },
            {
                "name": "same-event-loop",
                "build_arguments": {
                    "separate_event_loop": "False"
                },
                "only_if_re": "-(chip-tool|darwin-framework-tool)"
            },
            {
                "name": "no-interactive",
                "build_arguments": {
                    "interactive_mode": "False"
                },
                "only_if_re": "-chip-tool"
            },
            {
                "name": "ipv6only",
                "build_arguments": {
                    "enable_ipv4": "False"
                }
            },
            {
                "name": "no-ble",
                "build_arguments": {
                    "enable_ble": "False"
                }
            },
            {
                "name": "no-wifi",
                "build_arguments": {
                    "enable_wifi": "False"
                }
            },
            {
                "name": "no-thread",
                "build_arguments": {
                    "enable_thread": "False"
                }
            },
            {
                "name": "mbedtls",
                "build_arguments": {
                    "crypto_library": "HostCryptoLibrary.MBEDTLS"
                },
                "except_if_re": "-boringssl"
            },
            {
                "name": "boringssl",
                "build_arguments": {
                    "crypto_library": "HostCryptoLibrary.BORINGSSL"
                },
                "except_if_re": "-mbedtls"
            },
            {
                "name": "asan",
                "build_arguments": {
                    "use_asan": "True"
                },
                "except_if_re": "-tsan"
            },
            {
                "name": "tsan",
                "build_arguments": {
                    "use_tsan": "True"
                },
                "except_if_re": "-asan"
            },
            {
                "name": "ubsan",
                "build_arguments": {
                    "use_ubsan": "True"
                }
            },
            {
                "name": "libfuzzer",
                "build_arguments": {
                    "fuzzing_type": "HostFuzzingType.LIB_FUZZER"
                },
                "only_if_re": "-clang",
                "except_if_re": "-ossfuzz"
            },
            {
                "name": "ossfuzz",
                "build_arguments": {
                    "fuzzing_type": "HostFuzzingType.OSS_FUZZ"
                },
                "only_if_re": "-clang",
                "except_if_re": "-libfuzzer"
            },
            {
                "name": "coverage",
                "build_arguments": {
                    "use_coverage": "True"
                },
                "only_if_re": "-(chip-tool|all-clusters)"
            },
            {
                "name": "dmalloc",
                "build_arguments": {
                    "use_dmalloc": "True"
                }
            },
            {
                "name": "clang",
                "build_arguments": {
                    "use_clang": "True"
                }
            },
            {
                "name": "test",
                "build_arguments": {
                    "extra_tests": "True"
                }
            },
            {
                "name": "rpc",
                "build_arguments": {
                    "enable_rpcs": "True"
                }
            },
            {
                "name": "with-ui",
                "build_arguments": {
                    "imgui_ui": "True"
                }
            }
        ]
    },

Platform

darwin

bzbarsky-apple commented 1 year ago

@petetnt When I run your command on an ARM mac, I get:

% ./scripts/run_in_build_env.sh "./scripts/build/build_examples.py targets --format=json"
...
        "shorthand": "darwin-arm64-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,refrigerator,darwin-framework-tool}[-nodeps][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui]",

Are you running your commands on an M1/M2 mac? If so, what version of the SDK are you using?

petetnt commented 1 year ago

Running on a Macbook Pro 13-inch, M1, 2020, using the latest commit 0e7d3b718e89e4602cafb4a34de14085cf8b8676.

bzbarsky-apple commented 1 year ago

@petetnt That is very very strange. What does this return for you?

./scripts/run_in_build_env.sh "python3 -c 'from platform import uname; print(uname().machine)' "
petetnt commented 1 year ago

uname().machine claims that it's x86_64, which explains the issue... I looked into it and it seems that https://apple.stackexchange.com/questions/420452/running-uname-m-gives-x86-64-on-m1-mac-mini my bash is a x86 version for whatever reasons (I've brought the same OS through multiple machine upgrades...).

I'll close this and report back if the issue persist after fixing the bash issue. Thanks a lot @bzbarsky-apple 🙇

bzbarsky-apple commented 1 year ago

@petetnt That's uname in python, which I would think does not run the shell, but who knows... It's possible the python binary involved is x86 too?

petetnt commented 1 year ago

Ah yeah, sorry, the issue was that the Python binary was x86_64 too. Thanks for the help @bzbarsky-apple !