craftinginterpreters icon indicating copy to clipboard operation
craftinginterpreters copied to clipboard

Can't build with current Dart (3.0.0)

Open davidljung opened this issue 1 year ago • 8 comments

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.

davidljung avatar May 16 '23 23:05 davidljung

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

brew install [email protected]
brew unlink dart && brew link [email protected]

jiaad avatar May 19 '23 19:05 jiaad

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.

mslinklater avatar May 20 '23 06:05 mslinklater

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

aneeshdamle11 avatar Sep 11 '23 17:09 aneeshdamle11

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

munificent avatar Sep 20 '23 00:09 munificent

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

pm100 avatar Mar 21 '24 23:03 pm100

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

jtagrgh avatar Apr 14 '24 17:04 jtagrgh

on macOS

brew tap dart-lang/dart
brew install dart-lang/dart/[email protected]
export PATH=$(brew --prefix dart-lang/dart/[email protected])/bin:$PATH
dart --version
Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "macos_arm64"
make clean
make get
make # no errors

ecerulm avatar Jul 20 '24 09:07 ecerulm