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

Unable to build openssl 0.7.x for ARM #314

Closed
operutka opened this issue Nov 30, 2015 · 7 comments
Closed

Unable to build openssl 0.7.x for ARM #314

operutka opened this issue Nov 30, 2015 · 7 comments

Comments

@operutka
Copy link
Contributor

I've been trying to build the new 0.7.x release for ARM using rust 1.4.0 cross-compiler; unfortunately I always get the following errors:

...
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/bn/mod.rs:92:50: 92:64 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/bn/mod.rs:92             try_ssl!(ffi::BN_dec2bn(v.raw_ptr(), c_str.as_ptr()));
                                                                                                                                              ^~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/macros.rs:24:19: 24:39 note: in this expansion of try_ssl_if! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/bn/mod.rs:92:13: 92:67 note: in this expansion of try_ssl! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.0/src/bn/mod.rs:92:50: 92:64 help: run `rustc --explain E0308` to see a detailed explanation
...

Note that this is only an example. There is a lot of errors like this but it's always type mismatch between *const u8 and *const i8. Building it directly for x86/x86_64 works fine as well as building the 0.6.x release for ARM, x86 and x86_64. I use the same version of Rust on all mentioned architectures (it is 1.4.0 8ab8581f6 2015-10-27).

My guess is that CStr and CString use different mapping for c_char on ARM but I don't know why there is no problem with the 0.6.x release.

@sfackler
Copy link
Owner

We upgraded libc versions from 0.6 to 0.7 that fixed the definition of c_char on ARM. Should be an easy fix to add a cast there.

@operutka
Copy link
Contributor Author

Great! As I mentioned before, this is not the only problematic spot. Here is the complete error output:

/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:92:50: 92:64 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:92             try_ssl!(ffi::BN_dec2bn(v.raw_ptr(), c_str.as_ptr()));
                                                                                                                                              ^~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs:24:19: 24:39 note: in this expansion of try_ssl_if! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:92:13: 92:67 note: in this expansion of try_ssl! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:92:50: 92:64 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:100:50: 100:64 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:100             try_ssl!(ffi::BN_hex2bn(v.raw_ptr(), c_str.as_ptr()));
                                                                                                                                               ^~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs:24:19: 24:39 note: in this expansion of try_ssl_if! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:100:13: 100:67 note: in this expansion of try_ssl! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:100:50: 100:64 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:424:56: 424:59 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:424             let str = String::from_utf8(CStr::from_ptr(buf).to_bytes().to_vec()).unwrap();
                                                                                                                                                     ^~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:424:56: 424:59 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:434:56: 434:59 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:434             let str = String::from_utf8(CStr::from_ptr(buf).to_bytes().to_vec()).unwrap();
                                                                                                                                                     ^~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/bn/mod.rs:434:56: 434:59 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:120:36: 120:66 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:120         let bytes = CStr::from_ptr(ffi::ERR_lib_error_string(err)).to_bytes().to_vec();
                                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:120:36: 120:66 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:127:36: 127:67 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:127         let bytes = CStr::from_ptr(ffi::ERR_func_error_string(err)).to_bytes().to_vec();
                                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:127:36: 127:67 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:134:36: 134:69 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:134         let bytes = CStr::from_ptr(ffi::ERR_reason_error_string(err)).to_bytes().to_vec();
                                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/error.rs:134:36: 134:69 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:513:62: 513:75 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:513                 ffi::SSL_CTX_load_verify_locations(self.ctx, file.as_ptr(), ptr::null())
                                                                                                                                                            ^~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:513:62: 513:75 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:523:61: 523:74 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:523                 ffi::SSL_CTX_use_certificate_file(self.ctx, file.as_ptr(), file_type as c_int)
                                                                                                                                                           ^~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:523:61: 523:74 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:533:67: 533:80 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:533                 ffi::SSL_CTX_use_certificate_chain_file(self.ctx, file.as_ptr(), file_type as c_int)
                                                                                                                                                                 ^~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:533:67: 533:80 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:560:60: 560:73 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:560                 ffi::SSL_CTX_use_PrivateKey_file(self.ctx, file.as_ptr(), file_type as c_int)
                                                                                                                                                          ^~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:560:60: 560:73 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:584:56: 584:76 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:584                 ffi::SSL_CTX_set_cipher_list(self.ctx, cipher_list.as_ptr())
                                                                                                                                                      ^~~~~~~~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:584:56: 584:76 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:771:28: 771:31 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:771             CStr::from_ptr(ptr)
                                                                                                                          ^~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:771:28: 771:31 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:780:28: 780:31 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:780             CStr::from_ptr(ptr)
                                                                                                                          ^~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:780:28: 780:31 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:789:75: 789:88 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:789         let ret = unsafe { ffi_extras::SSL_set_tlsext_host_name(self.ssl, cstr.as_ptr()) };
                                                                                                                                                                         ^~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:789:75: 789:88 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:877:46: 877:50 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:877             String::from_utf8(CStr::from_ptr(meth).to_bytes().to_vec()).unwrap()
                                                                                                                                            ^~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/ssl/mod.rs:877:46: 877:50 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:53:46: 53:49 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:53             s: str::from_utf8(CStr::from_ptr(buf).to_bytes()).unwrap()
                                                                                                                                            ^~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:53:46: 53:49 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:278:51: 278:63 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:278             ffi::X509_NAME_add_entry_by_txt(name, key.as_ptr(), ffi::MBSTRING_UTF8,
                                                                                                                                                  ^~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs:58:19: 58:40 note: in this expansion of lift_ssl_if! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:275:9: 280:11 note: in this expansion of lift_ssl! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:278:51: 278:63 help: run `rustc --explain E0308` to see a detailed explanation
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:279:45: 279:59 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:279                                             value.as_ptr(), value_len, -1, 0)
                                                                                                                                            ^~~~~~~~~~~~~~
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs:58:19: 58:40 note: in this expansion of lift_ssl_if! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:275:9: 280:11 note: in this expansion of lift_ssl! (defined in /home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/macros.rs)
/home/xxx/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-0.7.1/src/x509/mod.rs:279:45: 279:59 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 19 previous errors
Could not compile `openssl`.

To learn more, run the command again with --verbose.

@sfackler
Copy link
Owner

Would you have the time to make a PR? It should be as simple as adding as *const _ in the places that complain.

If not, I can get an ARM cross compilation toolchain setup and get it fixed.

@operutka
Copy link
Contributor Author

no problem, I can do it

operutka added a commit to operutka/rust-openssl that referenced this issue Nov 30, 2015
@operutka
Copy link
Contributor Author

I've just sent you a pull request

sfackler added a commit that referenced this issue Nov 30, 2015
Cast correctly c_char raw pointers (fixes build on ARM #314)
@MagaTailor
Copy link

rust-lang/rust#29867

overminder pushed a commit to overminder/rust-openssl that referenced this issue Dec 10, 2015
@MagaTailor
Copy link

I've just bumped into this issue (rust 1.5.0) and it seems the latest available crate is still @ 0.7.1

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

3 participants