No, this isn't the problem. The issue is that all android build output goes to a single central location and there is just one directory for host binaries. mksnapshot needs to be built with specific knowledge of the target arch, so if you build for arm you get a mksnapshot that will only work for arm, and then when you build for x86 it will use the already compiled arm-specific binary and fail. There's no problem with generating the makefiles; I need to be able to mangle the target names for things built for host.
There are other issues we are running into that also would be easier to solve if gyp understood cross compilation and architectures; the chromium gyp files need to know all four of the host and target os and architecture but obtains them in very haphazard ways, passed from build/android/envsetup.sh or guessed in a variety of ways in different places..
On Mon, Feb 25, 2013 at 11:01 AM, Torne (Richard Coles)Given that GYP lacks an intrinsic concept of host/target arch (beyond
<to...@google.com> wrote:
> No, this isn't the problem. The issue is that all android build output goes
> to a single central location and there is just one directory for host
> binaries. mksnapshot needs to be built with specific knowledge of the target
> arch, so if you build for arm you get a mksnapshot that will only work for
> arm, and then when you build for x86 it will use the already compiled
> arm-specific binary and fail. There's no problem with generating the
> makefiles; I need to be able to mangle the target names for things built for
> host.
the fact that such toolsets exist), and the most common way (eg: in
Chromium and Node) is to use a variable named target_arch, can you not
just incorporate target_arch into the output name of such
target-arch-dependent host targets?
{
'target_name': 'mksnapshot',
'product_name': 'mksnapshot-<(target_arch)'
'toolsets': ['host'],
...
}
It may be an unfounded concern, but I'm just trying to think of a
clean, cross-compiler friendly syntax that also keeps in line with
GYP's goal of being expressed in the lowest common denominator between
generators. (eg: why you cannot do configuration-specific sources,
even though all generator BUT xcode support them)
>I don't know if, in the context of other generators (particularly MSVS
> There are other issues we are running into that also would be easier to
> solve if gyp understood cross compilation and architectures; the chromium
> gyp files need to know all four of the host and target os and architecture
> but obtains them in very haphazard ways, passed from
> build/android/envsetup.sh or guessed in a variety of ways in different
> places..
and XCode), it becomes necessarily easier. For example, the MSVS
generator can only build one target name/configuration at a time. For
Chromium's use of NACL on Windows - which requires both a 32-bit and
64-bit helper executable - this has necessitated creating multiple
targets, distinguished by name, in order to fully express the build
dependency that a '32-bit Chromium' still needs a 64-bit helper
binary, for if/when it's executed on a 64-bit Windows.
I understand the desire to solve the problem for "just one generator",
but those approaches seem to make GYP even more unwieldy for the
general case (eg: Chromium's previous use of XCode's arch conditionals
- GCC_PREPROCESSOR_DEFINITIONS[arch=x86_64] ), so if a syntax is to
be proposed, I think it will have to be able to work well with all
generators.
In that case, a tentative +1. I know there has been discussion about trying to formalize some of the GYP best practice (eg: a bare bones equivalent to Chromium's build/common.gypi), and this seems in line with that.
I am not entirely sure it needs to be a built-in like OS, vs. part of a default set of variables, but I have no strong feelings either way.
>
> --
> Torne (Richard Coles)
> to...@google.com
On Mon, Feb 25, 2013 at 11:01 AM, Torne (Richard Coles)Given that GYP lacks an intrinsic concept of host/target arch (beyond
<to...@google.com> wrote:
> No, this isn't the problem. The issue is that all android build output goes
> to a single central location and there is just one directory for host
> binaries. mksnapshot needs to be built with specific knowledge of the target
> arch, so if you build for arm you get a mksnapshot that will only work for
> arm, and then when you build for x86 it will use the already compiled
> arm-specific binary and fail. There's no problem with generating the
> makefiles; I need to be able to mangle the target names for things built for
> host.
the fact that such toolsets exist), and the most common way (eg: in
Chromium and Node) is to use a variable named target_arch, can you not
just incorporate target_arch into the output name of such
target-arch-dependent host targets?
{
'target_name': 'mksnapshot',
'product_name': 'mksnapshot-<(target_arch)'
'toolsets': ['host'],
...
}
On Mon, Feb 25, 2013 at 11:01 AM, Torne (Richard Coles)IIUC you are saying that you build for arm, then build for x86 and the
<to...@google.com> wrote:
> No, this isn't the problem. The issue is that all android build output goes
> to a single central location and there is just one directory for host
> binaries. mksnapshot needs to be built with specific knowledge of the target
> arch, so if you build for arm you get a mksnapshot that will only work for
> arm, and then when you build for x86 it will use the already compiled
> arm-specific binary and fail. There's no problem with generating the
> makefiles; I need to be able to mangle the target names for things built for
> host.
mksnapshot binary (which is target specific) doesn't get rebuilt when
you switch? If it is target specific, then surely when you switch
target the compile flags (or something) change which should cause the
host binary to get rebuilt and overwrite the old one. Is this not
happening? Am I missing something here?
This sounds like a bug in the android build system to me. Surely if
the CFLAGS change it would rebuild the host binary? Or is that you
need the different mksnapshot binaries to exist on disk at the same
time, rather than one at a time?
> Also, even if this worked this would not really be an acceptable
> implementation; the Android build system expects that you can build any
> number of target configurations in parallel in one tree, and switch between
> them at will, and doing so shouldn't cause a binary to get recompiled every
> time. The build system assumes that host binaries only need to be built once
> no matter how many targets are built, and the only way I can see to work
> around this is to change the names of the host targets depending on the
> target architecture if the binaries in question depend on that.
So the android build system fundamentally can't cope with a host
binary that varies with target arch?
Is there a possibility to come at this from the other end of the
problem and create mksnapshot that is multi-arch?
This sounds like a bug in the android build system to me. Surely if
the CFLAGS change it would rebuild the host binary? Or is that you
need the different mksnapshot binaries to exist on disk at the same
time, rather than one at a time?
> Also, even if this worked this would not really be an acceptable
> implementation; the Android build system expects that you can build any
> number of target configurations in parallel in one tree, and switch between
> them at will, and doing so shouldn't cause a binary to get recompiled every
> time. The build system assumes that host binaries only need to be built once
> no matter how many targets are built, and the only way I can see to work
> around this is to change the names of the host targets depending on the
> target architecture if the binaries in question depend on that.
So the android build system fundamentally can't cope with a host
binary that varies with target arch?
Is there a possibility to come at this from the other end of the
problem and create mksnapshot that is multi-arch?