@@ -10,21 +10,35 @@ import 'dart:io';
1010
1111import 'package:code_assets/code_assets.dart' ;
1212import 'package:hooks/hooks.dart' ;
13+ import 'package:logging/logging.dart' ;
1314import 'package:native_toolchain_c/native_toolchain_c.dart' ;
1415import 'package:native_toolchain_c/src/native_toolchain/apple_clang.dart' ;
16+ import 'package:native_toolchain_c/src/native_toolchain/clang.dart' ;
1517import 'package:native_toolchain_c/src/tool/tool_resolver.dart' ;
1618import 'package:native_toolchain_c/src/utils/run_process.dart' ;
1719import 'package:test/test.dart' ;
1820
1921import '../helpers.dart' ;
2022
21- void main () {
23+ void main () async {
2224 if (! Platform .isMacOS) {
2325 // Avoid needing status files on Dart SDK CI.
2426 return ;
2527 }
2628
27- const targets = [
29+ final context = ToolResolvingContext (logger: Logger .detached ('main' ));
30+ final lldInstances = await lld.defaultResolver! .resolve (context);
31+ final lldAvailable = lldInstances.isNotEmpty;
32+ final lldPath = lldAvailable ? lldInstances.first.uri.toFilePath () : 'ld.lld' ;
33+
34+ if (! lldAvailable) {
35+ stderr.writeln (
36+ 'ld.lld not found. Linux cross-compilation tests will fail.' ,
37+ );
38+ stderr.writeln ("Install with 'brew install lld' on macOS." );
39+ }
40+
41+ final targets = [
2842 (OS .macOS, Architecture .arm64),
2943 (OS .macOS, Architecture .x64),
3044 (OS .linux, Architecture .arm),
@@ -135,7 +149,7 @@ void main() {
135149 // Only homebrew lld can link for linux, and we don't have a
136150 // sysroot so we can't use stdlibs / C-runtime files.
137151 if (os == OS .linux) ...[
138- '--ld-path=ld.lld ' ,
152+ '--ld-path=$ lldPath ' ,
139153 '-nostartfiles' ,
140154 '-nostdlib' ,
141155 ],
0 commit comments