最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

esp32 - Fresh Installation of ESP-IDF v5.4 on Windows 11 Fails with Linker Errors - Stack Overflow

programmeradmin4浏览0评论

I recently installed ESP-IDF v5.4 on Windows 11, but when I attempt to run idf.py ports, I encounter the following error:

[2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Espressif\tools\esp-clang\esp-18.1.2_20240912\esp-clang\bin\clang.exe CMakeFiles/cmTC_604d4.dir/testCCompiler.c.obj -o cmTC_604d4.exe -Wl,--out-implib,libcmTC_604d4.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
FAILED: cmTC_604d4.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Espressif\tools\esp-clang\esp-18.1.2_20240912\esp-clang\bin\clang.exe CMakeFiles/cmTC_604d4.dir/testCCompiler.c.obj -o cmTC_604d4.exe -Wl,--out-implib,libcmTC_604d4.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
ld.lld: error: unknown argument '--major-image-version'
ld.lld: error: unknown argument '--minor-image-version'
ld.lld: error: cannot open 0: No such file or directory
ld.lld: error: unable to find library -lkernel32
ld.lld: error: unable to find library -luser32
ld.lld: error: unable to find library -lgdi32
ld.lld: error: unable to find library -lwinspool
ld.lld: error: unable to find library -lshell32
ld.lld: error: unable to find library -lole32
ld.lld: error: unable to find library -loleaut32
ld.lld: error: unable to find library -luuid
ld.lld: error: unable to find library -lcomdlg32
ld.lld: error: unable to find library -ladvapi32
clang: error: ld command failed with exit code 1 (use -v to see invocation)

My Understanding:

It seems that the compilation command generated by Clang is incorrect. The ld.lld linker does not support the --major-image-version and --minor-image-version arguments, and it also fails to locate system libraries.

Questions:

Which linker is supposed to support --major-image-version and --minor-image-version? Are the missing libraries provided by the "CMake tools for Windows" and "Windows 10 SDK" that I installed, or should they be included in the ESP-IDF installation? Any insights on how to resolve this issue would be greatly appreciated!

I recently installed ESP-IDF v5.4 on Windows 11, but when I attempt to run idf.py ports, I encounter the following error:

[2/2] C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Espressif\tools\esp-clang\esp-18.1.2_20240912\esp-clang\bin\clang.exe CMakeFiles/cmTC_604d4.dir/testCCompiler.c.obj -o cmTC_604d4.exe -Wl,--out-implib,libcmTC_604d4.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
FAILED: cmTC_604d4.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Espressif\tools\esp-clang\esp-18.1.2_20240912\esp-clang\bin\clang.exe CMakeFiles/cmTC_604d4.dir/testCCompiler.c.obj -o cmTC_604d4.exe -Wl,--out-implib,libcmTC_604d4.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
ld.lld: error: unknown argument '--major-image-version'
ld.lld: error: unknown argument '--minor-image-version'
ld.lld: error: cannot open 0: No such file or directory
ld.lld: error: unable to find library -lkernel32
ld.lld: error: unable to find library -luser32
ld.lld: error: unable to find library -lgdi32
ld.lld: error: unable to find library -lwinspool
ld.lld: error: unable to find library -lshell32
ld.lld: error: unable to find library -lole32
ld.lld: error: unable to find library -loleaut32
ld.lld: error: unable to find library -luuid
ld.lld: error: unable to find library -lcomdlg32
ld.lld: error: unable to find library -ladvapi32
clang: error: ld command failed with exit code 1 (use -v to see invocation)

My Understanding:

It seems that the compilation command generated by Clang is incorrect. The ld.lld linker does not support the --major-image-version and --minor-image-version arguments, and it also fails to locate system libraries.

Questions:

Which linker is supposed to support --major-image-version and --minor-image-version? Are the missing libraries provided by the "CMake tools for Windows" and "Windows 10 SDK" that I installed, or should they be included in the ESP-IDF installation? Any insights on how to resolve this issue would be greatly appreciated!

Share Improve this question asked Mar 10 at 19:54 BaruchLiBaruchLi 1,1032 gold badges12 silver badges21 bronze badges 2
  • 1 That's a bit confusing. Those are all Windows libraries, and it should not have to build any Windows executables at all. The esp-clang compiler is a cross-compiler that builds for the ESP32 processor. Did you run install.bat? – Tim Roberts Commented Mar 10 at 20:02
  • I did run install.bat. The problem was caused by wrong current directory. I should run idf.py command under project directory. – BaruchLi Commented Mar 10 at 21:01
Add a comment  | 

1 Answer 1

Reset to default 0

The problem was caused by wrong current directory. I should run idf.py command under project directory and not under C:\Espressif\frameworks\esp-idf-v5.4

发布评论

评论列表(0)

  1. 暂无评论