Chapter 24. Cross-Platform Support

Table of Contents

24.1. Platform Selection
24.2. Dependencies and Platform Compatibility
24.3. Explicit Cross-Platform Dependencies
24.3.1. Interface Errors
24.4. Dependencies and Pass-through Build Items
24.5. Cross-Platform Dependency Example

24.1. Platform Selection

When abuild starts up, it determines a list of object-code platform types and, within each platform type, a list of platforms. Platforms are given initial priorities based on the order in which they are declared with later declarations having higher priority than earlier ones. (In this way, platforms added by plugins are preferred over internally defined ones.) By default, abuild builds each object-code build item on the highest priority platform in each of its platform types. Abuild may also choose to build an item on additional platforms to satisfy dependencies.

The list of platforms on which abuild will attempt to build an item may be overridden using platform selectors. Platform selectors may be specified in the ABUILD_PLATFORM_SELECTORS environment variable or on the command line using the --platform-selector or -p command-line flag. Each platform selector may refer to a specific platform type or may be a general selector for all platform types. There may be at most one selector for each platform type and at most one general selector. If multiple selectors for the sample platform type or multiple general selectors are specified, abuild chooses the last one. Selectors given on the command line always take precedence over those in the environment variable. This makes it possible for later options to override earlier ones or for the command line to override the environment. To specify multiple selectors in the environment, set the variable to contain multiple space-separated words. To specify multiple selectors on the command line, provide the command-line option more than once. For example:

--platform-selector selector [ --platform-selector selector ... ]


ABUILD_PLATFORM_SELECTORS="selector[ selector ... ]"

Each selector is of the form


If no platform-type is specified, then the selector applies to all object-code platform types. When applying selectors, abuild will always first try a selector for the specific platform type first. Only if there isn't one will abuild attempt to use the general selector.

The criteria field above may have one of the following forms:

  • option=option

  • compiler=compiler[.option]

  • platform=os.cpu.toolset.compiler[.option]

  • all

  • default

  • skip

The special skip selector prevents automatic selection of any platforms from the type. When it is used, no platforms from that platform type are selected by default, so no builds will be done in that platform type except when needed to satisfy a dependency. This could be useful if you only wanted to do embedded builds, for example. This is the only selector that can be used with the indep or java platform types. Starting with abuild 1.1.4, it is valid to specify skip without a platform type qualifier, which will suppress any default platform selection for any object code platform type. This could be used to build only indep and java, or it could be used to suppress all but a specific platform type by also providing a type-specific selector for the type you do want to build.

The default selector means to select whichever platform would be selected if no platform specifier were given. It must be used with a platform type qualifier. This is useful to direct abuild to use the default for a given platform type when a general specifier was used.

The other selectors are translated into an (os, cpu, toolset, compiler, option) tuple. Each field may be * or a platform field. The selector all is equivalent to *.*.*.*.*. The empty string may not be explicitly specified, but omitted fields are mapped to the empty string. For example, compiler=x is equivalent to ("", "", "", "x", ""). Any empty string field except for option matches the corresponding field of the highest priority platform (the last one declared) in the list of platforms for the given type. This is the always the first platform listed for the platform type by abuild --list-platforms. An empty option field means that the option field of the platform must be empty.

When picking platforms on which to build by default, abuild will always pick the first platform that matches the criteria. If there are no matches, it will pick the first platform of the platform type. If any of the fields of the selector are equal to *, then abuild will select all platforms that match the criteria, again falling back to only the first platform in the type if there are no matches.

Here are several examples. For purposes of discussion, assume that we have the following platforms, shown here by type:


If no platform selectors were provided, we would build native build items with linux.x86.rhel4.xlc and vxworks build items with vxworks.ppc.6_3.vxgcc. Here are several platform selectors along with a description of what they mean:


On the native platform type, build with the first platform that has the debug option. If none, build with the first platform regardless of its options. (This is always the behavior when there are no platforms that fit the criteria, so this will not repeated for each example.) In this case, we would build native items on linux.x86.rhel4.xlc.debug. Build the default platform for vxworks.


On the native platform type, build with compiler gcc with the release option. In this case, that would be linux.x86.rhel4.gcc.release. Build the default platform for vxworks.

compiler=gcc vxworks:default

On all object-code platform types except vxworks, build with gcc with no options. For native, this is linux.x86.rhel4.gcc. Explicitly build the default platform for vxworks.


On the native platform type, build all gcc platforms with all options, including the gcc platform without any options. That would include linux.x86.rhel4.gcc, linux.x86.rhel4.gcc.debug, and linux.x86.rhel4.gcc.release. Build the default platform for vxworks.


On the native platform type, build all platforms that have the debug option: linux.x86.rhel4.xlc.debug and linux.x86.rhel4.gcc.debug. Build the default platform for vxworks.


On the native platform type, build all platforms: linux.x86.rhel4.xlc, linux.x86.rhel4.xlc.debug, linux.x86.rhel4.xlc.release, linux.x86.rhel4.gcc, linux.x86.rhel4.gcc.debug, and linux.x86.rhel4.gcc.release. Build the default for vxworks.


On vxworks, build for all platforms that have the debug option: vxworks.x86.6_3.vxgcc.debug. Build the default platform for native.


On vxworks, build all platforms that have x86 as the cpu field: vxworks.x86.6_3.vxgcc and vxworks.x86.6_3.vxgcc.debug.

skip indep:skip java:skip vxworks:default

Skip all platform types except vxworks, and build with the default platform for vxworks. Note that specifying skip by itself only skips object-code platform types, so we have to explicitly skip indep and java as well.


Skip the vxworks platform type; no vxworks builds will be done except as needed to satisfy dependencies. Native builds are done normally.


For all otherwise unspecified platform types, build for all platforms that have an empty option field: vxworks.ppc.6_3.vxgcc, vxworks.x86.6_3.vxgcc, linux.x86.rhel4.xlc, and linux.x86.rhel4.gcc.


For all otherwise unspecified platform types, build for all platforms. This is the same specifying the platform selector all.