Tensegritics / ClojureDart

Clojure dialect for Flutter and Dart
1.4k stars 88 forks source link

Exit code 64 when running on Windows #115

Open frankitox opened 2 years ago

frankitox commented 2 years ago

From conversation in slack.

When trying to run clj -M:cljd flutter I get the following output

PS C:\Users\Franco\Desktop\flutterexample> clj -M -m cljd.build flutter
=== Warming up `.clojuredart/libs-info.edn` === (helps us emit better code)

=== Adding dev dependencies ===
"analyzer" is already in "dev_dependencies". Use "pub upgrade analyzer" to upgrade to a later version!
pub finished with exit code 65

=== Upgrading dev dependencies ===
Resolving dependencies...
  _fe_analyzer_shared 36.0.0 (40.0.0 available)
  analyzer 3.3.1 (4.1.0 available)
  async 2.8.2 (2.9.0 available)
  boolean_selector 2.1.0
  characters 1.2.0 (1.2.1 available)
  charcode 1.3.1
  clock 1.1.0
  collection 1.16.0
  convert 3.0.2
  crypto 3.0.2
  cupertino_icons 1.0.5
  fake_async 1.3.0
  file 6.1.2
  flutter 0.0.0 from sdk flutter
  flutter_lints 2.0.1
  flutter_test 0.0.0 from sdk flutter
  glob 2.0.2
  lints 2.0.0
  matcher 0.12.11
  material_color_utilities 0.1.4 (0.1.5 available)
  meta 1.7.0 (1.8.0 available)
  package_config 2.1.0
  path 1.8.1 (1.8.2 available)
  pub_semver 2.1.1
  sky_engine 0.0.99 from sdk flutter
  source_span 1.8.2 (1.9.0 available)
  stack_trace 1.10.0
  stream_channel 2.1.0
  string_scanner 1.1.0 (1.1.1 available)
  term_glyph 1.2.0
  test_api 0.4.9 (0.4.10 available)
  typed_data 1.3.1
  vector_math 2.1.2
  watcher 1.0.1
  yaml 3.1.1
No dependencies changed.
10 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.

=== Fetching dependencies ===
Running "flutter pub get" in flutterexample...                   2,106ms

=== Dumping type information (it may take a while) ===
Cannot run an executable in a subdirectory of a dependency.

Usage: pub run <executable> [arguments...]
-h, --help                              Print this usage information.
    --[no-]enable-asserts               Enable assert statements.
    --enable-experiment=<experiment>    Runs the executable in a VM with the
                                        given experiments enabled.
                                        (Will disable snapshotting, resulting in
                                        slower startup).
    --[no-]sound-null-safety            Override the default null safety
                                        execution mode.
-C, --directory=<dir>                   Run this in the directory<dir>.

Run "pub help" to see global options.
See https://dart.dev/tools/pub/cmd/pub-run for detailed documentation.
pub finished with exit code 64

The problem happens because of this

PS C:\Users\Franco\Desktop\flutter\acme> flutter.bat pub run C:\Users\Franco\Desktop\flutter\acme\.clojuredart\analyzer.dart
Cannot run an executable in a subdirectory of a dependency.

Usage: pub run <executable> [arguments...]
-h, --help                              Print this usage information.
    --[no-]enable-asserts               Enable assert statements.
    --enable-experiment=<experiment>    Runs the executable in a VM with the
                                        given experiments enabled.
                                        (Will disable snapshotting, resulting in
                                        slower startup).
    --[no-]sound-null-safety            Override the default null safety
                                        execution mode.
-C, --directory=<dir>                   Run this in the directory<dir>.

Run "pub help" to see global options.
See https://dart.dev/tools/pub/cmd/pub-run for detailed documentation.
pub finished with exit code 64

If I change it like this

https://github.com/frankitox/cd-64/commit/d5f225db7b160579ae4affa0de50463c832b2eeb#

It works (although I hit another new error)

JacobGood1 commented 2 years ago

same here #114

frankitox commented 2 years ago

@JacobGood1 just in case you are interested I wrote a couple of commits to address this and other problems related to Windows in a fork. I don't know why hot reload doesn't work but at least I can launch the basic flutter example app.

JacobGood1 commented 2 years ago

I just dual boot into Linux when using clojure->dart. Thanks for the FYI!

On Mon, Jun 27, 2022 at 3:01 PM Franco Biasin @.***> wrote:

@JacobGood1 https://github.com/JacobGood1 just in case you are interested I wrote a couple of commits to address this and other problems related to Windows in a fork https://github.com/frankitox/ClojureDart/. I don't know why hot reload doesn't work but at least I can launch the basic flutter example app.

