You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
similar with #190 , my Dart library (no flutter) had 2 .so files: liba.so and libb.so, created by Process.start('make', ...) and I put them all in buildConfig.outputDirectory, it passed compilation, but run with an exception Failed to load dynamic library '.dart_tool/native_assets_builder/3e4910e7689af6c76b0eb2007f74b95f/out/liba.so': libb.so: cannot open shared object file: No such file or directory.
How should I write my build.dart?
const packageName ='my_pkg';
const _repoLibName ='liba.so';
const _depLibName ='libb.so';
Future<void> _builder(BuildConfig buildConfig, BuildOutput buildOutput) async {
final pkgRoot = buildConfig.packageRoot;
final proc =awaitProcess.start(
'make',
[
'-j',
_repoLibName,
],
workingDirectory: srcDir.path,
);
stderr.addStream(proc.stdout);
final linkMode =_linkMode(buildConfig.linkModePreference);
final libName = buildConfig.targetOS.libraryFileName(packageName, linkMode);
UrimoveLib(String name, String target) {
final uri = pkgRoot.resolve(p.join('src', name));
final file =File.fromUri(uri).resolveSymbolicLinksSync();
final targetUri = buildConfig.outputDirectory.resolve(target);
File(file).renameSync(targetUri.path);
return targetUri;
}
final libUri =moveLib(_repoLibName, libName);
moveLib(_depLibName, _depLibName);
buildOutput.addAsset(NativeCodeAsset(
package: packageName,
name:'src/lib_$packageName.dart',
linkMode: linkMode,
os: buildConfig.targetOS,
file: libUri,
architecture: buildConfig.targetArchitecture,
));
final src = [
'src/src/my_pkg.cpp',
'src/a/a.cpp',
'src/b/b.cpp',
];
buildOutput.addDependencies([
...src.map((s) => pkgRoot.resolve(s)),
pkgRoot.resolve('build.dart'),
]);
}
similar with #190 , my Dart library (no flutter) had 2 .so files: liba.so and libb.so, created by
Process.start('make', ...)
and I put them all inbuildConfig.outputDirectory
, it passed compilation, but run with an exceptionFailed to load dynamic library '.dart_tool/native_assets_builder/3e4910e7689af6c76b0eb2007f74b95f/out/liba.so': libb.so: cannot open shared object file: No such file or directory.
How should I write my
build.dart
?pubspec.yaml:
The text was updated successfully, but these errors were encountered: