Skip to content

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

Open
@aliyazdi75

Description

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.

Metadata

Assignees

No one assigned

    Labels

    package:intl4xtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions