Answer
When a required external library lacks compatibility across all defined compilation targets in Haxe, the build process fails with a specific error indicating the library has no supported targets for the current configuration.
Confirmed Behavior
Haxe's dependency resolution checks target compatibility during the haxelib run hxresolve phase, which occurs before compilation begins. If no declared targets match the current build configuration, compilation stops with an error message such as:
Library 'example-lib' has no supported targets for the current configuration
Configuration Overrides
Yes, there are documented mechanisms to override target-specific library constraints:
- Force inclusion via build flags: Use
-D force-lib-name to bypass compatibility checks, though this risks runtime failures.
- Custom build.hxml: Define explicit library paths and skip dependency resolution entirely.
- Library manifest modification: Edit the library's
haxelib.json to add missing target declarations (requires local modification).
Verification Steps
To diagnose target compatibility issues:
- Run
haxelib list to check installed library versions and declared target support.
- Use
haxe -log flag to see detailed dependency resolution and target compatibility checking during build.
- Examine library's
haxelib.json manifest file to verify declared target compatibility entries.
Important Cautions
Forcing compilation with incompatible libraries may result in runtime errors rather than build failures, making debugging more difficult. Target compatibility declarations in older libraries may be outdated or incomplete, potentially causing false negatives.