-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Rust Example #462
Rust Example #462
Conversation
I felt compelled to do this because I wanted to show the usage of the |
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.
We should probably get someone with some familiarity with rust to review this. But I might as well ask while I'm here:
- Are the libraries required for cc enough for rust?
- I think you need to include a BUILD file like: https://github.com/GoogleContainerTools/distroless/blob/master/examples/go/BUILD as these examples are built from source.
That's a great question, I think libc is all it needs for its basic functions for interfacing with the system library, I/O, networking, etc. rather than having an abstract layer like Golang where syscalls are built into the language. I agree this should definitely get the sign-off from someone much better at a novice like me though.
Ahh good point, I will work on a BUILD file for Bazel. |
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.
Thanks for the contribution! This makes sense — the cc/README.md suggests that it's suitable for languages like Rust.
Alright thanks for the tip @briandealwis , new to Bazel but the documentation helped and I think I have things correct. Ready for review when any of you can! |
To re-answer this question after research, for this example I think |
Thanks for your contribution! |
No problem, thanks for reviewing! |
@blhagadorn is there a reason this needs |
@CodesInChaos For libcc1 which isn't inside of base, and is sparsely found in different Unix operating systems. See this interesting discussion: rust-lang/rustup#2213 or this masterpiece: https://wiki.alopex.li/LetsBeRealAboutDependencies. Otherwise, users might see this error: However I might be overcomplicating things, is there an alternative? |
I didn't realize that rust applications link to libgcc at runtime. I thought that only the compiler depends on on it, while applications depend only on glibc. |
Yeah, I think it's heavily dependent on operation system, too (Linux is of course a spectrum). I might be wrong about this though. |
This adds an example of a simple Rust Hello World on STDOUT using the
cc
image