FreeBSD installation

43 views
Skip to first unread message

je...@lisp.sh

unread,
May 22, 2021, 11:09:53 AM5/22/21
to Racket Developers
Is there any interest in having a FreeBSD installation alongside the macOS, Windows, and Linux?

Background: I'd like to use raco cross to cross-compile native binaries, working on x86_64 Linux and targeting  x86_64 FreeBSD (ta6fb). While naively trying out raco cross, I noticed that it (tries to) download an install of Racket for the target platform. But there's currently no FreeBSD install. The closest alternative is the generic Unix source install, but that's not what's wanted (not for native binaries, anyway).

Let me know what would be needed; I'd be happy to help out.

Jesse

Matthew Flatt

unread,
May 23, 2021, 1:05:18 PM5/23/21
to je...@lisp.sh, Racket Developers
At Sat, 22 May 2021 08:09:53 -0700 (PDT), "je...@lisp.sh" wrote:
> Is there any interest in having a FreeBSD installation alongside the
> macOS, Windows, and Linux?

I'm not sure how ready the John (the release manager) will be to add a
new platform, but I'm willing to give it a try at the Utah snapshot.
The main obstacle is maintaining a FreeBSD build environment. Maybe a
good possibility is to have a Docker image for Linux that is set up for
cross compilation to FreeBSD. Then, given the right `configure` flags
to make the cross build work, it should be relatively easy to add it to
the Utah build. If you think that's promising and can work out the
Docker image and `configurge` arguments, I can drop it in.

To keep the build process from getting too big while still improving
cross-build support, we might add more Minimal Racket builds without
expanding the set of full distributions. Would that be reasonable for
FreeBSD, or did you have in mind a full distribution?


Meanwhile, I've updated the `raco cross` documentation to provide
advice on building your own target bundles when the download site
doesn't provide the right ones.

Also not what you asked for, but to make a related scenario easier,
I've added `--use-source` to `raco cross` for host builds. For example,
if you're running on FreeBSD, `--use-source` lets you get a host build
for cross-building to another platform (where the other platform does
have installers available). That doesn't help to cross-build to FreeBSD
using a different platform, though.


Matthew

John Clements

unread,
May 23, 2021, 2:53:43 PM5/23/21
to Matthew Flatt, je...@lisp.sh, Racket Developers
Well, I’m not over the moon about another release platform; is there significant demand? I know, I know, the meaning of the word “significant” is completely unspecified. I would certainly agree with Matthew that the Minimal installations might be a less painful addition.

It may be unclear why any of this would be difficult; in my experience, it’s quite common to go through a period during the release when I’m repeatedly restarting the build; running the remote builds takes several hours, and since this time is multiplied, adding (say) half an hour to the build process can significantly extend the process of getting the build “over the hump”. Naturally, it could also be the case that this build runs in parallel, on a new machine. In that case, there’s then the headache of setting up and administering a new machine.

My apologies for all of the kvetching; if we can find a simple way to do this that doesn’t involve a lot of extra time or money, I’m willing to give it a try.

John
> --
> You received this message because you are subscribed to the Google Groups "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/20210523110514.2eb%40sirmail.smtps.cs.utah.edu.

Jesse Alama

unread,
May 26, 2021, 8:10:20 AM5/26/21
to Matthew Flatt, Racket Developers
On Sun, May 23, 2021, at 7:05 PM, Matthew Flatt wrote:

> At Sat, 22 May 2021 08:09:53 -0700 (PDT), "je...@lisp.sh" wrote:
> > Is there any interest in having a FreeBSD installation alongside the
> > macOS, Windows, and Linux?
>
> I'm not sure how ready the John (the release manager) will be to add a
> new platform, but I'm willing to give it a try at the Utah snapshot.
> The main obstacle is maintaining a FreeBSD build environment. Maybe a
> good possibility is to have a Docker image for Linux that is set up for
> cross compilation to FreeBSD. Then, given the right `configure` flags
> to make the cross build work, it should be relatively easy to add it to
> the Utah build. If you think that's promising and can work out the
> Docker image and `configurge` arguments, I can drop it in.

OK, I'll take a look at that. Can you point me to the existing setup, with its ./configure script and Docker image for the existing setup?

