我不能在高山边缘建立水晶程序的静态二进制

问题描述 投票:0回答:3

我正在尝试编译最简单的水晶程序,但使用--static标志:

代码:

# x.cr
puts "test"

汇编:

crystal build --static x.cr

结果:

/usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lgc (this usually means you need to install the development package for libgc)
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o '/app/x'  -rdynamic -static  /usr/lib/libpcre.a -lgc /usr/lib/libpthread.a /usr/lib/crystal/core/ext/libcrystal.a /usr/lib/libevent.a /usr/lib/librt.a -L/usr/lib -L/usr/local/lib`

我猜我错过了一些apk包。我试过gcgc-devmusl-dev - 没有运气 - 它与包有关系,还是我错过了什么?

crystal-lang
3个回答
1
投票

答案似乎是gc-dev不再在edge上提供静态库。过去是这种情况,仍然是在3.9发布。

有一个公关来解决这个问题:https://github.com/alpinelinux/aports/pull/6970


0
投票
apk add crystal shards

# equivalent to build-essentials 
apk add --virtual build-dependencies build-base gcc

# or a more complete build dependencies pkg:
# apk add --update alpine-sdk

crystal build --static x.cr

我在一个新的高山容器上进行了测试。


0
投票

它缺少libgc,但这是repo中Crystal包所需的(如果你从那里安装了Crystal)。你可能需要dev版本,如docs所述。

© www.soinside.com 2019 - 2024. All rights reserved.