Skip to content
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

Support cross-building #1

Open
fabled opened this issue Jun 18, 2017 · 8 comments
Open

Support cross-building #1

fabled opened this issue Jun 18, 2017 · 8 comments

Comments

@fabled
Copy link

fabled commented Jun 18, 2017

Is there some way to use CROSS_COMPILE or specify the cross-building toolchain to use?

@kamathba
Copy link

My primary use case for a c/c++ build system would be in a cross compiling environment as well. I'm playing around with places to add hooks to build.

One that pops to mind is allowing the user to override the config folder directory, or perhaps instead the initial specific config file that gets included. kamathba/build@7147959

@c3d
Copy link
Owner

c3d commented Jun 19, 2017

Actually, one of the first projects to use build was using it mostly for cross-compilation.

Typically, you would simply create a config.gcc-cross-arm.mk and set your BUILDENV to match. It may be as simple as:

CC=cross-gcc
CXX=cross-g++
LD=cross-ld
include $(BUILD)config.gnu.mk

Please re-open the issue if you feel this is not good enough.

@c3d c3d closed this as completed Jun 19, 2017
@fabled
Copy link
Author

fabled commented Jun 19, 2017

I would prefer that CROSS_COMPILE is considered automatically, or that there is a built in profile to account for it. I would not like to create config for each target I need to build, but pick the configuration from environment variable compatible with autotools. CROSS_COMPILE is used widely for this purpose, and most distro build systems set it appropriately.

@c3d
Copy link
Owner

c3d commented Jun 19, 2017

Makes sense.

@c3d c3d reopened this Jun 19, 2017
@c3d
Copy link
Owner

c3d commented Jun 19, 2017

Would something like a7e9b46 be the right direction?

What I'm not too sure about is: how to deal with the -I path. I'm surprised that at least on Fedora 26, the cross-compilers don't seem to set the right paths for include and libraries. Any suggestion?

@fabled
Copy link
Author

fabled commented Jun 19, 2017

Looks like right direction. Normally cross compilers are configured for sysroot, and often CFLAGS or similar will contain --sysroot=$target_root or similar. The affect of this is that all -I paths are searched under the given sysroot.

@ghost
Copy link

ghost commented Jun 27, 2017

The CFLAGS and others are usually (at least in case of yocto) setup using environment-setup-* file which is sourced into the shell running cross-compilation. See https://www.yoctoproject.org/docs/2.3/sdk-manual/sdk-manual.html for example.

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

No branches or pull requests

4 participants
@fabled @c3d @kamathba and others