I know that xtensa-esp32-elf-clang is installed when the install.sh script is run but does it support the ESP32-S3 or will there be an xtensa-esp32s3-elf-clang coming?
Even if only for the ESP32, are there any instructions for how to integrate it into the build process? I haven't run across any.
clangd seems to be installed in the same directory and seems to be functional with LSP enabled editors but it currently complains about 2 gcc-specific options in the compile_commands.json file... -fstrict-volatile-bitfields and -fno-tree-switch-conversion. I added a custom command to my CMakeLists.txt file to remove those options after a build but will that be addressed at some point?
Thanks!
Status of support for clang, clangd and LSP?
Re: Status of support for clang, clangd and LSP?
Hi gtjoseph,
Starting from IDF v5.0, there is an experimental support for building projects with clang. To build an IDF project with clang, IDF_TOOLCHAIN=clang must be set either in the environment or as a CMake cache variable when configuring the project for the first time. (If you have already configured the project, you need to do idf.py fullclean first.)
Note that we aren't yet running builds with clang in CI, so the build might occasionally not work.
However, CMake configuration stage should still work. If you want to create a compile_commands.json file for clangd, you can just run the configuration stage.
For example, run:
idf.py -B build.clang -D IDF_TOOLCHAIN=clang reconfigure
After this step, build.clang/compile_commands.json file should be created, and the file will not contain any GCC specific options.
Unfortunately CMake doesn't support generation of build steps for GCC and a compile_commands.json file for Clang, within the same build directory. So such 'mixed' use case is unlikely to be supported.
We do plan to release a Clang/LLVM based toolchain for all Xtensa (including ESP32-S3) and RISC-V targets, and gradually improve support for building IDF projects with clang. Most likely the new toolchain will ship before the end of Q3.
Starting from IDF v5.0, there is an experimental support for building projects with clang. To build an IDF project with clang, IDF_TOOLCHAIN=clang must be set either in the environment or as a CMake cache variable when configuring the project for the first time. (If you have already configured the project, you need to do idf.py fullclean first.)
Note that we aren't yet running builds with clang in CI, so the build might occasionally not work.
However, CMake configuration stage should still work. If you want to create a compile_commands.json file for clangd, you can just run the configuration stage.
For example, run:
idf.py -B build.clang -D IDF_TOOLCHAIN=clang reconfigure
After this step, build.clang/compile_commands.json file should be created, and the file will not contain any GCC specific options.
Unfortunately CMake doesn't support generation of build steps for GCC and a compile_commands.json file for Clang, within the same build directory. So such 'mixed' use case is unlikely to be supported.
We do plan to release a Clang/LLVM based toolchain for all Xtensa (including ESP32-S3) and RISC-V targets, and gradually improve support for building IDF projects with clang. Most likely the new toolchain will ship before the end of Q3.
Re: Status of support for clang, clangd and LSP?
Perfect, thanks!!
-
- Posts: 168
- Joined: Sun May 22, 2022 2:42 pm
Re: Status of support for clang, clangd and LSP?
Resurrecting an old thread, but I've noticed that clang is no longer shipped when installing ESP-IDF. Does that mean it is no longer supported at all?
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 92 guests