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

[intl4x] Issue with Native Assets Library Resolution in Dart Executables #927

Open
aliyazdi75 opened this issue Dec 13, 2024 · 4 comments
Open
Labels
package:intl4x type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@aliyazdi75
Copy link

aliyazdi75 commented Dec 13, 2024

When using the native-assets build feature in Dart, the executable fails to locate shared libraries (.so files) if the lib folder is placed in the same directory as the executable. It appears the executable is attempting to resolve the shared libraries relative to the above parent path.

The command:

dart --enable-experiment=native-assets build bin/main.dart --target-os=linux -o ./build  --target-os=linux -o ./build && mv ./build/main.exe ./build/exec

The output on running the app with the lib folder in the same directory as exe file:

ERROR: Invalid argument (5): Couldn't resolve native function 'ICUXDataProvider_create_compiled' in 'package:int14x/src/bindings/lib.g.dart': Failed to load dynamic library
'lib/libicu4x.so' relative to '/var/home/users/$USER/child/lib/exec': Failed to load dynamic library '/var/homeusersmountpoint/$USER/lib/libicu4x.so': /var/homeusersmountpoint/$USER/lib/libicu4x.so: cannot open shared object file: No such file or directory.

Expected Behavior:
I think if I'm not mistaken, the executable should locate the shared libraries from the lib folder in the same directory by default.

Actual Behavior:
The executable attempts to resolve the shared libraries from a parent directory or other unexpected paths, resulting in the error. This behaviour requires manually moving the lib folder one directory above the executable to work.

Note that I'm not sure if this is native-cli issue or intl4x.

@aliyazdi75 aliyazdi75 added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Dec 13, 2024
@aliyazdi75
Copy link
Author

/cc @mosuem we found another one 😄

@mosuem
Copy link
Member

mosuem commented Dec 17, 2024

So you mean the structure which is generated is

build/
  lib/intl4x.so
  app.exe

But what you actually have to manually do to make it work is

lib/intl4x.so
build/
  app.exe

?

@aliyazdi75
Copy link
Author

@mosuem Yes exactly. only the lib is called libicu4x.so.

@mosuem
Copy link
Member

mosuem commented Dec 19, 2024

I will try to reproduce this with the newest versions of native_*

cc @dcharkes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:intl4x type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants