I3oris / ic

REPL Interface wrapping Crystal Interpreter (crystal-i).
MIT License
48 stars 2 forks source link

Try build ic again after update crystal to 1.12.1, but get ic 1.11.2 #22

Closed zw963 closed 7 months ago

zw963 commented 7 months ago

My current crystal was compiled by myself, and update into 1.12.1

 ╰─ $ cr version
Crystal 1.12.1 [4cea10199] (2024-04-11)

LLVM: 17.0.6
Default target: x86_64-pc-linux-gnu

But when i try to rebuilt ic use make release, l always get the ic of verison 1.11.2

 ╰─ $ ic
ic(1.11.2):001>

What is expected is, 1.12.1.

Thanks.

I3oris commented 7 months ago

This is expected. The crystal version shown is the one included in the share directory, the place where the interpreter used by IC lives. The version of which crystal it have been compiled doesn't matter, the version of interpreter will stay the same.

I done this like that to avoid instability because I have several patches (monkey patching) of the compiler, and sometime the new version of crystal would break theses patches.

That said, the ic --version that show the crystal version could clarify that.

Version: 0.7.0
REPLy version: 0.3.1
Running Crystal version: 1.11.2
Compiled with Crystal version: 1.12.1

instead of

Version: 0.7.0
REPLy version: 0.3.1
Crystal version: 1.11.2
zw963 commented 7 months ago

Thanks, so, my understanding is that ic use SAME interpreter version as official crystal i?

But, it seem like not true.

 ╰─ $ ic
ic(1.11.2):001> puts Crystal::VERSION
1.11.2
 => nil

 ╰─ $ crystal i
Crystal interpreter 1.12.1 [4cea10199] (2024-04-11).
EXPERIMENTAL SOFTWARE: if you find a bug, please consider opening an issue in
https://github.com/crystal-lang/crystal/issues/new/
icr:1> puts Crystal::VERSION
1.12.1

So, they just use different version standard library? is there any reason to not update to 1.12.1?

I3oris commented 7 months ago

Thanks, so, my understanding is that ic use SAME interpreter version as official crystal i?

No, It's the same that the version on ic/share directory (coming from ic master).

The version never change unless I update myself the version on master. (I just updated the master to 1.12.1 yesterday)

However if you want to update the crystal version without waiting the update, you could simply fetch the crystal master into ic/share/crystal-ic (it's always the exact copy of crystal without changes).

using a script like that: fetch-crystal-i.sh:

#!/bin/sh

# version=1.11.2
version=1.12.1

rm -Rf share/crystal-ic

# Fetch the crystal-i interpreter from the official crystal repo:
curl -L https://github.com/crystal-lang/crystal/archive/refs/tags/$version.zip > crystal.zip
unzip crystal

mkdir -p share/crystal-ic
mv crystal-$version/src share/crystal-ic/src
mv crystal-$version/lib share/crystal-ic/lib
mv crystal-$version/Makefile share/crystal-ic/
mv crystal-$version/LICENSE share/crystal-ic/
rm -Rf crystal.zip crystal-$version

But keep in mind that doing this could break IC if the compiler internal have changed.

zw963 commented 7 months ago

It works! please see screenshot! (although there is no lib folder anymore)

image

I will do this when next time crystal update it version before create new issue here, and let you know if it works, thanks!