build failed with latest crystal
zw963 opened this issue · comments
Description
Build failed on my toy project with latest Crystal 1.6.0-dev
╰─ $ 1 shards build --error-trace
Dependencies are satisfied
Building: test_kemal
Error target test_kemal failed to compile:
In src/test_kemal.cr:14:7
14 | Kemal.run
^--
Error: instantiating 'Kemal:Module#run()'
In lib/kemal/src/kemal.cr:15:3
15 | def self.run(args = ARGV)
^--
Error: instantiating 'run(Array(String))'
In lib/kemal/src/kemal.cr:16:10
16 | self.run(nil, args: args)
^--
Error: instantiating 'Kemal:Module#run(Nil)'
In lib/kemal/src/kemal.cr:11:10
11 | self.run(port, args) { }
^--
Error: instantiating 'Kemal:Module#run(Nil, Array(String))'
In lib/kemal/src/kemal.cr:65:12
65 | server.listen unless config.env == "test"
^-----
Error: instantiating 'HTTP::Server#listen()'
In /home/zw963/Crystal/share/crystal/src/http/server.cr:457:9
457 | loop do
^---
Error: instantiating 'loop()'
In /home/zw963/Crystal/share/crystal/src/http/server.cr:457:9
457 | loop do
^---
Error: instantiating 'loop()'
In /home/zw963/Crystal/share/crystal/src/http/server.cr:468:13
468 | spawn handle_client(_io)
^
Error: expanding macro
There was a problem expanding macro 'spawn'
Called macro defined in /home/zw963/Crystal/share/crystal/src/concurrent.cr:99:1
99 | macro spawn(call, *, name = nil, same_thread = false, &block)
Which expanded to:
> 1 |
> 2 |
> 3 |
> 4 | ->(
> 5 |
> 6 | __arg0 : typeof(_io),
> 7 |
> 8 |
> 9 | ) {
> 10 | spawn(name: nil, same_thread: false) do
> 11 | handle_client(
> 12 |
> 13 | __arg0,
> 14 |
> 15 |
> 16 | )
> 17 | end
> 18 | }.call(
> 19 |
> 20 | _io,
> 21 |
> 22 |
> 23 | )
> 24 |
Error: instantiating 'handle_client(IO+)'
In /home/zw963/Crystal/share/crystal/src/http/server.cr:515:16
515 | @processor.process(io, io)
^------
Error: instantiating 'HTTP::Server::RequestProcessor#process(IO+, IO+)'
In /home/zw963/Crystal/share/crystal/src/http/server/request_processor.cr:50:13
50 | Log.with_context do
^-----------
Error: instantiating 'Log#with_context()'
In /home/zw963/Crystal/share/crystal/src/log/main.cr:119:16
119 | self.class.with_context(**kwargs) do
^-----------
Error: instantiating 'Log.class#with_context(NamedTuple())'
In /home/zw963/Crystal/share/crystal/src/log/main.cr:119:16
119 | self.class.with_context(**kwargs) do
^-----------
Error: instantiating 'Log.class#with_context(NamedTuple())'
In /home/zw963/Crystal/share/crystal/src/http/server/request_processor.cr:50:13
50 | Log.with_context do
^-----------
Error: instantiating 'Log#with_context()'
In /home/zw963/Crystal/share/crystal/src/http/server/request_processor.cr:51:20
51 | @handler.call(context)
^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handlers/compress_handler.cr:12:5
12 | {% if flag?(:without_zlib) %}
^
Error: expanding macro
There was a problem expanding macro 'macro_140452390425248'
Called macro defined in /home/zw963/Crystal/share/crystal/src/http/server/handlers/compress_handler.cr:12:5
12 | {% if flag?(:without_zlib) %}
Which expanded to:
> 1 |
> 2 | context.response.output = CompressIO.new(context.response.output, context)
> 3 | call_next(context)
> 4 |
Error: instantiating 'call_next(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handler.cr:28:20
28 | next_handler.call(context)
^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handlers/error_handler.cr:17:7
17 | call_next(context)
^--------
Error: instantiating 'call_next(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handler.cr:28:20
28 | next_handler.call(context)
^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handlers/log_handler.cr:15:7
15 | call_next(context)
^--------
Error: instantiating 'call_next(HTTP::Server::Context)'
In /home/zw963/Crystal/share/crystal/src/http/server/handler.cr:28:20
28 | next_handler.call(context)
^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'
In lib/kemal/src/kemal/static_file_handler.cr:51:27
51 | last_modified = modification_time(file_path)
^----------------
Error: undefined method 'modification_time' for Kemal::StaticFileHandler
╰─ $ cr version
Crystal 1.6.0-dev [43f0a6455] (2022-10-04)
LLVM: 14.0.6
Default target: x86_64-pc-linux-gnu
The sample source code is here:
The really wired things is, the same issue happen on 1.5.1 if i set CRYLSTAL_PATH like this:
export CRYSTAL_PATH=~/Dropbox/common/crystal/lib/empty_folder:$(crystal env CRYSTAL_PATH)
even, ~/Dropbox/common/crystal/lib/empty_folder
is just a empty folder
I consider this issue probably relative to crystal-lang/crystal#12529
Duplicate of #643.
@zw963 this is fixed in master
, can you try it?
@zw963 this is fixed in
master
, can you try it?
it works
Just released v1.3.0 https://github.com/kemalcr/kemal/releases/tag/v1.3.0