dart-backend/angel

it can't comiple to native

jiangyubao opened this issue · 6 comments

`Info: Compiling with sound null safety

error: import of dart:mirrors is not supported in the current Dart runtime

Error: AOT compilation failed
Generating AOT snapshot failed!`

dart version: 2.5.3
os: macos

angel-dart/angel#103

Remove MirrorsReflector from prod.dart , remove angel_jael dependency and other any dependency contains dart: mirrors will solve this problem

Any packages that uses dart:mirrors for reflections won't be able to compile and run in AOT mode. They can only be run in JIT mode. This is the limitation of AOT, see https://dart.dev/tools/dart-compile for more details.

So is there any plan to replace mirrors with reflectable package?

Unfortunately reflectable is not a drop in replacement of mirror. It uses code generation instead of reflection. Basically, need to regenerate the code every time something is changed, this is not ideal for development. Can try out angel3_container_generator which use reflectable instead of mirror to see if it works for you.

According to debuggerx01 's answer: angel-dart/angel#103 ,
I add angel3_container_generator and remove angel3_jael from config.dart , now it can compile to native , GREAT!!!

just for info, if you're using Angel as an ORM and for its database connectivity features, using only those dependencies, it can be compiled