-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
cmake: Support building inside MinGW/MSYS environment on Windows #45383
Comments
This happens when you have a dirty cache. Try deleting the toolchain cache directory (one that contains Also, Zephyr SDK is now available on Windows -- please use the Zephyr SDK whenever possible. |
I removed both generated files and cache ones before submitting this bug. Also, I'd prefer use MinGW-w64 than Native Windows SDK (as I'm a Unix user). Also, I've one patch to submit to make the whole Zephyr compile & run on QEMU. |
Using MSYS2/mingw64, the build environment is completely broken (this is not supported anyway):
Using the MinGW environment included in "Git for Windows" (i.e. This problem is not reproducible with the above configuration. It might be failing on your system because you are using the MinGW CMake and Ninja and that is somehow breaking build system, but that is not a supported configuration anyway. If you are forced to use Windows, go with either Windows native tools (you can still use bash shell with
|
I fixed that first error with a 'pull request' I'll push in few minutes. Well, using native Windows tools under MinGW is not my choice because I try not to "mix" environment as much as possible. Finally, it is up-to-you. I agree that MinGW is not supported at all, but today it is "only" 2 minor patches that does not impact other builds (from what I've tested/seen) -> minor effort for supporting another Host -> great :) |
Have you tried building various tests using the Also
If the fix is relatively simple, I am not opposed to adding the MinGW/MSYS support but it likely is not going to be. |
Marking this as an enhancement, since this is not really a bug as described above. |
Just out of curiosity and also to document the MinGW/MSYS2 developer experience for future reference, I did a brief investigation and found a series of problems:
In summary, unless you like making your life hard for no good reason, don't do this. p.s. note that these are just some of the problems I found; there are likely tons more. |
Also note that MSYS2 support has been explicitly removed in #11300. |
Thank you for giving it a try!
Sorry, I didn't find it on my search I never used
That's really easy! Hope I can keep it that way :) |
Hi @tejlmand, This issue, marked as an Enhancement, was opened a while ago and did not get any traction. It was just assigned to you based on the labels. If you don't consider yourself the right person to address this issue, please re-assing it to the right person. Please take a moment to review if the issue is still relevant to the project. If it is, please provide feedback and direction on how to move forward. If it is not, has already been addressed, is a duplicate, or is no longer relevant, please close it with a short comment explaining the reason. @lescopc you are also encouraged to help moving this issue forward by providing additional information and confirming this request/issue is still relevant to you. Thanks! |
Describe the bug
During 'cmake' step, Zephyr fails to auto-detect the 'gnuarmemb' toolchain because the toolchain fails to compile a dummy C file
To Reproduce
cmake -DBOARD=qemu_cortex_m3 -DZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb -DGNUARMEMB_TOOLCHAIN_PATH=/c/Users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi %ZEPHYR_BASE%/samples/hello_world
Expected behavior
[...]
-- Found toolchain: gnuarmemb (/c/Users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi)
[...]
-- The C compiler identification is GNU 10.3.1
-- The CXX compiler identification is GNU 10.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /c/Users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
[...]
Impact
showstopper
Logs and console output
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /c/Users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi/bin/arm-none-eabi-gcc.exe
Build flags:
Id flags:
The output was:
1
c:/users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: c:/users/%USER%/gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/10.3.1\libc.a(lib_a-exit.o): in function
exit': /data/jenkins/workspace/GNU-toolchain/arm-10/src/newlib-cygwin/newlib/libc/stdlib/exit.c:64: undefined reference to
_exit'collect2.exe: error: ld returned 1 exit status
Environment
/mingw64/bin/cmake
/mingw64/bin/python3
How to Fix
diff --git a/cmake/toolchain/gnuarmemb/generic.cmake b/cmake/toolchain/gnuarmemb/generic.cmake
index 1ea30ab70d..f44aeffaae 100644
--- a/cmake/toolchain/gnuarmemb/generic.cmake
+++ b/cmake/toolchain/gnuarmemb/generic.cmake
@@ -24,6 +24,7 @@ set(BINTOOLS gnu)
set(CROSS_COMPILE_TARGET arm-none-eabi)
set(SYSROOT_TARGET arm-none-eabi)
+set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
set(CROSS_COMPILE ${TOOLCHAIN_HOME}/bin/${CROSS_COMPILE_TARGET}-)
set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET})
The text was updated successfully, but these errors were encountered: