crystal-lang

Crystal Build error issue with libgc on Mac OS 15.5


ran an into an error, compiling or running a crystal with kemal web framework getting started app:

$ crystal build --link-flags="~/.asdf/shims/crystal/embedded/lib/libgc.a" src/early-registration-api-cr.cr
clang: error: no such file or directory: '/Users/matt.swieboda@tastytrade.com/.asdf/shims/crystal/embedded/lib/libgc.a'
Error: execution of command failed with exit status 1: cc "${@}" -o /Users/matt.swieboda@tastytrade.com/.cache/crystal/Users-matt.swieboda@tastytrade.com-.asdf-installs-crystal-1.16.3-src-ecr-process.cr/macro_run ~/.asdf/shims/crystal/embedded/lib/libgc.a -rdynamic -lgc -liconv

I'm on Mac OS 15.5 Sequoia, on a work laptop, but permissions should be decently set (via asdf they are fine. ~/.asdf/ has full permissions, as does the ~/dev/cr directory my project is in. I'm using iTerm 2, and zsh. If anyone needs more context/info, I can happily provide it.

here is a potential solution I looked up, but I think it's for *NIX / UNIX (and from 2016): execution of command failed with code: 1: `cc -o "/root/.cache/crystal/var-app-staging-new-http.cr

something with libgc is the issue.

using asdf and where crystal outputs:

$ where crystal
/Users/matt***/.asdf/shims/crystal

also this is on a work laptop with Zscaler, and to my knowledge no other libgc is installed via my homebrew for ex, but perhaps from Xcode command line tools, etc maybe.

can anyone help? I'll try to link this in the official Crystal forum too. Trying to get crystal over at the company I work for, to speed up the backend, and other interesting use-cases.

Thanks so much, in advance! I love the crystal community a lot, and happy to help contribute more and more to it. Sorry, not sorry, I know that thank you's are against the rules ;)


Solution

  • from Thread solution Blacksmoke16 on Crystal Lang Forum:

    Is it an option to try installing Crystal via brew? Or the universal tarball: https://github.com/crystal-lang/crystal/releases/download/1.16.3/crystal-1.16.3-1-darwin-universal.tar.gz?

    Otherwise may just need to wait for someone more familiar with asdf.

    this worked for me, installing via brew install crystal and running:

    $ crystal build src/early-registration-api-cr.cr
    
    # outputted `./early-registration-api-cr`
    
    $ ./early-registration-api-cr
    2025-06-17T20:57:32.860804Z   INFO - kemal: [development] Kemal is ready to lead at http://0.0.0.0:3000