Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helpers for discovering dynamic dependencies of dylibs #191

Open
dcharkes opened this issue Nov 6, 2023 · 0 comments
Open

Helpers for discovering dynamic dependencies of dylibs #191

dcharkes opened this issue Nov 6, 2023 · 0 comments
Labels

Comments

@dcharkes
Copy link
Collaborator

dcharkes commented Nov 6, 2023

When dealing with:

We'd like users to not have to manually make the transitive closure of dependencies. We should provide some helper code to do this.

Rough sketch:

Set<String> transitiveDeps(String dylib) {
  final all = <String>{};
  final worklist = [dylib];
  while (worklist.isNotEmpty) {
    final current = worklist.removeLast();
    for (final path in depsOfDylib(current)) {
      if (all.add(path)) {
        worklist.add(path);
      }
    }
  }
  return all;
}

Set<String> depsOfDylib(String dylib) {
  final result = Process.runSync('otool', ['-L', dylib]);
  return regexp
      .allMatches(result.stdout)
      .map((match) => match.namedGroup('path')!)
      .toSet();
}

final regexp = RegExp(r'^\s+(?<path>[^\s]*)\s+', multiLine: true);
final homebrewDir = '${Platform.environment['HOME']}/.homebrew';

We'd need something for all OSes.

Thanks @mkustermann for reporting and the sketch!

@dcharkes dcharkes added P3 A lower priority bug or feature request package:native_assets_cli package:native_toolchain_c labels Nov 6, 2023
HosseinYousefi pushed a commit that referenced this issue Nov 16, 2023
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 9b86bbe88a8152e5b9e6c15fd2e0efdd2994ffb6 to ea15b3b99cdc9ac45af1882d085e3f9297a75a8b.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@9b86bbe...ea15b3b)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
HosseinYousefi pushed a commit that referenced this issue Nov 16, 2023
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 9b86bbe88a8152e5b9e6c15fd2e0efdd2994ffb6 to ea15b3b99cdc9ac45af1882d085e3f9297a75a8b.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@9b86bbe...ea15b3b)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@dcharkes dcharkes added this to the Native Assets v1.x milestone Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant