Embedded Swift on ESP32 with IDF: error on build

Hello.

I recently read Kuba Mracek's article on using Swift in embedded applications, and wanted to give it a try on ESP32. I found esp32-led-strip-sdk, and followed the instructions.

I believe I have the toolchain (swift-6.0-DEVELOPMENT-SNAPSHOT-2024-05-26-a.xctoolchain) and IDF environment (via its export.sh) set up correctly (this is on my M2 MacBook Pro, in case that matters), and idf.py build almost works, but I see this in the log:

[185/473] Generating _swiftcode.o
FAILED: esp-idf/main/_swiftcode.o /Users/sean/src/swinkenlights/build/esp-idf/main/_swiftcode.o
cd /Users/sean/src/swinkenlights/build/esp-idf/main && /Library/Develop(REDACTED; it’s like 4k long)
<unknown>:0: error: unknown argument: '-import-bridging-header’

and:

[107/108] Generating binary image from built executable
esptool.py v4.7.0
Creating esp32c6 image...
Merged 3 ELF sections
Successfully created esp32c6 image.
Generated /Users/sean/src/swinkenlights/build/bootloader/bootloader.bin
[108/108] cd /Users/sean/src/swinkenlights/build/bootloader/esp-idf/esptool_py && /Users/sean/.espressif/python_env/idf5.2_py3.9_env/bin/python /Users/sean/esp/v5.2.1/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 /Users/sean/src/swinkenlights/build/bootloader/bootloader.bin
Bootloader binary size 0x54e0 bytes. 0x2b20 bytes (34%) free.
ninja: build stopped: subcommand failed.

I assume I can’t just ignore this subcommand failure, and something weird is going on with -import-bridging-header ?

Any ideas how I should proceed? Thanks for reading.

That looks like you are not using that toolchain; iirc the error for that flag being missing is when the toolchain is not the most recent builds. What command line invocation are you using and what environment parameters?

Hi. Thanks for taking a look. I may have set the toolchain wrong, indeed; the instructions seemed unclear to me (it says to set the TOOLCHAINS environment variable, but it doesn't show a real example and maybe it's not supposed to be the path shown below?). Here's the regular output from my interactive session, that hopefully contains the info you're asking for.

(Sorry if not; I've used the Arduino framework and Micropython on the ESP-32, but this is my first time digging into IDF, directly. Happy to provide anything you want/need—might need to be explicit in asking.)

❯ echo $TOOLCHAINS
/Users/sean/Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-05-26-a.xctoolchain
❯ . ~/esp/v5.2.1/esp-idf/export.sh
Detecting the Python interpreter
Checking "python3" ...
Python 3.9.6
"python3" has been detected
Checking Python compatibility
Checking other ESP-IDF version.
Adding ESP-IDF tools to PATH...
Checking if Python packages are up to date...
Constraint file: /Users/sean/.espressif/espidf.constraints.v5.2.txt
Requirement files:
 - /Users/sean/esp/v5.2.1/esp-idf/tools/requirements/requirements.core.txt
Python being checked: /Users/sean/.espressif/python_env/idf5.2_py3.9_env/bin/python
Python requirements are satisfied.
Updated PATH variable:
  /Users/sean/esp/v5.2.1/esp-idf/components/espcoredump:/Users/sean/esp/v5.2.1/esp-idf/components/partition_table:/Users/sean/esp/v5.2.1/esp-idf/components/app_update:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump:/Users/sean/esp/v5.2.1/esp-idf/components/partition_table:/Users/sean/esp/v5.2.1/esp-idf/components/app_update:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump:/Users/sean/esp/v5.2.1/esp-idf/components/partition_table:/Users/sean/esp/v5.2.1/esp-idf/components/app_update:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump:/Users/sean/esp/v5.2.1/esp-idf/components/partition_table:/Users/sean/esp/v5.2.1/esp-idf/components/app_update:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump:/Users/sean/esp/v5.2.1/esp-idf/components/partition_table:/Users/sean/esp/v5.2.1/esp-idf/components/app_update:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/tools/xtensa-esp-elf-gdb/12.1_20231023/xtensa-esp-elf-gdb/bin:/Users/sean/.espressif/tools/riscv32-esp-elf-gdb/12.1_20231023/riscv32-esp-elf-gdb/bin:/Users/sean/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin:/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin:/Users/sean/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/Users/sean/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230921/openocd-esp32/bin:/Users/sean/.espressif/python_env/idf5.2_py3.9_env/bin:/Users/sean/esp/v5.2.1/esp-idf/tools:/nix/store/xhvxpfkb3xmicav5wdx9xfyiaw452mbl-bash-interactive-5.2-p15/bin:/nix/store/3fpl3hs6ii820yxp0rbafx5phnmj8ng7-clang-wrapper-16.0.6/bin:/nix/store/a5v30qll5i02vr9y97bk1rdx3mm6kvlm-clang-16.0.6/bin:/nix/store/h0fgpyxfav7ybnw5sdg8jpyv9f95x4w0-coreutils-9.3/bin:/nix/store/ydcx9rj4gf3dxm1kc0lx7l5d5vrjdwp2-cctools-binutils-darwin-wrapper-16.0.6-973.0.1/bin:/nix/store/vpnp0c420cjmx82g05jq3nm5skdrblvk-cctools-binutils-darwin-16.0.6-973.0.1/bin:/nix/store/xckcwsyrgm5jwlwqgng19j8r0gy4w8ar-cmake-3.27.7/bin:/nix/store/1adagj5gy6lrgrd4clr0v8s1b123l6ry-ps-adv_cmds-119/bin:/nix/store/r55dr1zqvhhq32axn0hgvyv9qv5c9wsf-ninja-1.11.1/bin:/nix/store/gb2i3ydl4acs63rp30b6ky3d0fzhq3ns-dfu-util-0.11/bin:/nix/store/h0fgpyxfav7ybnw5sdg8jpyv9f95x4w0-coreutils-9.3/bin:/nix/store/zr6klxfjzpdr2674ly1f4fix7ig57mjr-findutils-4.9.0/bin:/nix/store/94j70ziq1zp2mj0fs2fzi49j7q3mdhba-diffutils-3.10/bin:/nix/store/nddzbf5pifm77kksh25xwiy2g9kqqm9f-gnused-4.9/bin:/nix/store/98v0v3bwzgkcwsz4anjip62d2k3gz352-gnugrep-3.11/bin:/nix/store/blggp459hvq6swvr8nlxblkdn7ayw8y7-gawk-5.2.2/bin:/nix/store/g9z0hg6snhg5834p14yw4bx6ilcffr8b-gnutar-1.35/bin:/nix/store/6g3nq5hply5p2v3xzlg0i9qqgzr30w1d-gzip-1.13/bin:/nix/store/dq6dsprg57r5wqlc4yzcnkbfxdhfcd3f-bzip2-1.0.8-bin/bin:/nix/store/6kxdgmbgwdq4y42r9qhgdky312v5d7x0-gnumake-4.4.1/bin:/nix/store/x1xxsh1gp6y389hyl40a0i74dkxiprl7-bash-5.2-p15/bin:/nix/store/j34fimsig5s1zsf2f5dkw9a8sv5zpskg-patch-2.7.6/bin:/nix/store/96bznf6bjdghshgj3a2hm16gk3nngbcx-xz-5.4.4-bin/bin:/nix/store/ckbx2qla8zxic5k2d549qdhkbwrpa4q6-file-5.45/bin:/Users/sean/.amplify/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/Users/sean/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/Users/sean/bin:/Users/sean/.nix-profile/bin
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:

  idf.py build
❯ which idf.py
/Users/sean/esp/v5.2.1/esp-idf/tools/idf.py
❯ idf.py set-target esp32c6
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Executing action: set-target
Set Target to: esp32c6, new sdkconfig will be created.
Running cmake in directory /Users/sean/src/swinkenlights/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DPYTHON=/Users/sean/.espressif/python_env/idf5.2_py3.9_env/bin/python -DESP_PLATFORM=1 -DIDF_TARGET=esp32c6 -DCCACHE_ENABLE=0 /Users/sean/src/swinkenlights"...
-- Existing sdkconfig '/Users/sean/src/swinkenlights/sdkconfig' renamed to '/Users/sean/src/swinkenlights/sdkconfig.old'.
-- Found Git: /usr/bin/git (found version "2.39.3 (Apple Git-146)") 
-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-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: /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/bin/riscv32-esp-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32c6
Processing 2 dependencies:
[1/2] espressif/led_strip (2.5.3)
[2/2] idf (5.2.1)
-- Project sdkconfig file /Users/sean/src/swinkenlights/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Found Python3: /Users/sean/.espressif/python_env/idf5.2_py3.9_env/bin/python (found version "3.9.6") found components: Interpreter 
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS
-- Performing Test C_COMPILER_SUPPORTS_WFORMAT_SIGNEDNESS - Success
-- App "main" version: 1
-- Adding linker script /Users/sean/src/swinkenlights/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_system/ld/esp32c6/sections.ld.in
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.api.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.rvfp.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.version.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.phy.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.net80211.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.wdt.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-normal.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.heap.ld
-- Adding linker script /Users/sean/esp/v5.2.1/esp-idf/components/soc/esp32c6/ld/esp32c6.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_bootloader_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump espressif__led_strip esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip main mbedtls mqtt newlib nvs_flash nvs_sec_provider openthread partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
-- Component paths: /Users/sean/esp/v5.2.1/esp-idf/components/app_trace /Users/sean/esp/v5.2.1/esp-idf/components/app_update /Users/sean/esp/v5.2.1/esp-idf/components/bootloader /Users/sean/esp/v5.2.1/esp-idf/components/bootloader_support /Users/sean/esp/v5.2.1/esp-idf/components/bt /Users/sean/esp/v5.2.1/esp-idf/components/cmock /Users/sean/esp/v5.2.1/esp-idf/components/console /Users/sean/esp/v5.2.1/esp-idf/components/cxx /Users/sean/esp/v5.2.1/esp-idf/components/driver /Users/sean/esp/v5.2.1/esp-idf/components/efuse /Users/sean/esp/v5.2.1/esp-idf/components/esp-tls /Users/sean/esp/v5.2.1/esp-idf/components/esp_adc /Users/sean/esp/v5.2.1/esp-idf/components/esp_app_format /Users/sean/esp/v5.2.1/esp-idf/components/esp_bootloader_format /Users/sean/esp/v5.2.1/esp-idf/components/esp_coex /Users/sean/esp/v5.2.1/esp-idf/components/esp_common /Users/sean/esp/v5.2.1/esp-idf/components/esp_eth /Users/sean/esp/v5.2.1/esp-idf/components/esp_event /Users/sean/esp/v5.2.1/esp-idf/components/esp_gdbstub /Users/sean/esp/v5.2.1/esp-idf/components/esp_hid /Users/sean/esp/v5.2.1/esp-idf/components/esp_http_client /Users/sean/esp/v5.2.1/esp-idf/components/esp_http_server /Users/sean/esp/v5.2.1/esp-idf/components/esp_https_ota /Users/sean/esp/v5.2.1/esp-idf/components/esp_https_server /Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support /Users/sean/esp/v5.2.1/esp-idf/components/esp_lcd /Users/sean/esp/v5.2.1/esp-idf/components/esp_local_ctrl /Users/sean/esp/v5.2.1/esp-idf/components/esp_mm /Users/sean/esp/v5.2.1/esp-idf/components/esp_netif /Users/sean/esp/v5.2.1/esp-idf/components/esp_netif_stack /Users/sean/esp/v5.2.1/esp-idf/components/esp_partition /Users/sean/esp/v5.2.1/esp-idf/components/esp_phy /Users/sean/esp/v5.2.1/esp-idf/components/esp_pm /Users/sean/esp/v5.2.1/esp-idf/components/esp_psram /Users/sean/esp/v5.2.1/esp-idf/components/esp_ringbuf /Users/sean/esp/v5.2.1/esp-idf/components/esp_rom /Users/sean/esp/v5.2.1/esp-idf/components/esp_system /Users/sean/esp/v5.2.1/esp-idf/components/esp_timer /Users/sean/esp/v5.2.1/esp-idf/components/esp_wifi /Users/sean/esp/v5.2.1/esp-idf/components/espcoredump /Users/sean/src/swinkenlights/managed_components/espressif__led_strip /Users/sean/esp/v5.2.1/esp-idf/components/esptool_py /Users/sean/esp/v5.2.1/esp-idf/components/fatfs /Users/sean/esp/v5.2.1/esp-idf/components/freertos /Users/sean/esp/v5.2.1/esp-idf/components/hal /Users/sean/esp/v5.2.1/esp-idf/components/heap /Users/sean/esp/v5.2.1/esp-idf/components/http_parser /Users/sean/esp/v5.2.1/esp-idf/components/idf_test /Users/sean/esp/v5.2.1/esp-idf/components/ieee802154 /Users/sean/esp/v5.2.1/esp-idf/components/json /Users/sean/esp/v5.2.1/esp-idf/components/log /Users/sean/esp/v5.2.1/esp-idf/components/lwip /Users/sean/src/swinkenlights/main /Users/sean/esp/v5.2.1/esp-idf/components/mbedtls /Users/sean/esp/v5.2.1/esp-idf/components/mqtt /Users/sean/esp/v5.2.1/esp-idf/components/newlib /Users/sean/esp/v5.2.1/esp-idf/components/nvs_flash /Users/sean/esp/v5.2.1/esp-idf/components/nvs_sec_provider /Users/sean/esp/v5.2.1/esp-idf/components/openthread /Users/sean/esp/v5.2.1/esp-idf/components/partition_table /Users/sean/esp/v5.2.1/esp-idf/components/protobuf-c /Users/sean/esp/v5.2.1/esp-idf/components/protocomm /Users/sean/esp/v5.2.1/esp-idf/components/pthread /Users/sean/esp/v5.2.1/esp-idf/components/riscv /Users/sean/esp/v5.2.1/esp-idf/components/sdmmc /Users/sean/esp/v5.2.1/esp-idf/components/soc /Users/sean/esp/v5.2.1/esp-idf/components/spi_flash /Users/sean/esp/v5.2.1/esp-idf/components/spiffs /Users/sean/esp/v5.2.1/esp-idf/components/tcp_transport /Users/sean/esp/v5.2.1/esp-idf/components/ulp /Users/sean/esp/v5.2.1/esp-idf/components/unity /Users/sean/esp/v5.2.1/esp-idf/components/usb /Users/sean/esp/v5.2.1/esp-idf/components/vfs /Users/sean/esp/v5.2.1/esp-idf/components/wear_levelling /Users/sean/esp/v5.2.1/esp-idf/components/wifi_provisioning /Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant
-- Configuring done (3.1s)
-- Generating done (0.2s)
-- Build files have been written to: /Users/sean/src/swinkenlights/build

(build output in next post; I hit the character limit)

(There's a bunch of stuff in my path for nix (that's how I get cmake, for example); I don't think that should interfere, and IDF's setup didn't really like my local nix shell, so I told it to use the system python3.)

❯ idf.py build
Executing action: all (aliases: build)
Running ninja in directory /Users/sean/src/swinkenlights/build
Executing "ninja all"...
[1/280] Generating _swiftcode.o
FAILED: esp-idf/main/_swiftcode.o /Users/sean/src/swinkenlights/build/esp-idf/main/_swiftcode.o 
cd /Users/sean/src/swinkenlights/build/esp-idf/main && /Library/Developer/CommandLineTools/usr/bin/swiftc -target riscv32-none-none-eabi -Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library -Osize $( echo '/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/main;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/newlib/platform_include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/include/freertos;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/riscv/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/esp_additions/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include/soc;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include/soc/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/port/esp32c6/.;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/port/esp32c6/private_include;/Users/sean/esp/v5.2.1/esp-idf/components/heap/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/log/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/soc/include;/Users/sean/esp/v5.2.1/esp-idf/components/soc/esp32c6;/Users/sean/esp/v5.2.1/esp-idf/components/soc/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/hal/platform_port/include;/Users/sean/esp/v5.2.1/esp-idf/components/hal/esp32c6/include;/Users/sean/esp/v5.2.1/esp-idf/components/hal/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/include/esp32c6;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_common/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/soc;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/include/riscv;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/include/private;/Users/sean/esp/v5.2.1/esp-idf/components/riscv/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include/apps;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include/apps/sntp;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/lwip/src/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/freertos/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include/arch;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include/sys;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/managed_components/espressif__led_strip/include;/Users/sean/src/swinkenlights/managed_components/espressif__led_strip/interface;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/driver/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/deprecated;/Users/sean/esp/v5.2.1/esp-idf/components/driver/analog_comparator/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/dac/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/gpio/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/gptimer/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/i2c/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/i2s/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/ledc/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/mcpwm/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/parlio/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/pcnt/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/rmt/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sdio_slave/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sdmmc/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sigma_delta/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/spi/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/temperature_sensor/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/touch_sensor/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/twai/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/uart/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/usb_serial_jtag/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_pm/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_ringbuf/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/efuse/include;/Users/sean/esp/v5.2.1/esp-idf/components/efuse/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_mm/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/library;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/esp_crt_bundle/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/everest/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_bootloader_format/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_app_format/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/bootloader_support/include;/Users/sean/esp/v5.2.1/esp-idf/components/bootloader_support/bootloader_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_partition/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/app_update/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/spi_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/pthread/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_timer/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/app_trace/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_event/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/nvs_flash/include;/Users/sean/esp/v5.2.1/esp-idf/components/spi_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_phy/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_phy/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/vfs/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_netif/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/include;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/esp_supplicant/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_coex/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_wifi/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_wifi/wifi_apps/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/unity/include;/Users/sean/esp/v5.2.1/esp-idf/components/unity/unity/src;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/cmock/CMock/src;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/console;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/http_parser;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp-tls;/Users/sean/esp/v5.2.1/esp-idf/components/esp-tls/esp-tls-crypto;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/interface;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/esp32c6/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/deprecated/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_eth/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_gdbstub/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hid/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/tcp_transport/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_http_client/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_http_server/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_https_ota/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_psram/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_lcd/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_lcd/interface;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/protobuf-c/protobuf-c;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/common;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/security;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/transports;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/crypto/srp6a;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_local_ctrl/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump/include;/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump/include/port/riscv;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wear_levelling/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/sdmmc/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/diskio;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/src;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/vfs;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/idf_test/include;/Users/sean/esp/v5.2.1/esp-idf/components/idf_test/include/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/ieee802154/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/json/cJSON;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mqtt/esp-mqtt/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/nvs_sec_provider/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/spiffs/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wifi_provisioning/include;/Users/sean/src/swinkenlights/build/config' | tr ';' '\n' | sed -e 's/\(.*\)/-Xcc -I\1/g' ) $( echo '/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/lib/gcc/riscv32-esp-elf/13.2.0/include /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/lib/gcc/riscv32-esp-elf/13.2.0/include-fixed /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/riscv32-esp-elf/sys-include /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/riscv32-esp-elf/include' | tr ' ' '\n' | sed -e 's/\(.*\)/-Xcc -I\1/g' ) -import-bridging-header /Users/sean/src/swinkenlights/main/BridgingHeader.h /Users/sean/src/swinkenlights/main/Main.swift /Users/sean/src/swinkenlights/main/LedStrip.swift -c -o /Users/sean/src/swinkenlights/build/esp-idf/main/_swiftcode.o
<unknown>:0: error: unknown argument: '-import-bridging-header'
[1/1] cd /Users/sean/src/swinkenlights/build/bootl.../src/swinkenlights/build/bootloader/bootloader.bin
Bootloader binary size 0x54e0 bytes. 0x2b20 bytes (34%) free.
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /Users/sean/src/swinkenlights/build/log/idf_py_stderr_output_36931 and /Users/sean/src/swinkenlights/build/log/idf_py_stdout_output_36931

That does not look like an installed toolchain; commonly you can find the toolchain id by plutil -p /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist and grabbing the CFBundleIdentifier out of that (e.g. mine right now is org.swift.59202403311a).

Then you can do TOOLCHAINS=org.swift.59202403311a idf.py build.

1 Like

Thanks; that's helpful. I may submit a PR to esp32-led-strip-sdk to do this in the example.

I'm still having what appears to be the same trouble, though. Here's what I did:

  • I downloaded the May 26th Development Snapshot for Xcode
  • ran the pkg installer; used "install for everyone"; got a successful installation
  • in my project dir, I did: idf.py fullclean and manually removed build/
  • ran these:
❯ plutil -p /Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist | grep CFBundleIdentifier
  "CFBundleIdentifier" => "org.swift.600202405261a"
❯ export TOOLCHAINS=org.swift.600202405261a
. ~/esp/v5.2.1/esp-idf/export.sh
  (output omitted)
idf.py set-target esp32c6
  (output omitted)
❯ idf.py build
Executing action: all (aliases: build)
Running ninja in directory /Users/sean/src/swinkenlights/build
Executing "ninja all"...
[10/948] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[29/948] Generating _swiftcode.o
FAILED: esp-idf/main/_swiftcode.o /Users/sean/src/swinkenlights/build/esp-idf/main/_swiftcode.o 
cd /Users/sean/src/swinkenlights/build/esp-idf/main && /Library/Developer/CommandLineTools/usr/bin/swiftc -target riscv32-none-none-eabi -Xfrontend -function-sections -enable-experimental-feature Embedded -wmo -parse-as-library -Osize $( echo '/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/main;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/newlib/platform_include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/include/freertos;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/config/riscv/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos;/Users/sean/esp/v5.2.1/esp-idf/components/freertos/esp_additions/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include/soc;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/include/soc/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/port/esp32c6/.;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hw_support/port/esp32c6/private_include;/Users/sean/esp/v5.2.1/esp-idf/components/heap/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/log/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/soc/include;/Users/sean/esp/v5.2.1/esp-idf/components/soc/esp32c6;/Users/sean/esp/v5.2.1/esp-idf/components/soc/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/hal/platform_port/include;/Users/sean/esp/v5.2.1/esp-idf/components/hal/esp32c6/include;/Users/sean/esp/v5.2.1/esp-idf/components/hal/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/include/esp32c6;/Users/sean/esp/v5.2.1/esp-idf/components/esp_rom/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_common/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/soc;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/include/riscv;/Users/sean/esp/v5.2.1/esp-idf/components/esp_system/port/include/private;/Users/sean/esp/v5.2.1/esp-idf/components/riscv/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include/apps;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/include/apps/sntp;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/lwip/src/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/freertos/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include/arch;/Users/sean/esp/v5.2.1/esp-idf/components/lwip/port/esp32xx/include/sys;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/managed_components/espressif__led_strip/include;/Users/sean/src/swinkenlights/managed_components/espressif__led_strip/interface;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/driver/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/deprecated;/Users/sean/esp/v5.2.1/esp-idf/components/driver/analog_comparator/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/dac/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/gpio/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/gptimer/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/i2c/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/i2s/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/ledc/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/mcpwm/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/parlio/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/pcnt/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/rmt/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sdio_slave/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sdmmc/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/sigma_delta/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/spi/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/temperature_sensor/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/touch_sensor/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/twai/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/uart/include;/Users/sean/esp/v5.2.1/esp-idf/components/driver/usb_serial_jtag/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_pm/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_ringbuf/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/efuse/include;/Users/sean/esp/v5.2.1/esp-idf/components/efuse/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_mm/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/library;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/esp_crt_bundle/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include/;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/everest/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/3rdparty/p256-m/p256-m;/Users/sean/esp/v5.2.1/esp-idf/components/mbedtls/mbedtls/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_bootloader_format/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_app_format/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/bootloader_support/include;/Users/sean/esp/v5.2.1/esp-idf/components/bootloader_support/bootloader_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_partition/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/app_update/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/spi_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/pthread/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_timer/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/app_trace/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_event/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/nvs_flash/include;/Users/sean/esp/v5.2.1/esp-idf/components/spi_flash/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_phy/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_phy/esp32c6/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/vfs/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_netif/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/include;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/port/include;/Users/sean/esp/v5.2.1/esp-idf/components/wpa_supplicant/esp_supplicant/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_coex/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_wifi/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_wifi/wifi_apps/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/unity/include;/Users/sean/esp/v5.2.1/esp-idf/components/unity/unity/src;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/cmock/CMock/src;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/console;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/http_parser;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp-tls;/Users/sean/esp/v5.2.1/esp-idf/components/esp-tls/esp-tls-crypto;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/interface;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/esp32c6/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_adc/deprecated/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_eth/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_gdbstub/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_hid/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/tcp_transport/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_http_client/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_http_server/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_https_ota/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_psram/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_lcd/include;/Users/sean/esp/v5.2.1/esp-idf/components/esp_lcd/interface;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/protobuf-c/protobuf-c;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/common;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/security;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/transports;/Users/sean/esp/v5.2.1/esp-idf/components/protocomm/include/crypto/srp6a;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/esp_local_ctrl/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump/include;/Users/sean/esp/v5.2.1/esp-idf/components/espcoredump/include/port/riscv;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wear_levelling/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/sdmmc/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/diskio;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/src;/Users/sean/esp/v5.2.1/esp-idf/components/fatfs/vfs;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/idf_test/include;/Users/sean/esp/v5.2.1/esp-idf/components/idf_test/include/esp32c6;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/ieee802154/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/json/cJSON;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/mqtt/esp-mqtt/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/nvs_sec_provider/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/spiffs/include;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/src/swinkenlights/build/config;/Users/sean/esp/v5.2.1/esp-idf/components/wifi_provisioning/include;/Users/sean/src/swinkenlights/build/config' | tr ';' '\n' | sed -e 's/\(.*\)/-Xcc -I\1/g' ) $( echo '/Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/lib/gcc/riscv32-esp-elf/13.2.0/include /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/lib/gcc/riscv32-esp-elf/13.2.0/include-fixed /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/riscv32-esp-elf/sys-include /Users/sean/.espressif/tools/riscv32-esp-elf/esp-13.2.0_20230928/riscv32-esp-elf/riscv32-esp-elf/include' | tr ' ' '\n' | sed -e 's/\(.*\)/-Xcc -I\1/g' ) -import-bridging-header /Users/sean/src/swinkenlights/main/BridgingHeader.h /Users/sean/src/swinkenlights/main/Main.swift /Users/sean/src/swinkenlights/main/LedStrip.swift -c -o /Users/sean/src/swinkenlights/build/esp-idf/main/_swiftcode.o
<unknown>:0: error: unknown argument: '-import-bridging-header'
[42/948] Building C object esp-idf/mbedtls/mbedtls/library/CMakeFiles/mbedcrypto.dir/ecp.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /Users/sean/src/swinkenlights/build/log/idf_py_stderr_output_43189 and /Users/sean/src/swinkenlights/build/log/idf_py_stdout_output_43189

(I also ran it explicitly as TOOLCHAINS=org.swift.600202405261a idf.py build (after a clean, set-target) with the same results.)

(Edit: I had my ~/Libaray in the path I used with plutil, but I tried both my "me only" and "for everyone" installs, and they're the same ID.)

FWIW, I also tried this with the latest trunk/main (May 15), which is export TOOLCHAINS=org.swift.59202405151a and had the same <unknown>:0: error: unknown argument: '-import-bridging-header' problem.

It's entirely possible that I'm not cleaning up properly or something like that, but it does seem to be doing a build when I change the parameters around.

I think you're now hitting a separate issue: If you don't have Xcode installed, or if you have the CommandLineTools in /Library/Developer/CommandLineTools selected as the default tools (via xcode-select), then selecting a toolchain via the TOOLCHAINS env var doesn't work. Are you in of these situations? If yes, the workaround would be to either install Xcode and xcode-select it, or to explicitly add /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin to the PATH env var.

3 Likes

Aha! I was indeed set up to use the command line tools:

❯ xcode-select -p
/Library/Developer/CommandLineTools

I reset it to actual Xcode with:

❯ sudo xcode-select -r
Password:
❯ xcode-select -p
/Applications/Xcode.app/Contents/Developer

Then I cleaned up (with idf.py fullclean; rm -r build/; idf.py set-target esp32c6) and then (with my TOOLCHAINS environment variable exported) idf.py build worked!

Thank you both. This was really helpful.

If I were to submit a patch to that README file, would it be appropriate to link to this thread?

1 Like

Hm, I think this is a general setup problem for all of the examples in the repo, and also for any other setup that uses TOOLCHAINS. I'm wondering if we should describe this in some more prominent "How to use Swift toolchains on macOS" document and then link to that... @rauhul, thoughts?

1 Like

Yeah, I did some mild source diving in both the Swift source code, and within the idf.py virtualenv, and saw only a mention of "cmake toolchains". A document like that would have been a great thing for me to be able to read.

Yes absolutely, we need a better "Install Swift" page which explains how to configure Swift without Xcode. Each of the embedded examples repos should reference that documentation instead of replicating it with slight differences.

cc @mishal_shah

3 Likes

+1 to this. FWIW, I wrote about this a few months ago because I had also searched unsuccessfully for what "setting the TOOLCHAINS environment variable" actually meant:

My article doesn't mention the Command Line Tools vs. Xcode issue because I wasn't aware of it. (Edit: I updated my article with this info.)

Hey! That resolved my issue too :blush: Thanks for help!

sudo xcode-select --switch /Applications/Xcode15.4.app/Contents/Developer
1 Like