Bug 276271 - lang/crystal: update to 1.15.1
Summary: lang/crystal: update to 1.15.1
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dave Cottlehuber
URL: https://reviews.freebsd.org/D49663
Keywords:
Depends on:
Blocks: 285265
  Show dependency treegraph
 
Reported: 2024-01-12 10:35 UTC by Mohamed Akram
Modified: 2025-05-23 23:27 UTC (History)
6 users (show)

See Also:
bugzilla: maintainer-feedback? (dmgk)


Attachments
naive portbump, doesn't build per PR info (1.48 KB, patch)
2024-09-09 10:06 UTC, Dave Cottlehuber
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mohamed Akram 2024-01-12 10:35:52 UTC

    
Comment 1 Gabriel M. Dutra freebsd_committer freebsd_triage 2024-04-24 13:48:20 UTC
Hi, can you please send the patch?
Comment 2 Mohamed Akram 2024-08-12 10:11:57 UTC
(In reply to Gabriel M. Dutra from comment #1)

I'm not too familiar with ports unfortunately. Is there no maintainer for this port?
Comment 3 Dave Cottlehuber freebsd_committer freebsd_triage 2024-09-09 09:08:51 UTC
I had a short look at this, the trivial portbump (update DISTVERSION, distinfo etc) is
insufficient. A compile-time error against boehm-gc (garbage collector dependency) needs
better eyes than I:

===========================================================================
=======================<phase: build          >============================
===== env: DEVELOPER_MODE=yes STRICT_DEPENDS=yes USER=root UID=0 GID=0
===>  Building for crystal-1.13.2
Using /usr/local/bin/llvm-config16 [version=16.0.6]c++ -c -O2 -pipe -fstack-protector-strong -fno-strict-aliasing    -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc -I/usr/local/llvm16/include -std=c++17   -fno-exceptions -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
CRYSTAL_CONFIG_BUILD_COMMIT="84f389ac5424" CRYSTAL_CONFIG_PATH=lib:/usr/local/lib/crystal SOURCE_DATE_EPOCH="1724112000"  CRYSTAL_CONFIG_LIBRARY_PATH='$ORIGIN/../lib/crystal' ./bin/crystal build --progress --stats --threads 1 --release --no-debug -D strict_multi_assign -D preview_overload_order --link-flags="  -fstack-protector-strong "  -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib -D use_pcre2
Using compiled compiler at .build/crystal
[1/13] Parse
Parse:                             00:00:00.000029265 (   1.08MB)
[1/13] Parse
[2/13] Semantic (top level)
Semantic (top level):              00:00:00.422623703 ( 186.00MB)
[2/13] Semantic (top level)
[3/13] Semantic (new)
Semantic (new):                    00:00:00.002523794 ( 186.00MB)
[3/13] Semantic (new)
[4/13] Semantic (type declarations)
Semantic (type declarations):      00:00:00.051350170 ( 202.00MB)
[4/13] Semantic (type declarations)
[5/13] Semantic (abstract def check)
Semantic (abstract def check):     00:00:00.083600182 ( 210.00MB)
[5/13] Semantic (abstract def check)
[6/13] Semantic (restrictions augmenter)
Semantic (restrictions augmenter): 00:00:00.018897988 ( 210.00MB)
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'macro_35918929520'

Code in src/gc/boehm.cr:387:3

 387 | {% if flag?(:preview_mt) %}
       ^
Called macro defined in src/gc/boehm.cr:387:3

 387 | {% if flag?(:preview_mt) %}

Which expanded to:

 > 2 | # support for legacy gc releases
 > 3 | def self.set_stackbottom(stack_bottom : Void*)
 > 4 |   LibGC.stackbottom = stack_bottom
               ^----------
Error: undefined fun 'stackbottom=' for LibGC
[6/13] Semantic (restrictions augmenter)
[7/13] Semantic (ivars initializers)
gmake: *** [Makefile:227: .build/crystal] Error 1
*** Error code 1

Stop.

Mohamed you might want to open a bug upstream at crystal-lang and see if they have
any suggestions.
Comment 5 Dave Cottlehuber freebsd_committer freebsd_triage 2024-09-09 10:06:32 UTC
Created attachment 253451 [details]
naive portbump, doesn't build per PR info

still needs fix for boehm-gc error
Comment 6 Petr Fischer 2024-09-09 14:45:02 UTC
I recommend asking on the Crystal forums about the porting issues: 
https://forum.crystal-lang.org/c/help-support/11
Comment 7 Mohamed Akram 2024-09-09 19:24:20 UTC
The problem seems to be with the old bootstrap compiler used (1.5.1). The `has_method?` macro doesn't seem to work correctly in it:

$ curl -OL https://github.com/dmgk/crystal-bootstrap/releases/download/1.5.1/crystal-1.5.1-amd64-llvm14.tar.xz
$ tar -xf crystal-1.5.1-amd64-llvm14.tar.xz
$ cat boehm.cr
@[Link("gc-threaded")]
lib LibGC
  fun set_stackbottom = GC_set_stackbottom(th : ThreadHandle, sb : StackBase*) : ThreadHandle
end
module GC
  {% if !LibGC.has_method?(:set_stackbottom) %}
    {% raise "has_method? failed" %}
  {% end %}
end
$ CRYSTAL_PATH=/usr/local/lib/crystal .build/crystal build boehm.cr # build with the 1.5.1 compiler
Showing last frame. Use --error-trace for full trace.

In boehm.cr:6:3

 6 | {% if !LibGC.has_method?(:set_stackbottom) %}
     ^
Error: has_method? failed
$ crystal build boehm.cr # build with the 1.10.1 compiler
$

Will have to update the bootstrap compiler to eg. 1.10.1, the current version in ports, and it should work then.
Comment 8 Dave Cottlehuber freebsd_committer freebsd_triage 2025-04-03 16:28:25 UTC
found https://github.com/crystal-lang/crystal/commit/6d75bf013c68a1b74c96b6a9592aed638cefedb9 this is not sufficient.

But we can build crystal 1.5.1 -> 1.10.1 -> 1.15.1
Asked upstream https://github.com/crystal-lang/crystal/issues/15633 if
we can skip the intermediary step somehow.
Comment 9 Dave Cottlehuber freebsd_committer freebsd_triage 2025-04-04 15:31:35 UTC
hi Dmitri, can you ACK this review https://reviews.freebsd.org/D49663 please? thanks!
Comment 10 commit-hook freebsd_committer freebsd_triage 2025-05-23 23:27:19 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c96bd72c84ec617d1a54b5adef9c1862132db961

commit c96bd72c84ec617d1a54b5adef9c1862132db961
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2025-05-23 22:12:05 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2025-05-23 23:21:57 +0000

    lang/crystal: update to 1.16.3

    - take ownership
    - thanks @straight-shoota & @ysbaddaden for diagnosis & patches

    - ChangeLog https://github.com/crystal-lang/crystal/releases

    PR:             276271
    Sponsored by:   SkunkWerks, GmbH

 lang/crystal/Makefile  |  68 +++++++++-------
 lang/crystal/distinfo  |   6 +-
 lang/crystal/pkg-plist | 213 +++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 241 insertions(+), 46 deletions(-)