-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for cross compilation #627
Comments
This is already supported. |
Hello folks, There might be other problem with Take the example attempting to cross-compile name: drift
version: 0.3.2
license: Apache-2.0
crystal: ">= 1.4.0, < 2.0.0"
authors:
- Luis Lavena <[email protected]>
targets:
drift:
main: src/cli.cr
dependencies:
db:
github: crystal-lang/crystal-db
version: ~> 0.13.1
sqlite3:
github: crystal-lang/crystal-sqlite3
version: ~> 0.21.0 $ uname -s -m
Linux aarch64
# native build
$ shards build drift
$ file bin/drift
bin/drift: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, BuildID[sha1]=14dbaf89b60cfdbf55b27f830753b856beb8ac8b, with debug_info, not stripped Attempting to use
When run with
Forcing you to use $ shards build drift --cross-compile --target=x86_64-linux-musl
Dependencies are satisfied
Building: drift
cc /app/bin/drift.o -o /app/bin/drift -rdynamic -L/usr/local/bin/../lib/crystal -lsqlite3 -lpcre2-8 -lgc -lpthread -ldl -levent
$ x86_64-linux-musl-cc bin/drift.o -o /app/bin/drift -lsqlite3 -lpcre2-8 -lgc -lpthread -ldl -levent -lunwind
$ file bin/drift
bin/drift: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped Cheers. |
|
It might be a good idea to change the forwarding behaviour so that any unrecognized option has the same effect as |
Related: crystal-lang/crystal#5845 |
Sadly, that is not how $ shards build drift --verbose -- --cross-compile --target x86_64-linux-musl
db: checking...
sqlite3: checking...
db: checking...
Dependencies are satisfied
Building: drift
crystal build -o /app/bin/drift src/cli.cr --verbose None of the options after Only |
Indeed. I had incorrectly inferred that to work. I'm pretty sure it should work, though. |
Yes, it definitely should. |
shards build
is more convenient thancrystal build
for building multiple binaries. However,shards build
doesn't support--cross-compile
and--target
flags than are a must for static compilation since only Alpine is supported and so most people need to compile inside a docker.The text was updated successfully, but these errors were encountered: