Skip to content

Support cross-building #1

Open
Open

Description

@fabled

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

Activity

  1. kamathba commented on Jun 18, 2017

    @kamathba

    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

  2. c3d commented on Jun 19, 2017

    @c3d
    Owner

    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.

  3. fabled commented on Jun 19, 2017

    @fabled
    Author

    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.

  4. c3d commented on Jun 19, 2017

    @c3d
    Owner

    Makes sense.

  5. reopened this on Jun 19, 2017
  6. c3d commented on Jun 19, 2017

    @c3d
    Owner

    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?

  7. fabled commented on Jun 19, 2017

    @fabled
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions