Sdk: Binary file from dart2native can't be used from Linux's path

Created on 16 Oct 2019  路  8Comments  路  Source: dart-lang/sdk

The single binary files that created with dart2native can't be put and used from Linux's path, it will print the usage message instead, like:

$ dart2native hello.dart
Generated: /home/blahblah/hello.exe

$ ./hello.exe
hello world

$ sudo mv hello.exe /usr/local/bin
$ hello.exe
Usage: dart [<vm-flags>] <dart-script-file> [<script-arguments>]

I've found this issue with Dart 2.6.0-dev.7.0 on Linux.

area-vm type-bug vm-native

All 8 comments

Thank you for reporting this issue. I'm investigating.

In the meantime, can I get you to test if you're able to work around the issue by running the binary via a path instead of just the binary name? I.e.:
$ cd /usr/local/ ; bin/hello.exe
or
$ /usr/local/bin/hello.exe
or even

$ `which hello.exe`

Both ways of running it, from absolute/relative-path, work correctly.
Thank you for pointing out the workaround.

This should now have been fixed at HEAD so I'll go ahead and close this issue.
Note that it might still be a short while before the fix lands in dev and stable releases.

Does someone know if version 2.7.0 already includes this fix ? I think i have the same problem after generating an executable on Ubuntu and uploading it via SCP to a Debian machine. I try to run the executable on the Debian machine and it prints out the usage message.

@cskau-g Do you have any information about my question ?

@cskau-g I tried it again with version 2.7.1 but still the same problem.

Does someone know if version 2.7.0 already includes this fix ? I think i have the same problem after generating an executable on Ubuntu and uploading it via SCP to a Debian machine. I try to run the executable on the Debian machine and it prints out the usage message.

@Ephenodrom, It should work in 2.7.1, yes. Testing it locally confirms this as well.

It is of course possible you're running into a separate problem.
Are both systems X64? Perhaps there are some significant differences between the libc/kernels that cause loading the embedded ELF to fail?

You could try testing dart2native locally on your Debian system and verify you can at least run executables built there.

If you continue to experience issues like this, feel free to start a new issue to track this.
But in that case please include as much information about the systems as possible, to help make debugging a little easier.

Thanks.

Hello @cskau-g
I think the problem comes from a different issue and i think it is more of a problem of my webhosting server where i have limited access to the OS it is running on. I opened another issue to make it clear whether is is a bug or a problem from my site.

https://github.com/dart-lang/sdk/issues/40405

Was this page helpful?
0 / 5 - 0 ratings