binfmt_misc on Dart snapshots

51 views
Skip to first unread message

dan...@fablefactory.com.br

unread,
Mar 6, 2018, 6:37:58 PM3/6/18
to Dart Misc
Does anyone know how to use binfmt_misc on Ubuntu in order to run dart snapshots?

It would be really nice to run dart snapshots just as executable files on console, just like it is possible to do with luaJIT or Java.

Thanks,

Daniel

Faried Nawaz

unread,
Mar 12, 2018, 7:50:54 PM3/12/18
to mi...@dartlang.org
[resending -- gmane seems to have dropped my earlier email]

dan...@fablefactory.com.br writes:

> It would be really nice to run dart snapshots just as executable files
> on console, just like it is possible to do with luaJIT or Java.

These worked for me:

sudo update-binfmts --package dart \
--install dart-script /usr/bin/dart \
--magic '\xf5\xf5\xdc\xdc'
sudo update-binfmts --package dart \
--install dart-jit /usr/bin/dart \
--magic '\xdc\xdc\xf6\xf6'

This is for dart 2.0.0-dev.32.0 on a 64 bit Ubuntu 16.04 system. Make
the snapshots executable, and it should work.

I don't know if the magic numbers for the snapshots are correct, or will
change in the future. The numbers are the same for 1.24.3 on Mac
OS. The docs at https://github.com/dart-lang/sdk/wiki/Snapshots say

These snapshots are CPU architecture specific, so a snapshot created
by an x64 VM cannot run on an IA32 VM or vice versa. Also, because
different code is generated in production mode and checked mode, an
app snapshot created in production mode cannot be run in checked mode
or vice versa.


Faried.

Daniel Vieira

unread,
Mar 12, 2018, 10:23:22 PM3/12/18
to mi...@dartlang.org
Thank you so much for your time replying this. This was exactly what I was looking for.
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Reply all
Reply to author
Forward
0 new messages