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

add solaris rustbuild support #39759

Merged
merged 4 commits into from
Feb 13, 2017
Merged

add solaris rustbuild support #39759

merged 4 commits into from
Feb 13, 2017

Conversation

binarycrusader
Copy link
Contributor

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes #39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.

Add cputype recognition for Solaris

Fixes rust-lang#39729
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (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. Due to 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.

Don't need to catch WindowsError.  That was very silly of me.
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@@ -315,7 +315,7 @@ def build_triple(self):
try:
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
except (subprocess.CalledProcessError, WindowsError):
except subprocess.CalledProcessError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could remain the same? (or does it break solaris?)

Copy link
Contributor Author

@binarycrusader binarycrusader Feb 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can remain the same if you wish, it does not break Solaris (which is how I missed it the first time). Well, it doesn't break it when it works, but it could break if that error case is tripped. Let me check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as I suspected if the execution of 'isainfo' fails then Python will trip over the Exception handler at runtime:

Traceback (most recent call last):
  File "./x.py", line 20, in <module>
    bootstrap.main()
  File "/builds/srwalker/rsdev/rust.git/src/bootstrap/bootstrap.py", line 492, in main
    rb.build = rb.build_triple()
  File "/builds/srwalker/rsdev/rust.git/src/bootstrap/bootstrap.py", line 358, in build_triple
    except (subprocess.CalledProcessError, WindowsError):
NameError: global name 'WindowsError' is not defined

...and annoyingly, despite pydoc's claims otherwise, Python doesn't raise CalledProcessError here; it raises an OSError() (if the command is missing for some reason). My guess is that it will only raise CalledProcessError() if execution of the command returns failure, as opposed to being unable to execute the process at all. So this should actually catch both CalledProcessError and OSError. I will apply that fix and your other requested change and try the full build again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah so this clause was added in ad88d50 specifically for Windows, so it'd be great to at least have the Windows behavior here stay the same (although I'm not sure how to do that best)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WindowsError is just a subclass of OSError, so that would be the portable equivalent:

exception WindowsError
Raised when a Windows-specific error occurs or when the error number does not correspond to an errno value. The winerror and strerror values are created from the return values of the GetLastError() and FormatMessage() functions from the Windows Platform API. The errno value maps the winerror value to corresponding errno.h values. This is a subclass of OSError.

So I'll just change it to use that, avoiding the portability issues entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, as of Python 3.3, WindowsError was merged into OSError, so this definitely seems like the right fix:

Changed in version 3.3: EnvironmentError, IOError, WindowsError, socket.error, select.error and mmap.error have been merged into OSError, and the constructor may return a subclass.

@@ -46,6 +46,8 @@ fn main() {
} else if target.contains("dragonfly") || target.contains("bitrig") ||
target.contains("netbsd") || target.contains("openbsd") {
println!("cargo:rustc-link-lib=pthread");
} else if target.contains("solaris") {
println!("cargo:rustc-link-lib=gcc_s");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe if this is linked through libunwind then we can avoid linking it here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will remove this and try a local build again.

@alexcrichton
Copy link
Member

Sounds great!

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 12, 2017

📌 Commit 3807e1f has been approved by alexcrichton

@eddyb
Copy link
Member

eddyb commented Feb 13, 2017

@bors rollup

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes rust-lang#39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
@bors
Copy link
Contributor

bors commented Feb 13, 2017

⌛ Testing commit 3807e1f with merge 8ff9ccf...

bors added a commit that referenced this pull request Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes #39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
@bors
Copy link
Contributor

bors commented Feb 13, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

alexcrichton commented Feb 13, 2017 via email

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Feb 13, 2017
add solaris rustbuild support

Add Solaris as recognized ostype
Add cputype recognition for Solaris

Fixes rust-lang#39729

A future pull request will discriminate between the commercial release and older opensource derivatives to account for divergence, for now, this is compatible with both.
bors added a commit that referenced this pull request Feb 13, 2017
Rollup of 5 pull requests

- Successful merges: #39716, #39758, #39759, #39774, #39784
- Failed merges:
@bors bors merged commit 3807e1f into rust-lang:master Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants