Skip to content

Instantly share code, notes, and snippets.

@maks
Created September 6, 2020 08:14
Show Gist options
  • Save maks/eb393d2ed4e19f08c460b03e1357af4d to your computer and use it in GitHub Desktop.
Save maks/eb393d2ed4e19f08c460b03e1357af4d to your computer and use it in GitHub Desktop.
getting dart2native Linux executables running on FreeBSD

I used a FreeBSD 11 VM runing on GCE

To get Linux exe's working on BSD

  • compile with dart2native, eg I used DSG from a zip of exe's built here: https://github.com/maks/dsg/actions/runs/198892581
  • sudo brandelf -t linux exe-filename
  • edit /etc/rc.conf and add: linux_enable="YES"
  • then: sudo service abi restart
  • cd /usr/ports/emulators/linux_base-c7 then make install
  • go back to where you have your dart2native linux exe and run it

For some reason the dart2native exe runs the Dart VM but doesn't run the aot snapshot thats embedded in it. eg. I see:

$ ./dsg
Usage: dart [<vm-flags>] <dart-script-file> [<script-arguments>]

Executes the Dart script <dart-script-file> with the given list of <script-arguments>.

Common VM flags:
--enable-asserts
...

I'm not sure why that's happening but I ran out of time to investigate further, but it does seem to demonstrate to me that the Linux DartVM thats generated for dart2nativeseems to be able to run on FreeBSD 11 with its Linux x64 compat layer.

@RandalSchwartz
Copy link

Boy, if you ever get this working, I'd be interested too. And beware, dart2native has been replaced in mostly name only with dart compile exe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment