Skip to content

Crash with "Invalid build root." #27328

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

Closed
jmesserly opened this issue Sep 13, 2016 · 10 comments
Closed

Crash with "Invalid build root." #27328

jmesserly opened this issue Sep 13, 2016 · 10 comments
Labels
closed-duplicate Closed in favor of an existing report dev-compiler-ux web-dev-compiler

Comments

@jmesserly
Copy link

From @hterkelsen on April 28, 2016 17:46

We're sorry, you've found a bug in our compiler.
You can report this bug at:
https://github.com/dart-lang/dev_compiler/issues

Please include the information below in your report, along with
any other information that may help us track it down. Thanks!

dartdevc arguments: compile -o a.js /usr/local/google/home/het/Code/ddc_test/hello.dart
dart --version: 1.16.0-dev.5.0 (Wed Apr 13 04:21:21 2016) on "linux_x64"
Invalid build root.  /usr/local/google/home/het/Code/dev_compiler/ does not contain /usr/local/google/home/het/Code/ddc_test/hello.dart
#0      jsLibraryName (package:dev_compiler/src/compiler/code_generator.dart:3864:5)
#1      CodeGenerator._emitModule (package:dev_compiler/src/compiler/code_generator.dart:199:32)
#2      CodeGenerator.compile (package:dev_compiler/src/compiler/code_generator.dart:141:18)
#3      ModuleCompiler.compile (package:dev_compiler/src/compiler/compiler.dart:95:26)
#4      CompileCommand.run (package:dev_compiler/src/compiler/command.dart:56:36)
#5      CommandRunner.runCommand.<anonymous closure> (package:args/command_runner.dart:176:22)
#6      Future.Future.sync (dart:async/future.dart:168)
#7      CommandRunner.runCommand (package:args/command_runner.dart:129:16)
#8      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:103:29)
#9      Future.Future.sync (dart:async/future.dart:168)
#10     CommandRunner.run (package:args/command_runner.dart:103:11)
#11     _runCommand.<_runCommand_async_body> (file:///usr/local/google/home/het/Code/dev_compiler/bin/dartdevc.dart:61:18)
#12     Future.Future.microtask.<anonymous closure> (dart:async/future.dart:144)
#13     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#14     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#15     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#16     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

That file definitely exists though...

$ ls /usr/local/google/home/het/Code/ddc_test/hello.dart
/usr/local/google/home/het/Code/ddc_test/hello.dart

Copied from original issue: dart-archive/dev_compiler#530

@jmesserly
Copy link
Author

From @vsmenon on April 28, 2016 17:49

So the "--build-root" defines a root. Library names (inside the generated JS) are relative to this root directory. If not passed in, it defaults to the current working directory. The compiler is complaining that the compiled file is not within the build root directory.

You can fix by passing --build-root /usr/local/google/home/het/Code/ddc_test.

@jmesserly
Copy link
Author

From @hterkelsen on April 28, 2016 17:52

Got it. Adding the build root made it work. Still, I don't think this should cause the compiler to crash.

@jmesserly
Copy link
Author

From @vsmenon on April 28, 2016 17:54

Yeah, we should give a better error. No reason we can't catch / report an error at the entry point and give a nicer error.

@jmesserly
Copy link
Author

but if it's crashing without build-root, that's a bug :)

@jmesserly
Copy link
Author

@hterkelsen @vsmenon -- have a look at how we handle a missing -o option, same trick should work.
However -- we really really should autodetect pubspec.yaml. Requiring a build root is super annoying and has no user benefit 99% of the time

@jmesserly
Copy link
Author

just hit this again. I'm going to fix it, it makes it hard to iterate on a small test

@jmesserly
Copy link
Author

started a refactor, it's not quite as straightforward as I was hoping, going to leave for now but hope we can pick this back up after P1's are fixed

@a-siva
Copy link
Contributor

a-siva commented Oct 26, 2016

I get a similar crash with command line
dartdevc arguments: --dart-sdk=/usr/local/google/home/asiva/workspace/dart-be/sdk/out/ReleaseX64/dart-sdk --library-root=~/tmp -o /tmp/out.js /usr/local/google/home/asiva/tmp/hello.dart
dart --version: 1.21.0-edge.103881d01c6aa2ab385f66bda0c2f5feb9cbb206 (Wed Oct 26 01:02:55 2016) on "linux_x64"

Invalid library root. /usr/local/google/home/asiva/workspace/dart-be/sdk/~/tmp/ does not contain /usr/local/google/home/asiva/tmp/hello.dart
#0      jsLibraryName (package:dev_compiler/src/compiler/code_generator.dart:5544)
#1      CodeGenerator._emitModule (package:dev_compiler/src/compiler/code_generator.dart:254)

@jmesserly
Copy link
Author

Yeah, invalid library root is a bit problem too :(. See #27262

@jmesserly
Copy link
Author

this is a dupe of the other library-root bug

@jmesserly jmesserly added the closed-duplicate Closed in favor of an existing report label Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report dev-compiler-ux web-dev-compiler
Projects
None yet
Development

No branches or pull requests

2 participants