Open johningve opened 10 months ago
This should be possible. I'd recommend using the conf
variables instead though to set the cross compiler, CMake toolchain, and compiler / linker flags as needed. See here.
Hi, any update on this? I've a similar issue, I'm trying to cross compiling a project from a mac system to a raspberry. The project uses conan as package manager and I would like to build it using clang
Hi @johningve @y9luiz
Sorry for the long delay 😞
Cross-compiling with Clang should not be an issue at all, but it could be challenging if you are still using the legacy toolchains and build-helpers. We recommend migrating to the modern tools (see more info here), and, if possible, to Conan v2 for sure.
For instance:
host_profile
[settings]
arch=armv8
os=Linux
compiler=clang
compiler.version=16
compiler.libcxx=libstdc++11
[buildenv]
# extra env flags: AR, AS, LD, ...
[conf]
tools.build:cxxflags=["--flag1", "--flag2"]
tools.build:cflags=["--flag3", "--flag4"]
tools.build:compiler_executables={"c": "clang-16", "cpp": "clang++-16"}
tools.build:sysroot=/usr/aarch64-linux-gnu
I also recommend reading the cross-building section with Conan v2.
What is your question?
Hi! I want to cross compile for an
armv8
Linux host usingclang
on Linux.I have tried to follow the documentation, but I'm having the problem that several recipes are built for
x86_64
instead. I suspect this is because myclang
compiler supports bothx86_64
(the default) andarmv8
, and the target needs to be specified using the--target
flag. However, if I add this flag to my build profile via CXXFLAGS it breaks other recipes that need to build native tools.I noticed that the documentation seems to be assuming "gcc-style" cross compilation where you have a separate compiler named
aarch64-linux-gnu-gcc
or something. Does conan actually support this "clang-style" cross compiling?I have set up the profile like this:
File (linux-base)
File (linux-base-armv8)
I am using conan 1.61 for now, but may consider updating to 2.0 if that supports my use case.
Have you read the CONTRIBUTING guide?