Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Cross building model] Cross compiling packages with build requirements #3329

Closed
GeorgeScrivener opened this issue Aug 10, 2018 · 6 comments
Closed

Comments

@GeorgeScrivener
Copy link

GeorgeScrivener commented Aug 10, 2018

I’ve had some issues when cross compiling a build requirement.

In my case I'm trying to cross compile a library (call it PackageA) that has a build requirement on flatbuffers. flatbuffers creates an executable, flatc, that runs on the build machine and creates cpp files from some definitions.

I cross compile PackageA from amd64 for arm with [env] set in my profile:

[env]
CC={ARM C COMPILER}
CXX={ARM C++ CCOMPILER}
PATH=[{PATH TO COMPILER}]

The issue is that when conan builds flatbuffers it's using the env from the profile, and therefore flatc gets built for arm. This means it won't run on the build machine which is amd64.

PackageA itself is a library and so can be added as a dependency from other packages.

I've mentioned this on the slack channel and got some good suggestions, but it doesn't seem like a solved issue.

When I first ran in to this issue I expected to find compiler_build & maybe env_build settings in the profile to match the os_build & arch_build cross compilation options, though I'm not sure whether adding these would create other issues.

What's the best way to solve this issue more generally? We have quite a few build requirements that I'd like to use from conan.

@niosHD
Copy link
Contributor

niosHD commented Aug 11, 2018

If I understood it correctly, your issue is the same as discussed in #2301. I am not aware of any native conan support for working with mixed architectures in a single package.

@GeorgeScrivener
Copy link
Author

Yes that looks to be pretty much the same issue I'm having.
It would be nice to be able to specify that toolchain packages don't apply to build requirements.

@lasote lasote changed the title Cross compiling packages with build requirements [Cross building model] Cross compiling packages with build requirements Aug 15, 2018
@lasote
Copy link
Contributor

lasote commented Aug 15, 2018

Currently the only way would be to create a separate package for flatc and require it as a build_require. This flatc package can be built first and then applied to the needed packages.

@GeorgeScrivener
Copy link
Author

Using build_require doesn't actually work as expected because CC & CXX get applied to build_requires.
To get this to work, I'd have to create a toolchain to set the env variables. But this would only work for build_requires in the root project, because any nested build requires will be built using the toolchain's env.

@lasote
Copy link
Contributor

lasote commented Sep 12, 2018

Using build_require doesn't actually work as expected because CC & CXX get applied to build_requires.

Yes, because of that I suggested This flatc package can be built first and then applied to the needed packages. I meant: first build the flatc in an isolated way, generating the needed binary package with one profile. Then build your project with a different one.

@memsharded
Copy link
Member

Cross-compilation model has massively changed since then, with the 2 profiles approach. Closing this ticket as outdated.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants