munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.42k stars 1.01k forks source link

Can't build with current Dart (3.0.0) #1122

Open davidljung opened 1 year ago

davidljung commented 1 year ago

Following the install instructions gives an immediate error after installing Dart (according to Dart site install instructions) and running "make get" (Ubuntu 22.04).

jungd@Daphnis:~/dev/craftinginterpreters$ make get
Resolving dependencies...
The lower bound of "sdk: '>2.11.0 <3.0.0'" must be 2.12.0'
or higher to enable null safety.

The current Dart SDK (3.0.0) only supports null safety.

For details, see https://dart.dev/null-safety
make: *** [Makefile:10: get] Error 65

Without knowing anything about Dart, I tried editing tool/pubspec.yaml to change the 2.11.0 to 2.12.0, but just caused different error:

Because tool depends on mustache_template <2.0.0 which doesn't support null safety, version solving
  failed.
jiaad commented 1 year ago

I am on macOS i have installed an older version of DART i have used those commands:

brew install dart@2.12
brew unlink dart && brew link dart@2.12
mslinklater commented 1 year ago

On Ubuntu I uninstalled the default 3+ version of dart

sudo apt-get remove dart

Then installed the newest 2.x version

sudo apt-get install dart=2.19.6-1

This fixed the issue for me.

aneeshdamle11 commented 9 months ago

On Arch Manjaro, Dart version (3.0.7) Since I just wanted to build and try the interpreters, I built without the dependencies. my public.yaml:

name: tool
publish_to: none
environment:
  sdk: '>3.0.0'
dependencies:
  charcode: ^1.1.3
  path: ^1.7.0
  pool: ^1.4.0
  sass: ^1.26.5
  string_scanner: ^1.0.5

The below commands worked successfully:

make get make jlox make clox

Note: This still fails make

munificent commented 9 months ago

Ah, yes. When I get some time, I'll try to update it to the latest.

pm100 commented 3 months ago

same issue here on windows, I know zero about dart and dont have the bandwidth to learn

jtagrgh commented 2 months ago

Make sure to clean any build stuff from 3.0 after switching.