— Reply to this email directly, view it on GitHub https://github.com/Tensegritics/ClojureDart/issues/115#issuecomment-1167761841, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA36PDEDYIWMV7RQARJODPTVRH3BTANCNFSM5ZAGQQJQ . You are receiving this because you were mentioned.Message ID: @.***>

dupuchba commented 2 years ago

@frankitox can you pinpoint what changes are necessary in your fork ? It's difficult for us because neither @cgrand nor me have windows computers...

frankitox commented 2 years ago

Oh @dupuchba , I know this is very low priority so don't worry! I'll write a description of what each commit does (It's mostly replacing \ for /). I didn't make a PR because the code I wrote is terrible, plus I'm not familiar with the project.

JacobGood1 commented 1 year ago

Hello again, I was wondering if this was possibly going to be resolved any time soon. The reason is that I am thinking about teaching clojure->dart in one of my classes. It would be best, I think, if the process of getting a running application is as frictionless as possible for those who use Windows.

dupuchba commented 1 year ago

@JacobGood1 that would be awesome! @frankitox Are you able to reproduce the issue with the last version of cljd? Since your issue we've changed how the analyzer is built and ran. Otherwise depending on @JacobGood1 classes I'll install a windows VM

JacobGood1 commented 1 year ago

@dupuchba When running the following command...

clj -M:cljd flutter -d windows

I get this...

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\clojure-projects\flutter-test\build\windows\CMakeFiles\4797faae78b8661a583e9948628719a3\flutter_windows.dll.rule;C:\clojure-projects\flutter-test\build\windows\CMakeFiles\453ca6d64bd52f1e32a9294dd0b1b57b\flutter_assemble.rule' exited with code 1. [C:\clojure-projects\flutter-test\build\windows\flutter\flutter_assemble.vcxproj]
Building Windows application...                                     5.1s
Exception: Build process failed.
? Flutter sub-process exited with 1

When running the command: clj -M:cljd flutter -d chrome

I get this...

=== Compiling cljd.core to Dart 3 ===

=== Compiling to Dart... === @09:03
  acme.main
  I like when a plan comes together! ???

=== Launching flutter run -d chrome ===
Launching lib\main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...          
lib/main.dart:1:1: Error: Error when reading 'lib/lib/cljd-out/acme/main.dart': The system cannot find the path specified.

export "lib/cljd-out/acme/main.dart" show main;
^
org-dartlang-app:/web_entrypoint.dart:21:22: Error: Undefined name 'main'.
      if (entrypoint.main is _UnaryFunction) {
                     ^^^^
org-dartlang-app:/web_entrypoint.dart:22:28: Error: Undefined name 'main'.
        return (entrypoint.main as _UnaryFunction)(<String>[]);
                           ^^^^
org-dartlang-app:/web_entrypoint.dart:24:26: Error: Undefined name 'main'.
      return (entrypoint.main as _NullaryFunction)();
                         ^^^^
Waiting for connection from debug service on Chrome...             767ms
Failed to compile application.
? Flutter sub-process exited with 1
dupuchba commented 1 year ago

That's weird, 2 remarks:

In any case do you know what's the simplest way to use windows on a mac?

https://github.com/flutter/flutter/issues/95505

JacobGood1 commented 1 year ago

@dupuchba I do not use any Apple products, I use Linux or Windows depending on the situation... however, I have heard good things about: https://www.parallels.com/

JustForFun119 commented 1 year ago

Here getting the same error trying to develop on Windows, but I found a temporary workaround, regarding compiler output. I can compile and start Flutter app on Windows by editing file lib\main.dart: Remove the lib/ at the beginning of path: from export "lib/cljd-out/acme/main.dart" show main; to export "cljd-out/acme/main.dart" show main;

Then run clj -M:cljd flutter -d ... again.

I also checked the lib\main.dart file on macOS to find cljd-out/acme/main.dart also (without the lib\ in front). Perhaps some issue with building the Dart export path for Windows specifically?

https://github.com/Tensegritics/ClojureDart/blob/94859ca7040576d3a5e48d9db6484acda0e2e7fb/clj/src/cljd/build.clj#L320

Hope this helps!

dupuchba commented 1 year ago

@JacobGood1 & @JustForFun119 tackling this issue next week. Sorry for the delay we had other issues to solve /cc @cgrand

falberto commented 4 months ago

Just start a new project and faced the issue (win 10), thank you @JustForFun119 for the workarround!