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

ocl-core doesn't compile on ARM platforms #49

Closed
skanur opened this issue Sep 27, 2016 · 3 comments
Closed

ocl-core doesn't compile on ARM platforms #49

skanur opened this issue Sep 27, 2016 · 3 comments

Comments

@skanur
Copy link
Contributor

skanur commented Sep 27, 2016

This is more of a feature request than a bug report.

Compiling an arbitrary OpenCL program that uses ocl crate gives the following error while compiling ocl-core on an ARM device (odroid-XU4)

Compiling ocl-core v0.3.0 (file:///home/odroid/workspace/ubench_rust/ocl/ocl-core)
ocl/ocl-core/src/functions.rs:1202:85: 1202:92 error: the trait bound `std::vec::Vec<*const i8>: std::iter::FromIterator<*const u8>` is not satisfied [E0277]
ocl/ocl-core/src/functions.rs:1202     let kern_string_ptrs: Vec<*const i8> = src_strings.iter().map(|cs| cs.as_ptr()).collect();
                                                                                                                       ^~~~~~~
ocl/ocl-core/src/functions.rs:1202:85: 1202:92 help: run `rustc --explain E0277` to see a detailed explanation
ocl/ocl-core/src/functions.rs:1202:85: 1202:92 note: a collection of type `std::vec::Vec<*const i8>` cannot be built from an iterator over elements of type `*const u8`
ocl/ocl-core/src/functions.rs:1209:9: 1209:54 error: mismatched types [E0308]
ocl/ocl-core/src/functions.rs:1209         kern_string_ptrs.as_ptr() as *const *const i8,
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ocl/ocl-core/src/functions.rs:1209:9: 1209:54 help: run `rustc --explain E0308` to see a detailed explanation
ocl/ocl-core/src/functions.rs:1209:9: 1209:54 note: expected type `*const *const u8`
ocl/ocl-core/src/functions.rs:1209:9: 1209:54 note:    found type `*const *const i8`
ocl/ocl-core/src/functions.rs:1317:9: 1317:38 error: mismatched types [E0308]
ocl/ocl-core/src/functions.rs:1317         options.as_ptr() as *const i8,
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ocl/ocl-core/src/functions.rs:1317:9: 1317:38 help: run `rustc --explain E0308` to see a detailed explanation
ocl/ocl-core/src/functions.rs:1317:9: 1317:38 note: expected type `*const u8`
ocl/ocl-core/src/functions.rs:1317:9: 1317:38 note:    found type `*const i8`
error: aborting due to 3 previous errors
error: Could not compile `ocl-core`.

This is not due to bug in your code, but because the rust nightly is not entirely supported for arm. Check this issue here.

The fix I found with some google-fu is to use *const _ instead of *const i8 at these locations. I can confirm this solution compiles fine on ARM and on my laptop (x86_64).

I'll anyway send you a PR soon that fixes this issue. Could you wrap it in a feature and push it upstream?

@c0gent
Copy link
Member

c0gent commented Sep 27, 2016

Sure, sounds good.

@c0gent
Copy link
Member

c0gent commented Oct 2, 2016

Let me know how this compiles on your device.

I consider small machines like your 'odroid' to be extremely important to the future of parallel computing. I want to make sure that this library not only supports them, but makes it as easy as possible to develop on them.

@skanur
Copy link
Contributor Author

skanur commented Oct 2, 2016

Thank you for the merge. I will compile and let you know. Also, I agree on the importance of mobile devices for parallel programming :)

@skanur skanur closed this as completed Oct 2, 2016
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

No branches or pull requests

2 participants