crystal-lang 学习二 macos openssl 问题

因为我的openssl 是使用brew 安装的,按照一般的解决方法是如下配置

注意我的是按照brew 安装的版本的提示

配置

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

但是依然还是提示

Error: execution of command failed with code: 1: `cc "${@}" -o /Users/dalong/.cache/crystal/crystal-run-main.tmp  -rdynamic -L/usr/local/Cellar/crystal/0.35.1/embedded/lib -L/usr/lib -L/usr/local/lib -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre -lgc -lpthread /usr/local/Cellar/crystal/0.35.1/src/ext/libcrystal.a -L/usr/local/Cellar/libevent/2.1.11_1/lib -levent -liconv -ldl

解决方法

运行时指定连接的lib
参考命令

 
crystal build src/main.cr --link-flags -L/usr/local/opt/openssl@1.1/lib

shards build 说明

同样也是添加链接

shards build  --link-flags -L/usr/local/opt/openssl@1.1/lib

参考资料

https://gitter.im/crystal-lang/crystal?at=5d8df36feb1eff63d63302d4 
https://www.crstin.com/crystal-openssl/ 
https://github.com/crystal-lang/crystal/issues/6875 
https://github.com/rongfengliang/crystal-shards-macos-learning

posted on   荣锋亮  阅读(361)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2019-07-02 nexus 3.17.0 简单试用
2019-07-02 nexus 3.17.0 简单说明
2019-07-02 Building a Service Mesh with HAProxy and Consul
2019-07-02 Using HAProxy as an API Gateway, Part 3 [Health Checks]
2019-07-02 Using HAProxy as an API Gateway, Part 2 [Authentication]
2019-07-02 Using HAProxy as an API Gateway, Part 1 [Introduction]
2019-07-02 cjss 像编写css 一样开发web应用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示