athena-framework / athena

An ecosystem of reusable, independent components
https://athenaframework.org
MIT License
211 stars 17 forks source link

compile app error #302

Closed lost22git closed 1 year ago

lost22git commented 1 year ago
In lib/athena-routing/src/ext/regex.cr:3:44

 3 | fun jit_match = pcre2_jit_match_8(code : Code*, subject : UInt8*,
 length : LibC::SizeT, startoffset : LibC::SizeT, options : UInt32, ma
tch_data : MatchData*, mcontext : MatchContext*) : Int
                                              ^---
Error: undefined constant Code
Blacksmoke16 commented 1 year ago

What version of Crystal are you using?

lost22git commented 1 year ago
Crystal 1.9.2 [1908c816f] (2023-07-19)

LLVM: 15.0.7
Default target: x86_64-unknown-linux-gnu
Blacksmoke16 commented 1 year ago

If this is happening on an existing Athena project, i.e. that has a shard.lock, try doing a shards update. Otherwise if it's a brand new project, I am unable to reproduce this :thinking:.

Blacksmoke16 commented 1 year ago

Oh, make sure you have PCRE2 installed. Athena no longer supports PCRE1.

Ref: https://crystal-lang.org/2023/03/02/crystal-is-upgrading-its-regex-engine/

lost22git commented 1 year ago
Error target test-athena failed to compile:
/usr/bin/ld: cannot find -lyaml (this usually means you need to install the development package for libyaml): No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of command failed with exit status 1: cc "${@}" -o /root/code/me/test-crystal/test-athena/bin/test-athena  -rdynamic -L/roo
t/.local/share/rtx/installs/crystal/1.9.2/bin/../lib/crystal -lyaml -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-er
rors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '
-lcrypto'` -lpcre2-8 -lm -lgc -lpthread -levent  -lrt -lpthread -ldl

It seems libyaml-dev is also required, but the docs don't seem to mention

Blacksmoke16 commented 1 year ago

How did you install Crystal? Normally these should be installed as dependencies automatically via your package manager.

Ref: https://crystal-lang.org/reference/1.9/man/required_libraries.html#other-stdlib-libraries

lost22git commented 1 year ago

i install crystal by nix-env