Posts

Showing posts with the label cross-copilation

Compilation from macOS(Intel) to linux x86_64 finaly works. Cross compilation of the rust code with bazel. Part 2.

This is the continuation of cross-compilation  topic that I've started in previous part What? Do I really need to configure C++ compiler to compile rust? Cross compilation of the rust code with bazel. Part 1. Since we need to add C++ cross-compilation toolchain, let's add the pure C++ project. This will help us to test the C++ toolchain separately I've added a typical C++ hello world impliemntaion and a BUILD file for it: cc_binary ( name = "hello-world" , srcs = [ "main.cpp" ], ) And our goal is to make it compilable for linux by command: bazel build //cpp/hello_world:hello-world --platforms=//:x86_64-linux --incompatible_enable_cc_toolchain_resolution If we just try it, we get and error,  (23:01:17) ERROR: /private/var/tmp/_bazel_evgenypetrov/e83d964deb47c21842622d1b7ffa55fc/external/bazel_tools/tools/cpp/BUILD:58:19: in cc_toolchain_alias rule @baze l_tools//tools/cpp:current_cc_toolchain: Unable to find a CC toolchain using toolchain resolution. ...

What? Do I really need to configure C++ compiler to compile rust? Cross compilation of the rust code with bazel. Part 1.

We deploy to several different platforms. x86_64 - Linux containers armv7 - linux boards  arm64 - linux boards mipsel - linux boards  For the development we use x86_64 and arm64 mac OS and x86_64 linux laptops. Obviously we need to cross-compile our software. Till now we are mostly doing it using `cross-rs` for cross-compiling rust. It works well, only problem is that it is not part of our bazel build, and therefore it is running only when needed, takes more time etc. In the next weeks I plan to support cross-compilation for our target platforms using bazel. Cross-compilation support matrix Host OS x86_64 linux armv7 linux mips linux x86_64 mac os x86_64 linux ✅ native x86_64 mac OS 🔄 in progress ✅ native arm64 mac OS   I'll be updating demo-repository as I progress. In this post I'll start from some basic experiments/configurations. What? Do...