Crystal: FreeBSD compiler

Created on 8 Sep 2015  路  9Comments  路  Source: crystal-lang/crystal

What steps are needed to bootstrap a FreeBSD target compiler?

feature compiler stdlib

Most helpful comment

FreeBSD support was merged! Instructions to build Crystal on FreeBSD (with an x86_64 binary) are available there: https://dl.dropboxusercontent.com/u/53345358/freebsd/setup.txt

All 9 comments

Have a look at the discussions in #26, #324, #1326 and perhaps those related to 32bit support (search the issue tracker).

The gist is that you should add the necessary ifdef's, load up the target or all of them and venture into bin/crystal build --crosscompile "target-triple" src/compiler/crystal.cr, possibly more options needed check crystal build -h. llvm-config --host-target provides an easy way to get at the correct triple.

I experimented FreeBSD support some months ago. Since OSX is built on BSD it shouldn't be too hard to have most of the features running on FreeBSD (hopefully). I have a highly outdated patch as an example.

I was capable to cross compile and run basic code (eg: direct C calls with empty prelude). Yet, trying something slightly more complicated quickly resulted in segfaults, apparently because of thread context switches.

FreeBSD support was merged! Instructions to build Crystal on FreeBSD (with an x86_64 binary) are available there: https://dl.dropboxusercontent.com/u/53345358/freebsd/setup.txt

A tarball of Crystal 0.16.0 with a few bundled libs (libgc, libevent, libpcre) is now available: https://dl.dropboxusercontent.com/u/53345358/freebsd/crystal-0.16.0.tar.gz with updated install explanations in the link of the previous.

Please ping me if you have any trouble to install it, so I can fix issues or update the install instructions accordingly.

@ysbaddaden Since there's no fresh FreeBSD tarballs, I tried to bootstrap and build my own using your instructions (FreeBSD 10.3 x86_64). Here's some lessons learned:

  • no need for _pkgconf_ package;
  • additionally _libxml2_ & _git_ packages needed;
  • don't have to build _boehm-gc-threaded_ yourself, there's v7.6.0 in packages, which includes part of the patches regarding _GC_push_all_eager_ but misses _aarch64_ parts (but I guess we don't need it since we're on x86, right?);
  • I did 0.19.4 -> 0.20.0 -> 0.20.1 -> 0.20.3 -> 0.20.4 -> 0.20.5 and all the specs on every version bump went well excluding 3 failures with GB2312 encoding and pending ones;

And here's my questions:

  • Since we use system zlib & ssl libraries we build with _without_zlib_ & _without_openssl_ flags, am I getting this right?
  • Is there any guidelines to check the correctness of GC work (new binary linked dynamically, but the one from 0.19.4 tarball is statically built)?

Thank you for your time!

there's an issue about freebsd and encoding errors incase you haven't seen it: https://github.com/crystal-lang/crystal/issues/3271 https://github.com/crystal-lang/crystal/pull/3379 (the 3 spec errors are discussed in 3379). HTH.

@ysbaddaden have we published instructions on how to build FreeBSD somewhere? The Dropbox links you shared in this issue seem to be broken now, and I'm not seeing those anywhere else. This was brought to our attention in the mailing list (https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!topic/crystal-lang/QVIkYA6pFwE).

Could you point me to the newest instructions? I'd like to give it a try, see if it still works, fix any issues and then add the instructions to https://github.com/crystal-lang/crystal-book

No, there aren't. Some binaries are available on the releases packages for 0.19.x if I recall correctly. It may also be cross-compiled then copied and linked on FreeBSD.

A few packages are required. The Vagrantfile should list these.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhass picture jhass  路  3Comments

costajob picture costajob  路  3Comments

lgphp picture lgphp  路  3Comments

asterite picture asterite  路  3Comments

cjgajard picture cjgajard  路  3Comments