Alternatively, one thing I'm happy to do would be to make a shell script that fires up a vanilla FreeBSD machine, downloads the source for 8.1, builds it and installs it into a fresh directory. The infrastructure wouldn't need to be online all the time; you'd use the script I have in mind only once per release (possibly multiple times, in case the build fails or some tests break).

> To keep the build process from getting too big while still improving
> cross-build support, we might add more Minimal Racket builds without
> expanding the set of full distributions. Would that be reasonable for
> FreeBSD, or did you have in mind a full distribution?

Yes, that sounds fine -- I had the Minimal Racket build in mind.

Matthew Flatt

unread,
May 26, 2021, 9:13:22 AM5/26/21
to Jesse Alama, Racket Developers
At Wed, 26 May 2021 14:09:57 +0200, "Jesse Alama" wrote:
> On Sun, May 23, 2021, at 7:05 PM, Matthew Flatt wrote:
>
> > At Sat, 22 May 2021 08:09:53 -0700 (PDT), "je...@lisp.sh" wrote:
> > > Is there any interest in having a FreeBSD installation alongside the
> > > macOS, Windows, and Linux?
> >
> > I'm not sure how ready the John (the release manager) will be to add a
> > new platform, but I'm willing to give it a try at the Utah snapshot.
> > The main obstacle is maintaining a FreeBSD build environment. Maybe a
> > good possibility is to have a Docker image for Linux that is set up for
> > cross compilation to FreeBSD. Then, given the right `configure` flags
> > to make the cross build work, it should be relatively easy to add it to
> > the Utah build. If you think that's promising and can work out the
> > Docker image and `configurge` arguments, I can drop it in.
>
> OK, I'll take a look at that. Can you point me to the existing setup,
> with its ./configure script and Docker image for the existing setup?
>
> Alternatively, one thing I'm happy to do would be to make a shell
> script that fires up a vanilla FreeBSD machine, downloads the source
> for 8.1, builds it and installs it into a fresh directory. The
> infrastructure wouldn't need to be online all the time; you'd use the
> script I have in mind only once per release (possibly multiple times,
> in case the build fails or some tests break).

Builds are driven using the `distro-build` package:

https://docs.racket-lang.org/distro-build/index.html

You don't really need to look at that except as much as it's helpful to
provide context. It means that these parts are taken care of:

* spinning up a Docker container

* downloading a Git checkout to container

* driving the Racket makefiles in cross-compilation mode

The part we need is an image where `git` and cross-compile tools work,
plus the arguments to pass to `configure`. (The image doesn't need to
have the Racket sources or repo checked out.) So, it's mostly a matter
of figuring out the things to include in an image and figuring out what
`configure` command works to cross compile.

See the "Cross-compiling" section of "racket/src/README.txt" for more
about cross compilation. A set of `configure` arguments that includes
`--enable-racket=auto` will let us plug into the `distro-build`
configuration easily.

As an example, the 32-bit ARMv6 Linux builds at the Utah snapshot
needed two pieces:

* Raspberry Pi tools installed in "/home/racket/pi-tools" and `PATH`
set to include

/home/racket/pi-tools/arm-bcm2708/\
gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/

* The `configure` argument `--host=arm-linux-gnueabihf`, which causes
the build to use `arm-linux-gnueabihf-gcc`, etc.

I think a FreeBSD cross compile might involve specifying `CFLAGS=...`
and `LDFLAGS=...` in addition to `--host=` and/or `--enable-target=`.


The `distro-build` scripts can also drive a VirtualBox instance instead
of a Docker container. That's how some snapshots are currently built.
Docker containers are much easier to drop into place, though, which is
why I suggest that route if possible.


Matthew

Philip McGrath

unread,
May 26, 2021, 4:23:21 PM5/26/21
to Matthew Flatt, je...@lisp.sh, Racket Developers
On Sun, May 23, 2021 at 1:05 PM Matthew Flatt <mfl...@cs.utah.edu> wrote:
At Sat, 22 May 2021 08:09:53 -0700 (PDT), "je...@lisp.sh" wrote:
To keep the build process from getting too big while still improving
cross-build support, we might add more Minimal Racket builds without
expanding the set of full distributions. Would that be reasonable for
FreeBSD, or did you have in mind a full distribution?

Would it make sense for `raco cross` and `distro-build` to work together somehow to take a minimal distribution and transform it into a full one? (Or, more generally, a distribution with some specified set of packages.)
Reply all
Reply to author
Forward
0 new messages