Uh oh!
There was an error while loading. Please reload this page.
Support configure for illumos or solaris (including SmartOS) - #28589
Support configure for illumos or solaris (including SmartOS)#28589potatosalad wants to merge 2 commits into
Conversation
rust-highfive
commented
Sep 22, 2015
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. |
eefriedman
commented
Sep 22, 2015
#26682 should give you some idea what's necessary. (You'll have to cross-compile the first snapshot.) |
alexcrichton
commented
Sep 22, 2015
r? @brson |
brson
commented
Sep 23, 2015
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. |
brson
commented
Sep 23, 2015
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 |
There was a problem hiding this comment.
Is ksh available by default? IOW, will this branch always catch SunOS and switch to ksh?
There was a problem hiding this comment.
Can you add a comment explaining the function of POSIX_SHELL here?
There was a problem hiding this comment.
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.
brson
commented
Sep 23, 2015
I'd like to come up with a solution that doesn't require giving up |
brson
commented
Sep 23, 2015
Shellfire claims Solaris ksh supports |
potatosalad
commented
Sep 23, 2015
@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"$@"fiunset POSIX_SHELL # clear it so if we invoke other scripts, they run as bash as well |
brson
commented
Sep 28, 2015
@potatosalad Yes, your proposed solution works. Thanks! |
discount-elf
commented
Dec 13, 2015
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. |
nbaksalyar
commented
Dec 13, 2015
@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. |
discount-elf
commented
Dec 14, 2015
@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 |
nbaksalyar
commented
Dec 14, 2015
@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. |
discount-elf
commented
Dec 14, 2015
+1 |
potatosalad
commented
Dec 14, 2015
@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. |
discount-elf
commented
Dec 14, 2015
@potatosalad same, all I can really find about the process is detailed in that haiku link. |
nbaksalyar
commented
Dec 14, 2015
@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? :) |
discount-elf
commented
Dec 14, 2015
@nbaksalyar sounds great, will try to help! |
nbaksalyar
commented
Dec 16, 2015
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. |
nbaksalyar
commented
Dec 22, 2015
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 |
potatosalad
commented
Dec 22, 2015
@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. |
nbaksalyar
commented
Dec 28, 2015
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 nikita.baksalyar@gmail.com. |
brson
commented
Jan 20, 2016
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. |
nbaksalyar
commented
Jan 20, 2016
Hi @brson! I believe It already passes most of the tests ( So it would be awesome to have this PR merged first. :) |
brson
commented
Jan 21, 2016
@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
bors
commented
Feb 4, 2016
☔ The latest upstream changes (presumably #31078) made this pull request unmergeable. Please resolve the merge conflicts. |
potatosalad
commented
Feb 4, 2016
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
localscope variables) and adds thex86_64-sun-solarisbuild 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/kshif it detects that/bin/sh(or any other non-POSIX shell) is being used on SunOS. The problem is that the/bin/shbuilt 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.