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

Support Vxworks #1408

Merged
merged 2 commits into from Aug 10, 2019
Merged

Support Vxworks #1408

merged 2 commits into from Aug 10, 2019

Conversation

BaoshanPang
Copy link
Contributor

Define the C interface to VxWorks

@rust-highfive
Copy link

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

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 26, 2019

This should at least test that libc builds correctly for this target (e.g. check ci/builds.sh, you might want to add all the vxworks target triples to the "rust nightly" environment variable).

@BaoshanPang
Copy link
Contributor Author

This should at least test that libc builds correctly for this target (e.g. check ci/builds.sh, you might want to add all the vxworks target triples to the "rust nightly" environment variable).

@gnzlbg
I have added all the vxworks target triples but I think they are not going to build pass as they are not supported in rust yet. The PR to support vxWorks in rust is still on going:
rust-lang/rust#61946

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 26, 2019

I have added all the vxworks target triples but I think they are not going to build pass as they are not supported in rust yet

You should probably add the target triples first, then libcore support, then libc, then liballoc, and then libstd support. WIth libcore support, the target triples here would work.

@gnzlbg
Copy link
Contributor

gnzlbg commented Jun 26, 2019

Also, is it possible to run VxWorks under KVM or qemu on Linux ? If so, we'll need docker containers for these targets that do just that (e.g. see ci/docker for examples).

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 7, 2019

ping

@BaoshanPang
Copy link
Contributor Author

Also, is it possible to run VxWorks under KVM or qemu on Linux ? If so, we'll need docker containers for these targets that do just that (e.g. see ci/docker for examples).

No, VxWorks can't run under KVM or qemu.

@BaoshanPang
Copy link
Contributor Author

BaoshanPang commented Jul 16, 2019

ping

Sorry for the late response.
The PR for rust-lang/rust#61946 has been approved, the code will be upstreamed soon. I will let you know when the code are upstreamed so we can run the build test.
The target triples have been updated so I also need to update the file build.sh

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 16, 2019

Congrats and awesome.

I will let you know when the code are upstreamed so we can run the build test.

Just update this PR with the build tests, and then we can merge it.

@BaoshanPang
Copy link
Contributor Author

BaoshanPang commented Jul 17, 2019

Caused by:
process didn't exit successfully: rustc - --crate-name ___ --print=file-names --target armv7-wrs-vxworks --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro (exit code: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "armv7-wrs-vxworks"

I guess the rust version used for testing is not new enough to have the code to support vxWorks targets.
Is it possible to let test use the latest rust code?

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 17, 2019 via email

@BaoshanPang
Copy link
Contributor Author

The version used for testing is the latest nightly version. If the target isn’t there, then no rust version exists with the target.

My code was merged yerterday night some point, I guess these targets will show up with the next build.

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 17, 2019

My code was merged yerterday night some point, I guess these targets will show up with the next build.

Yes that's normal, it might take one day till the next nightly is released. You can locally try to see if your target is there. If it isn't then maybe publishing the rust-src component hasn't been properly set up for the target, and we would need to check what happened.

@BaoshanPang
Copy link
Contributor Author

error: internal compiler error: src/librustc_codegen_llvm/context.rs:192: data-layout for builtin armv7-unknown-linux-gnueabihf target, e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64, differs from LLVM default, e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64

The PR to fix this issue has been created yesterday, it is waiting to be merged:
rust-lang/rust#62745

@BaoshanPang
Copy link
Contributor Author

Downloaded rand v0.6.5
Downloaded syn v0.15.39
Command exited with code -1073741819

This seems not a problem in my code.

@BaoshanPang
Copy link
Contributor Author

rustup target add armv7-wrs-vxworks --toolchain stable
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'armv7-wrs-vxworks'

This is expected result as to build the "rust-std" for target armv7-wrs-vxworks, vxworks's work envionment(the compiler used to build C code, the linker to link libraries and executables etc) has to be installed somethere.

@BaoshanPang
Copy link
Contributor Author

@gnzlbg

Can you give any suggestion what should I do next?

Thanks,
Baoshan

ci/build.sh Outdated
@@ -93,6 +93,13 @@ x86_64-unknown-freebsd \
x86_64-unknown-linux-gnu \
x86_64-unknown-linux-musl \
x86_64-unknown-netbsd \
armv7-wrs-vxworks \
Copy link
Contributor

Choose a reason for hiding this comment

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

These are in the incorrect list of targets. You need to put them in the RUST_NIGHTLY_LINUX_TARGETS variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi gnzlbg,

I have moved these vxworks targets to RUST_NIGHTLY_LINUX_TARGETS.

Thanks,
Baoshan

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 25, 2019

@BaoshanPang so apparently that didn't work, can you try moving them to RUST_LINUX_NO_CORE_TARGETS ?

@BaoshanPang
Copy link
Contributor Author

Hi gnzlbg,

Can you help to check what's problem? It doesn't look like caused by my code.

LLVM ERROR: invalid symbol redefinition
error: Could not compile core.

Thanks,
Baoshan

@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 26, 2019

Can you help to check what's problem? It doesn't look like caused by my code.

This is an LLVM bug introduced with the upgrade to LLVM 9 in rust-lang/rust. There is a tracking issue there (rust-lang/rust#62932) that has been reproduced and now an LLVM bug has been filled (https://bugs.llvm.org/show_bug.cgi?id=42760).

You can try commenting out the thumbv6m-none-eabi target in the build.sh script (adding a FIXME linking to the rust-lang/rust issue).

@gnzlbg gnzlbg closed this Jul 26, 2019
@gnzlbg gnzlbg reopened this Jul 26, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 26, 2019

I've disabled the failing build test on master temporarily. Closing and reopening the PR to restart the CI builds.

@BaoshanPang
Copy link
Contributor Author

I've disabled the failing build test on master temporarily. Closing and reopening the PR to restart the CI builds.

Thanks for help.

Copy link
Contributor

@gnzlbg gnzlbg left a comment

Choose a reason for hiding this comment

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

Some minor nits, but it looks good. I think we can merge this afterwards.

src/vxworks/mod.rs Outdated Show resolved Hide resolved
src/vxworks/mod.rs Show resolved Hide resolved
src/vxworks/mod.rs Show resolved Hide resolved
@gnzlbg
Copy link
Contributor

gnzlbg commented Jul 28, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 28, 2019

📌 Commit b277cd5 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Jul 28, 2019

⌛ Testing commit b277cd5 with merge 94a46ce...

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 5, 2019

Sadly, the repo is in the middle of a transition to Azure Pipelines, and until it is finished nothing can be merged anymore.

@BaoshanPang
Copy link
Contributor Author

Sadly, the repo is in the middle of a transition to Azure Pipelines, and until it is finished nothing can be merged anymore.

Thanks for lettting me know it. Do we have a time when the transition could be done? Thanks.

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 6, 2019

Do we have a time when the transition could be done? Thanks.

I don't think so. As soon as #1376 is merged.

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 9, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 9, 2019

📌 Commit 5c101cc has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 9, 2019

⌛ Testing commit 5c101cc with merge a3a2e04...

bors added a commit that referenced this pull request Aug 9, 2019
Support Vxworks

Define the C interface to VxWorks
@bors
Copy link
Contributor

bors commented Aug 9, 2019

💔 Test failed - status-azure

src/lib.rs Show resolved Hide resolved
src/vxworks/mod.rs Outdated Show resolved Hide resolved
src/vxworks/mod.rs Outdated Show resolved Hide resolved
@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 9, 2019

@bors: r+

let's merge this!

@bors
Copy link
Contributor

bors commented Aug 9, 2019

📌 Commit 4e3fcdd has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 9, 2019

⌛ Testing commit 4e3fcdd with merge d81d5c3...

bors added a commit that referenced this pull request Aug 9, 2019
Support Vxworks

Define the C interface to VxWorks
@bors
Copy link
Contributor

bors commented Aug 9, 2019

💔 Test failed - status-azure

@BaoshanPang
Copy link
Contributor Author

@gnzlbg
Please help to let bors to retry.

Thanks,
Baoshan

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 10, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 10, 2019

📌 Commit d18003a has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Aug 10, 2019

⌛ Testing commit d18003a with merge 9b09188...

bors added a commit that referenced this pull request Aug 10, 2019
Support Vxworks

Define the C interface to VxWorks
@bors
Copy link
Contributor

bors commented Aug 10, 2019

☀️ Test successful - checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, status-azure
Approved by: gnzlbg
Pushing 9b09188 to master...

@bors bors merged commit d18003a into rust-lang:master Aug 10, 2019
@bors bors mentioned this pull request Aug 10, 2019
@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 12, 2019

@BaoshanPang thank you for working on this! Sorry that it took so long to merge it!

Does VxWorks provide any kind of emulator to test applications on, e.g., x86 linux ?

@BaoshanPang
Copy link
Contributor Author

@BaoshanPang thank you for working on this! Sorry that it took so long to merge it!

Does VxWorks provide any kind of emulator to test applications on, e.g., x86 linux ?

We are using "simics" to test rust: https://en.wikipedia.org/wiki/Simics

@n-salim
Copy link
Contributor

n-salim commented Aug 14, 2019

@gnzlbg thanks for your help getting this initial VxWorks support into Rust libc.

Does VxWorks provide any kind of emulator to test applications on, e.g., x86 linux ?

We don't (yet) have a straightforward way for people other than Wind River's VxWorks customers to build and run VxWorks applications (including Rust executables), but this is something we hope to address in future.

We'd certainly like to be able to provide a way for "anyone" to try out Rust under VxWorks. Stay tuned!

@gnzlbg
Copy link
Contributor

gnzlbg commented Aug 15, 2019

@n-salim until such a method is available, my recommendation is for Wind River to run libc tests internally at least, and submit PRs that fix them (fill issues if you have questions). That should catch most serious bugs in the implementation of the FFI wrapper.

If you want to get started with that check out the ci/azure.yml or .cirrus.yml script to see how our CI services do it. You don't necessarily need to use Docker containers, but can, e.g., just run TARGET=... ci/run.sh directly just like the OSX or FreeBSD targets do.

@n-salim
Copy link
Contributor

n-salim commented Aug 15, 2019

@gnzlbg thanks very much for this information. We'll look into running the libc tests on VxWorks.

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.

None yet

7 participants