dart2aot --help prints:
Usage: dart2aot [options] <dart-source-file> <dart-aot-file>
Dart AOT (ahead-of-time) compile Dart source code into native machine code.
This indicates that there are options that can be passed, but it doesn't indicate what they are.
Hi Natalie,
have you found details on this?
Also, for me, while doing "dart2aot main.dart main.dart.aot" from the project directory, it shows
"C:\Program' is not recognized as an internal or external command,
operable program or batch file."
System: windows7
Thanks,
Gaurav
Here facing with the same issue, @GauravPatni
@GauravPatni @sayhicoelho I experienced this problem ('C:\Program' not recognized...) and created an issue here with my workaround until the issue is resolved officially:
After some digging, the accepted options are:
--packages--enable-asserts--build-elf - Build an assembly file that is then assembled into an ELF format object--tfa, --no-tfa - "Enable global type flow analysis and related transformations in AOT mode."-Dfoo, -Dfoo=bar - these options are passed directly to gen_kernel-- are passed directly to gen_snapshot.gen_kernel = dart $DART_SDK/bin/snapshots/gen_kernel.dart.snapshot
and gen_snapshot = $DART_SDK/utils/gen_snapshot (not a Dart file, it's a standalone executable)
Hopefully this is helpful to someone. This Github issue was the first result for "dart2aot options", so maybe it will be.
Nice detective work! :male_detective: Can you tell if --tfa is enabled by default?
Thanks! And yes, it is:
--[no-]tfa Enable global type flow analysis and related transformations in AOT mode.
(defaults to on)
The current dart2native does print available options:
% dart2native --help
Usage: dart2native <main-dart-file> [<options>]
Generates an executable or an AOT snapshot from <main-dart-file>.
-D, --define=<key=value> Set values of environment variables. To specify multiple variables, use multiple options or use commas to separate key-value pairs.
E.g.: dart2native -Da=1,b=2 main.dart
--enable-asserts Enable assert statements.
-h, --help Display this help message.
-k, --output-kind=<aot|exe>
[aot] Generate an AOT snapshot.
[exe] (default) Generate a standalone executable.
-o, --output=<path> Set the output filename. <path> can be relative or absolute.
E.g.: dart2native main.dart -o ../bin/my_app.exe
-p, --packages=<path> Get package locations from the specified file instead of .packages. <path> can be relative or absolute.
E.g.: dart2native --packages=/tmp/pkgs main.dart
-S, --save-debugging-info=<path> Remove debugging information from the output and save it separately to the specified file. <path> can be relative or absolute.
-v, --verbose Show verbose output.
So I'm assuming this issue has been addressed.