Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code fails to compile #4

Open
dennis777 opened this issue Jun 15, 2024 · 10 comments
Open

Code fails to compile #4

dennis777 opened this issue Jun 15, 2024 · 10 comments

Comments

@dennis777
Copy link

dennis777 commented Jun 15, 2024

Cannot compile the smart-light build on my MBP running macOS 15 beta

running idf.py build flash monitor runs about partially through, then fails and yields the following output

...
<unknown>:0: error: fatal error encountered during compilation; please submit a bug report (https://swift.org/contributing/#reporting-bugs)
<unknown>:0: note: No available targets are compatible with triple "riscv32-none-none-eabi"
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
...
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
...

Ngl I just have no idea as to where to even start to debug this... 😅 theres so many layers of frameworks and things all playing in on each other. Any tips would be appreciated

@MaxDesiatov
Copy link
Member

Which version of Swift are you using to build this? Would you be able to provide output of a swift --version invocation just before the build?

@dennis777
Copy link
Author

Certainly!

image

@MaxDesiatov
Copy link
Member

MaxDesiatov commented Jun 17, 2024

It looks like a version of Swift included with Xcode. What you need is the latest snapshot from https://swift.org/download, which would look like this (exact commit hashes may be different):

❯ swift --version
Apple Swift version 6.0-dev (LLVM 0872cb59adca699, Swift d138ca4b1442d90)
Target: arm64-apple-macosx14.0

@dennis777
Copy link
Author

dennis777 commented Jun 17, 2024

Okay interesting. I did download it and install it previously and I did it again just now but running swift --version still gives me the same result. Now after some testing I see that only if I write the TOOLCHAINS=org.swift... swift --version, only then do I get the correct output. I tried to put it into my .zshrc profile but that doesn't seem to do it.

❯ TOOLCHAINS=org.swift.59202406131a swift --version
Apple Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 8be62863326595c)
Target: arm64-apple-macosx15.0
❯ swift --version                                  
swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx15.0

@MaxDesiatov
Copy link
Member

MaxDesiatov commented Jun 17, 2024

What's the output of xcode-select -p command on your machine? See this comment to make sure that the TOOLCHAINS environment variables has any effect. Also, if you add plain TOOLCHAINS=org.swift.59202406131a in .zshrc, it won't work, it has to be spelled as export TOOLCHAINS=org.swift.59202406131a.

@dennis777
Copy link
Author

dennis777 commented Jun 17, 2024

Runing xcode-select -p gives

/Applications/Xcode.app/Contents/Developer

Putting these three into my .zshrc profile (and reloading the profile ofc)

# Swift Toolchains
export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw ~/Library/Developer/Toolchains/swift-latest.xctoolchain/Info$
# esp-idf
. ~/Documents/Programming/esp32/esp-idf/export.sh
# matter
. ~/Documents/Programming/esp32/esp-matter/export.sh

and running idf.py build errors out on the same spot

@yaJannik
Copy link

yaJannik commented Jun 18, 2024

Hi there,

I might be able to help with this issue. I'm currently working on something similar and have encountered a different challenge further along. I'll open a separate issue for that.

I faced the same problems and found the following solution helpful:

export TOOLCHAINS=<TOOLCHAIN>
export PATH=/Library/Developer/Toolchains/<TOOLCHAIN>/usr/bin:$PATH

By setting these environment variables, I was able to resolve the issue. Give it a try and see if it works for you.

EDIT: Check the log of the build-script. Do you get this message: "The Swift compiler identification is Apple 6.0"?

@dennis777
Copy link
Author

dennis777 commented Jun 18, 2024

Unfortunately doesn't seem to help my cause. I don't have that message in my logs. I was wondering if all these PATHS conflict in my zshrc file?

image

They're for various python versions and bun.js (and now this additional one for toolchains)

@tali
Copy link

tali commented Jun 27, 2024

I had the same problem and had to remove the build folder to get idf.py to recognise my new toolchain.

@dennis777
Copy link
Author

dennis777 commented Jun 27, 2024

I had the same problem and had to remove the build folder to get idf.py to recognize my new toolchain.

Wow this actually worked 😂

First rm -rf build, then idf.py set-target esp32c6 and finally idf.py build flash monitor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants