crystal_lib icon indicating copy to clipboard operation
crystal_lib copied to clipboard

Broken in recent Crystal (at least since 1.15)

Open porras opened this issue 3 months ago • 2 comments

I was having problems generating a specific library but while investigating I found that actually everything fails with the same error, including running the repo's specs:

       Don't know how to convert _Complex __float128 (Complex) (Exception)
         from src/crystal_lib/parser.cr:292:10 in 'type'
         from src/crystal_lib/parser.cr:145:12 in 'visit_typedef_declaration'
         from src/crystal_lib/parser.cr:80:7 in 'visit'
         from src/crystal_lib/parser.cr:39:7 in '->'
         from lib/clang/src/cursor.cr:38:14 in '->'
         from /lib64/libclang.so.20.1 in '??'
         from /lib64/libclang.so.20.1 in '??'
         from /lib64/libclang.so.20.1 in '??'
         from /lib64/libclang.so.20.1 in 'clang_visitChildren'
         from lib/clang/src/cursor.cr:36:7 in 'visit_children'
         from src/crystal_lib/parser.cr:38:5 in 'parse'
         from src/crystal_lib/parser.cr:15:5 in 'parse'
         from spec/spec_helper.cr:7:3 in 'parse'
         from spec/spec_helper.cr:6:1 in 'parse'
         from spec/lib_body_transformer_spec.cr:5:5 in '->'

This is just one of the errors, but 47 specs fail with that same message. Running any of the examples gets the same error too.

I want to investigate and give a try at fixing it, but since I'm not very hopeful I'll find it, I thought I'd first report it.

My environment (on Fedora Linux):

$ crystal -v
Crystal 1.15.0 [7b9e2ef80] (2025-01-09)

LLVM: 18.1.6
Default target: x86_64-unknown-linux-gnu

porras avatar Nov 06 '25 09:11 porras

I hadn't noticed that I was a bit outdated. I tested with latest crystal, with the same error.

Crystal 1.18.2 [635ca37a6] (2025-10-21)

LLVM: 18.1.8
Default target: x86_64-unknown-linux-gnu

porras avatar Nov 07 '25 13:11 porras

C complex numbers are ABI-equivalent to 2-element arrays of their element types. But the real problem is that Crystal doesn't support any of C's "long" doubles yet.

HertzDevil avatar Nov 07 '25 13:11 HertzDevil