Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2aot: fails to run from spaces in path name #37130

Closed
idraper opened this issue May 31, 2019 · 5 comments
Closed

dart2aot: fails to run from spaces in path name #37130

idraper opened this issue May 31, 2019 · 5 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. customer-dart-sass

Comments

@idraper
Copy link

idraper commented May 31, 2019

Dart SDK Version: Dart VM version: 2.3.1
OS: Windows 10

I did a raw install (completely uninstalled v2.2) to get version 2.3 to try and use the dart2aot tool as shown here.

// bin/main.dart
void main() => print('Hello World');

Running dart bin/main.dart output:

Hello World

as expected

Running dart2aot bin/main.dart bin/main.dart.aot gave the following error:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

As you'd expect, Dart is installed in the path C:\Program Files\... and the space was giving it a problem.

I was able to solve the problem by editing dart2aot.bat file directly by including quotes around the file paths.

Specifically, I changed:

REM Step 1: Generate Kernel binary from the input Dart source.
%DART% %GEN_KERNEL% --platform %VM_PLATFORM_STRONG% --aot -Ddart.vm.product=true -o %SNAPSHOT_FILE%.dill %SOURCE_FILE%

REM Step 2: Generate snapshot from the Kernel binary.
%GEN_SNAPSHOT% %GEN_SNAPSHOT_OPTION% %GEN_SNAPSHOT_FILENAME% %SNAPSHOT_FILE%.dill

to be:

REM Step 1: Generate Kernel binary from the input Dart source.
"%DART%" "%GEN_KERNEL%" --platform "%VM_PLATFORM_STRONG%" --aot -Ddart.vm.product=true -o "%SNAPSHOT_FILE%.dill" "%SOURCE_FILE%"

REM Step 2: Generate snapshot from the Kernel binary.
"%GEN_SNAPSHOT%" %GEN_SNAPSHOT_OPTION% "%GEN_SNAPSHOT_FILENAME%" "%SNAPSHOT_FILE%.dill"

After editing, both main.dart.aot and main.dart.aot.dill are generated.


Then, after running dartaotruntime bin/main.dart.aot it works as expected, printing out the same as when running from the dart command.

@idraper idraper changed the title dart2aot: fails to run from spaces in path name and then VM initialization fail dart2aot: fails to run from spaces in path name May 31, 2019
@vsmenon vsmenon added the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label May 31, 2019
@vsmenon
Copy link
Member

vsmenon commented May 31, 2019

@mit-mit @mraleph - should dart2aot issues be labeled as vm?

@mraleph
Copy link
Member

mraleph commented Jun 1, 2019

I guess we have no better label for these right now.

@mraleph mraleph assigned ghost Jun 1, 2019
@mraleph
Copy link
Member

mraleph commented Jun 1, 2019

Assigning to @cskau-g

@nex3
Copy link
Member

nex3 commented Aug 16, 2019

This is important for Sass as well; we'd like to transition our Chocolatey installation to AOT-compile the application at install time as a workaround for #28617, but if dart2aot can't reliably be run from a common Windows installation directory then that won't work.

@ghost
Copy link

ghost commented Nov 14, 2019

This issue should be resolved with dart2native having replaced dart2aot.

@ghost ghost closed this as completed Nov 14, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. customer-dart-sass
Projects
None yet
Development

No branches or pull requests

4 participants