Helping getting a repo to compile

I am trying to compile this codebase: GitHub - mikeroher/algo-backtest: An event-based backtester with a tree-hierarchy written in Crystal lang.

It seems quite neat. I have background in F#, Scala and can understand the code. But think I have run into tooling issues. I am on MacOSX installed via brew install crystal and using the following version:

❯ crystal -v
Crystal 1.3.2 (2022-01-18)

LLVM: 13.0.0
Default target: x86_64-apple-macosx

Trying to compile gives the following:

algo-backtest on  master [!] is 📦 v0.1.0 on ☁️  via 🔮 v1.3.2 
❯ shards install
Resolving dependencies
Fetching https://github.com/icyleaf/halite.git
Fetching https://github.com/spoved/vcr.cr.git
Fetching https://github.com/luckyframework/habitat.git
Fetching https://github.com/fridgerator/crystal_talib.git
Using halite (0.10.4)
Using habitat (0.4.3 at 318b838)
Using vcr (0.2.2)
Using crystal_talib (0.1.0)

algo-backtest on  master [!] is 📦 v0.1.0 on ☁️  via 🔮 v1.3.2 took 5s 
❯ crystal run examples/1_buy_and_hold.cr
Showing last frame. Use --error-trace for full trace.

In lib/halite/src/halite/features/logging.cr:1:1

 1 | require "logger"
     ^
Error: can't find file 'logger'

If you're trying to require a shard:
- Did you remember to run `shards install`?
- Did you make sure you're running the compiler in the same directory as your shard.yml?

Problem you are experiencing is due to incompatible versions of shard with current Crystal version. Or the shards which were built using previous versions of Crystal. For example halite is locked to version 0.10.4 while currently its updated for latest version of Crystal.

You can perform below steps to ensure latest versions of deps are retrieved.

  1. Remove lib folder (as that contains the downloaded shards)
  2. remove file shard.lock and perform a shards install again. That will ensure that latest version of dependencies are retrieved.

I don’t know if all dependent shards are updated for latest version of Crystal, but you can try above approach to see if this codebase is going to work with latest version of Crystal.

HIH.

1 Like

Instead of deleting those things, you could just run shards update as well.

1 Like