Skip to content

Compiling Marten projects in debug mode result in compilation errors #219

@ellmetha

Description

@ellmetha

Description

It appears trying to compile a Marten project in debug mode (with the --debug option) results in a compilation error. The problem might be on the Crystal compiler side of things, but let's investigate.

Versions

  • Crystal 1.11.2
  • Marten 0.4.4

How to reproduce

  1. Create an empty Marten project with marten new project testproject
  2. CD into the created project: cd testproject
  3. Install the project dependencies: shards install
  4. Try to compile the server in debug mode: crystal build src/server.cr -o bin/server --debug

The following error is returned:

BUG: called create_llvm_type for M (Exception)
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'raise<Exception>:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'raise<String>:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#create_llvm_type<Crystal::Type+, Bool>:NoReturn'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#llvm_type<Crystal::Type+, Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#create_llvm_type<Crystal::PointerInstanceType, Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#llvm_type<Crystal::Type+, Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#create_llvm_struct_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#llvm_struct_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#create_llvm_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#llvm_type<Crystal::Type+, Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#create_llvm_struct_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::LLVMTyper#llvm_struct_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Bool>:LLVM::Type'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<Crystal::MixedUnionType, Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<Crystal::PointerInstanceType, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<Crystal::PointerInstanceType, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<Crystal::PointerInstanceType, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_debug_type<(Crystal::GenericClassInstanceType+ | Crystal::GenericClassType+ | Crystal::GenericModuleInstanceType | Crystal::GenericModuleType | Crystal::NonGenericClassType | Crystal::NonGenericModuleType+ | Crystal::VirtualType), Crystal::Type+>:Pointer(Void)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#get_debug_type<Crystal::Type+, Crystal::Type+>:(LibLLVM::MetadataRef | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#codegen_fun<String, Crystal::Def+, Crystal::Type+, Bool, Crystal::CodeGenVisitor::ModuleInfo, Bool, Bool>:Crystal::LLVMTypedFunction'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#target_def_fun<Crystal::Def+, Crystal::Type+>:Crystal::LLVMTypedFunction'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Call>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#create_initialize_class_var_function<Crystal::MetaTypeVar, Crystal::ClassVarInitializer>:(Crystal::LLVMTypedFunction | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#initialize_class_var<Crystal::MetaTypeVar>:(LLVM::Value | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#codegen_assign<Crystal::ASTNode+, Crystal::ASTNode+, Crystal::Assign>:(Bool | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Assign>:(Bool | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Expressions>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::ClassDef>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::ModuleDef>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::ModuleDef>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::ModuleDef>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::FileNode>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Expressions>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::FileNode>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Expressions>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::FileNode>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::CodeGenVisitor#visit<Crystal::Expressions>:Bool'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::ASTNode+@Crystal::ASTNode#accept<Crystal::CodeGenVisitor>:Nil'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::Compiler#codegen<Crystal::Program, Crystal::ASTNode+, Array(Crystal::Compiler::Source), String>:(Tuple(Array(Crystal::Compiler::CompilationUnit), Array(String)) | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::Compiler#compile:combine_rpath<Array(Crystal::Compiler::Source), String, Bool>:Crystal::Compiler::Result'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'Crystal::Command::run<Array(String)>:(Bool | Crystal::Repl::Value | Nil)'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in '__crystal_main'
  from /opt/homebrew/Cellar/crystal/1.11.2/bin/crystal in 'main'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions