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

rustbuild: Fix cross compiling to FreeBSD #32239

Merged
merged 1 commit into from Mar 15, 2016

Conversation

Projects
None yet
5 participants
@alexcrichton
Copy link
Member

alexcrichton commented Mar 14, 2016

This commit fixes our support for cross compiling a compiler to run on FreeBSD.
Over the weekend I managed to get a cross compiler from Linux to FreeBSD 1
which I hope to soon use to start producing FreeBSD nightly compilers. With the
make dist support added in #32237 we should be able to produce standard
rustc/rust-std packages for FreeBSD through a new slave with this cross compiler.

Currently, however, we don't "Just Work" when cross compiling FreeBSD and a
number of changes were required (part of this PR). They include:

  • A few build fixes were needed in LLVM. Our own branch has been rebased on the
    actual 3.8 release and I applied one extra commit 2 which contains two fixes:
    1. The LLVM CMake build system passes the -Wl,-z,defs flag on many
      platforms, but not when CMAKE_SYSTEM_NAME is "FreeBSD". Unfortunately
      this doesn't take into account when we're cross compiling, and as predicted
      the build will fail if -Wl,-z,defs is passed (see 3 for more info). To
      fix this we test TARGET_TRIPLE instead of the CMAKE_SYSTEM_NAME which
      is what we're compiling for which fixes the problem.
    2. The PATH_MAX constant is apparently defined in a different location than
      many other Unix systems, so a file which required this just needed some
      help to keep compiling.
  • Support for compiling compiler-rt with CMake has been added to rustbuild. It
    looks like it just emulates Linux in what it compiles as it didn't seem to
    naturally produce anything else... At least the architecture is right, so
    seems good for now at least!
@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Mar 14, 2016

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Mar 14, 2016

cc @dhuseby

I hope to soon set up FreeBSD nightlies after this lands (assuming it all continues to keep working), and perhaps soon after use the groundwork to tackle OpenBSD next! (cc @semarie)

rustbuild: Fix cross compiling to FreeBSD
This commit fixes our support for cross compiling a compiler to run on FreeBSD.
Over the weekend I managed to get a cross compiler from Linux to FreeBSD [1]
which I hope to soon use to start producing FreeBSD nightly compilers. With the
`make dist` support added in #32237 we should be able to produce standard
rustc/rust-std packages for FreeBSD through a new slave with this cross compiler.

Currently, however, we don't "Just Work" when cross compiling FreeBSD and a
number of changes were required (part of this PR). They include:

* A few build fixes were needed in LLVM. Our own branch has been rebased on the
  actual 3.8 release and I applied one extra commit [2] which contains two fixes:

  1. The LLVM CMake build system passes the `-Wl,-z,defs` flag on many
     platforms, but *not* when `CMAKE_SYSTEM_NAME` is "FreeBSD". Unfortunately
     this doesn't take into account when we're cross compiling, and as predicted
     the build will fail if `-Wl,-z,defs` is passed (see [3] for more info). To
     fix this we test `TARGET_TRIPLE` instead of the `CMAKE_SYSTEM_NAME` which
     is what we're compiling for which fixes the problem.
  2. The `PATH_MAX` constant is apparently defined in a different location than
     many other Unix systems, so a file which required this just needed some
     help to keep compiling.

* Support for compiling compiler-rt with CMake has been added to rustbuild. It
  looks like it just emulates Linux in what it compiles as it didn't seem to
  naturally produce anything else... At least the architecture is right, so
  seems good for now at least!

[1]: https://github.com/alexcrichton/port-of-rust/blob/master/prebuilt/freebsd/Dockerfile
[2]: rust-lang/llvm@be89e4b
[3]: https://bugs.webkit.org/show_bug.cgi?id=138420

@alexcrichton alexcrichton force-pushed the alexcrichton:fix-cross-to-freebsd branch from 1bb076e to 155735a Mar 14, 2016

@brson

This comment has been minimized.

Copy link
Contributor

brson commented Mar 14, 2016

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 14, 2016

📌 Commit 155735a has been approved by brson

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 15, 2016

⌛️ Testing commit 155735a with merge 483fc71...

bors added a commit that referenced this pull request Mar 15, 2016

Auto merge of #32239 - alexcrichton:fix-cross-to-freebsd, r=brson
rustbuild: Fix cross compiling to FreeBSD

This commit fixes our support for cross compiling a compiler to run on FreeBSD.
Over the weekend I managed to get a cross compiler from Linux to FreeBSD [1]
which I hope to soon use to start producing FreeBSD nightly compilers. With the
`make dist` support added in #32237 we should be able to produce standard
rustc/rust-std packages for FreeBSD through a new slave with this cross compiler.

Currently, however, we don't "Just Work" when cross compiling FreeBSD and a
number of changes were required (part of this PR). They include:

* A few build fixes were needed in LLVM. Our own branch has been rebased on the
  actual 3.8 release and I applied one extra commit [2] which contains two fixes:

  1. The LLVM CMake build system passes the `-Wl,-z,defs` flag on many
     platforms, but *not* when `CMAKE_SYSTEM_NAME` is "FreeBSD". Unfortunately
     this doesn't take into account when we're cross compiling, and as predicted
     the build will fail if `-Wl,-z,defs` is passed (see [3] for more info). To
     fix this we test `TARGET_TRIPLE` instead of the `CMAKE_SYSTEM_NAME` which
     is what we're compiling for which fixes the problem.
  2. The `PATH_MAX` constant is apparently defined in a different location than
     many other Unix systems, so a file which required this just needed some
     help to keep compiling.

* Support for compiling compiler-rt with CMake has been added to rustbuild. It
  looks like it just emulates Linux in what it compiles as it didn't seem to
  naturally produce anything else... At least the architecture is right, so
  seems good for now at least!

[1]: https://github.com/alexcrichton/port-of-rust/blob/master/prebuilt/freebsd/Dockerfile
[2]: rust-lang/llvm@be89e4b
[3]: https://bugs.webkit.org/show_bug.cgi?id=138420

@bors bors merged commit 155735a into rust-lang:master Mar 15, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 15, 2016

rustbuild: Fix LLVM compile on MinGW
The LLVM change [1] in rust-lang#32239 unfortunately broke the LLVM build on MinGW, so
this LLVM submodule update brings in one more fix [2] which should hopefully
remedy that.

Once this lands we should be able to immediately start gating on this to prevent
it from happening again.

[1]: rust-lang/llvm@be89e4b
[2]: rust-lang/llvm@3dcd2c8

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 15, 2016

rustbuild: Fix LLVM compile on MinGW
The LLVM change [1] in rust-lang#32239 unfortunately broke the LLVM build on MinGW, so
this LLVM submodule update brings in one more fix [2] which should hopefully
remedy that.

Once this lands we should be able to immediately start gating on this to prevent
it from happening again.

[1]: rust-lang/llvm@be89e4b
[2]: rust-lang/llvm@3dcd2c8

bors added a commit that referenced this pull request Mar 16, 2016

Auto merge of #32266 - alexcrichton:fix-mingw-rustbuild-again, r=brson
rustbuild: Fix LLVM compile on MinGW

The LLVM change [1] in #32239 unfortunately broke the LLVM build on MinGW, so
this LLVM submodule update brings in one more fix [2] which should hopefully
remedy that.

Once this lands we should be able to immediately start gating on this to prevent
it from happening again.

[1]: rust-lang/llvm@be89e4b
[2]: rust-lang/llvm@3dcd2c8
@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Mar 21, 2016

@alexcrichton this is great! will this allow me to take the FreeBSD buildbot down once it is in place and working?

@alexcrichton alexcrichton deleted the alexcrichton:fix-cross-to-freebsd branch Mar 21, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Mar 21, 2016

@dhuseby it's up to you I think. We're not producing FreeBSD nightlies and standard libraries (as of yesterday), but we're unfortunately not running any tests just yet. If you want to keep the bots online to run tests we can do that, but for nightlies we'll at least have that taken care of

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 2, 2016

@alexcrichton so this is building nightlies and snapshots? what about cargo nightlies and snapshots?

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 2, 2016

Yeah we've got FreeBSD nightlies (not snapshots) for both rustc and Cargo now

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 5, 2016

@alexcrichton so do these show up in the buildbot builders lists? if we have these for linux/windows/mac, why do we still have buildbots for those platforms?

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 5, 2016

Yeah the auto-linux-64-x-freebsd and auto-linux-64-x-netbsd builders are the auto builders, and the nightly-dist-rustc-cross-linux is just one massive builder creating a mess of compilers.

I left the other FreeBSD bots for now because the cross-compiled ones aren't running tests (whereas the current ones are), but if you'd like I can turn those off.

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 11, 2016

@alexcrichton so what is it going to take to get them to start running tests?

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 11, 2016

@alexcrichton I suppose that's not possible unless we have a machine running freebsd right?

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 11, 2016

Yeah we don't have any time frame for getting a FreeBSD bot, but we could in theory also run them under qemu somehow (or some subset). Either way that's pretty far out and not currently planned.

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 14, 2016

@alexcrichton i've been interested in figuring out how to make gitian work with the bsd OS's just like it does with Linux now. Currently, it relies on qemu to boot a linux image, install dependencies, clone the code, run a build, and extract the build outputs. If we could make it also drive qemu to boot a bsd image, install dependencies, clone the code, run a build, and extract the build outputs, we could get away from cross-compiling from Linux.

What do you think?

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 14, 2016

Hey so long as it works and id easy to manage I'm game :).

I've had bad luck with performance in the past running code in qemu (took forever to finish), but maybe I was passing the wrong options or there's some optimizations along the way?

@dhuseby

This comment has been minimized.

Copy link

dhuseby commented Apr 20, 2016

@alexcrichton All of my buildbot slaves are run as qemu vm's (with kvm acceleration) on my server. It seems to run fine.

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Apr 20, 2016

Interesting! Seems like we should definitely at least try to get these running!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.