Skip to content
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

FreeBSD compiler #1413

Closed
tymat opened this issue Sep 8, 2015 · 9 comments
Closed

FreeBSD compiler #1413

tymat opened this issue Sep 8, 2015 · 9 comments

Comments

@tymat
Copy link

tymat commented Sep 8, 2015

What steps are needed to bootstrap a FreeBSD target compiler?

@jhass
Copy link
Member

jhass commented Sep 8, 2015

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.

@ysbaddaden
Copy link
Contributor

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.

@ysbaddaden
Copy link
Contributor

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

@ysbaddaden
Copy link
Contributor

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.

@zarianu
Copy link

zarianu commented Feb 12, 2017

@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!

@0x1eef
Copy link

0x1eef commented Feb 12, 2017

there's an issue about freebsd and encoding errors incase you haven't seen it: #3271 #3379 (the 3 spec errors are discussed in 3379). HTH.

@mverzilli
Copy link

@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

@ysbaddaden
Copy link
Contributor

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.

@mverzilli
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants