-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 configure for illumos or solaris (including SmartOS) #28589
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
#26682 should give you some idea what's necessary. (You'll have to cross-compile the first snapshot.) |
r? @brson |
Does Solaris's shell really not support All our shell scripts are currently intended to be POSIX+local compatible. Edit: ah, I see you mentioned that SunOS shell isn't a POSIX shell. |
You mention SunOS several times. Do you mean that literally, or do you mean Solaris? Isn't SunOS ancient? Edit: looks like Solaris identifies itself as SunOS |
export POSIX_SHELL | ||
exec /usr/bin/ksh $0 "$@" | ||
fi | ||
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ksh available by default? IOW, will this branch always catch SunOS and switch to ksh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment explaining the function of POSIX_SHELL
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, when it re-executes this script under ksh
, having POSIX_SHELL
already set prevents it from entering an infinite loop of executing ksh
. Instead, it continues with the rest of the script.
I'd like to come up with a solution that doesn't require giving up |
Shellfire claims Solaris ksh supports |
@brson SunOS is what is currently returned from ksh93 is the variant that is included with illumos, which shellfire mentions is not supported. ksh93 does support local variables, but through the use of the I think it would be cleaner to just have a shell wrapper for Would adding back the # /bin/sh on Solaris is not a POSIX compatible shell, but bash is.
if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
POSIX_SHELL="true"
export POSIX_SHELL
exec /usr/bin/env bash $0 "$@"
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as bash as well |
@potatosalad Yes, your proposed solution works. Thanks! |
Using this commit the next blocker (for illumos based systems) was here (before I realized I would have to cross compile the first snapshot) https://llvm.org/bugs/show_bug.cgi?id=25409 this is an LLVM issue, but worthy of a note. |
@sigil66 Yeah, I stuck on it with my porting attempt as well. There are many more issues to fix, though. Want to cooperate? :) I'm about half-way there with the Solaris/Illumos-specific constants & structs. |
@nbaksalyar sure I can attempt to help. Do you have a branch anywhere? My next step was to start slogging through this: http://rust-on-haiku.com/wiki/PortingRust |
@sigil66 yes, I have my branch, but I haven't pushed the latest changes yet, though. I'm going to do a little clean up first. Any help would speed up the porting process tremendously, so I'll highly appreciate it - it'd be awesome to run Rust natively on Solaris with full DTrace support (not to mention an option to run it natively on Joyent's Triton). Even better if anyone has a commercial interest in it. :) Overall, it seems to me there are more people trying to achieve the same goals, and I think we should consolidate our efforts. |
+1 |
@nbaksalyar @sigil66 Have either of you had any luck with getting a cross-compiler that targets illumos to bootstrap rust? There was a brief conversation about bootstrapping a new platform on #rust back in September 2015, but I didn't get very far due to lack of time. |
@potatosalad same, all I can really find about the process is detailed in that haiku link. |
@potatosalad I don't think it differs much from other platforms. I use a NetBSD port (+ another pull request) as a reference, and here is another resource that I've found: Cross Bootstrapping Rust. For now the progress is blocked by the LLVM bug, but it can be temporarily fixed as described (i.e., by removing the unsupported
I haven't made any more progress since then. So, as I see, now there is another spark of interest in the port, so here's my plan:
I'll update on the progress in this issue. Any comments? :) |
@nbaksalyar sounds great, will try to help! |
OK, so that issue turned out to be quite simple: it's because jemalloc makefile adds some Solaris libraries to linker flags (e.g. I fixed it by specifying the path to an Illumos sysroot, which contains I'll keep updating. |
Well, after a couple of long days of struggle with weird compilation errors, I managed to build the stage0 It compiles without any errors, though binaries that it produces throw out an error I bet it's because of some missing struct/const definitions in the |
@nbaksalyar That's awesome news! If you want any help deciphering the core dumps or access to a more powerful machine to speed up compile times, I might be able to help out in that area. Let me know if you're interested. |
Now it's getting fun - we've passed a major milestone and got a working rustc compiler on Illumos that self-compiles! :) You can grab the rustc build here: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-1.7.0-dev-x86_64-sun-solaris.tar.gz. It's just a copy of Sources are here (in the It should compile as-is, you just have to run Here's a quick rundown on what's yet to be done:
Overall, it's not too complex, so I hope that we'll get to rustc being available in pkgsrc soon. :)
Thanks, that would be super useful to have! Please drop me a message at [email protected]. |
Huh, there's no real reason this shouldn't have landed by now. Just me not paying attention. I wonder if we should just give up on @potatosalad bash is always available on IllumOS? Presumably you are hitting trouble with other scripts that require I've filed a new issue about converting sh to bash: #31036. |
Hi @brson! I believe It already passes most of the tests ( So it would be awesome to have this PR merged first. :) |
@nbaksalyar Would redirecting to bash instead of ksh work for you? That would let us keep the local declarations. If so, I would more happily accept that patch. |
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: rust-lang/libc#138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: rust-lang/libc#138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
☔ The latest upstream changes (presumably #31078) made this pull request unmergeable. Please resolve the merge conflicts. |
Closing in favor of #31078 which has been merged. |
Fix POSIX shell in configure script (support Illumos & Solaris) This patch provides the same fix that is applied for the `configure` script in rustc: https://github.com/rust-lang/rust/blob/master/configure#L3-L9. It is required because `#!/bin/sh` is not Bash/POSIX-compatible on Solaris and its derivatives by default. This change was previously discussed there: rust-lang/rust#28589.
This pull request removes some non-POSIX bashisms found in the configure script (namely
local
scope variables) and adds thex86_64-sun-solaris
build triple so that configure can successfully run on Solaris based operating systems (like SmartOS).The configure script also behaves as a shell wrapper for
/usr/bin/ksh
if it detects that/bin/sh
(or any other non-POSIX shell) is being used on SunOS. The problem is that the/bin/sh
built into SunOS is not POSIX compliant, rather than there being an POSIX compliance issue with the configure script itself. Dash explicitly supports local scope variables as a non-POSIX extension, which may be why that specific bashism has remained unnoticed. I wonder how many more times I can fit the word POSIX into this already POSIX filled paragraph?See also #21000, #25845, #25846, and #25889.
Question about next steps for building on SmartOS:
I still have yet to successfully build rust on SmartOS, although these changes to the configure process have gotten me a little further down the building road. What would be the next steps for getting a stage0 snapshot built for SmartOS? That's about as far down the compilation process as I've been able to go.