-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Cross-compiling #180
Comments
I am attempting to use What I noticed so far (when cross compiling for the target board) is:
|
|
To follow up on the |
As for #!/bin/sh
cppcheck -D__GNUC__ \
--project=build/arm-cortex-m4-gcc-debug/compile_commands.json \
--platform=cmake/arm-cortex-m4-platform.xml \
--cppcheck-build-dir=build/arm-cortex-m4-gcc-debug/cppcheck \
--enable=style,performance,warning,portability \
--inline-suppr \
--suppress=cppcheckError \
--suppress=internalAstError \
--suppress=unmatchedSuppression \
--suppress=passedByValue \
--suppress=syntaxError \
--inconclusive \
--std=c11 \
--template=gcc \
--verbose Everything appears to be working fine. But when I run it from within cmake with the same parameters, all sorts of weirdness (including regular crashes) happens... |
@abeimler Could you add some docs about Toolchains to the Readme? I'd like to tag a new release, but we should add some basic docs for the new features. |
Well, writing docs is not my most vital skill ^^
# opt-in cross-compiling
option(ENABLE_CROSS_COMPILING "Detect cross compiler and setup toolchain" OFF)
if(ENABLE_CROSS_COMPILING)
enable_cross_compiler()
endif()
run_vcpkg() # run_vcpkg AFTER enable_cross_compiler, when using vcpkg
The option for
Alternatively, you can set the (cross)compiler directly with: For
For (bare-metal) you don't need/can't(?) set
Example:
Notes
(@aminya Hope this can help you to write a proper section) |
Related to this discussion |
Another remaining issue for Cross-compiling is that its options are using global CMake |
It would also be nice if clang based tools (clang-tidy and iwyu) actually worked when cross compiling, I have some ideas on how to make them work but they require refactoring in lot's of places, I may post a draft PR in the future with my current progress. |
Is it intended to add support for clang/llvm-libcxx for cross-compilation? Currently the zig toolchain allows portability to the LLVM toolchain. Integration with CMake is a bit problematic due to the space between the The main difference between zig and conventional toolchain is that for C++ it restricts to using libcxx by default. However, it is possible to use another ABI. e.g.: References |
enable_cross_compiler()
andCMAKE_TOOLCHAIN_FILE
Experimental: Cross-compiling with ARM cross-compiler #188Dockerfile.mingw
so setup-cpp can install the cross-compiler (MinGW) install mingw with setup-cpp #233Taskfile
in add cross-compiling support from project_options cpp_vcpkg_project#15Future Ideas
Usage
The best you can do is add this to your cmake file:
and run cmake with these additional arguments:
See Taskfile and docker examples
Notes
enable_cross_compiler()
andrun_vcpkg()
can help you set up Community triplets easierOriginally posted by @abeimler in #171 (comment)
Upvote & Fund
I am using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered: