Skip to content
This repository has been archived by the owner on May 17, 2018. It is now read-only.

Fix for target: x86_64-linux-android #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sweisgerber-dev
Copy link

When compiling my project for android x86_64, cargo complained when compiling unix-socket 0.5.0 with the following error:

error[E0308]: mismatched types
   --> /home/weisgerber/.cargo/registry/src/github.com-1ecc6299db9ec823/unix_socket-0.5.0/src/lib.rs:569:73
    |
569 |             try!(cvt(libc::bind(inner.0, &addr as *const _ as *const _, len)));
    |                                                                         ^^^ expected i32, found u32

error[E0308]: mismatched types
   --> /home/weisgerber/.cargo/registry/src/github.com-1ecc6299db9ec823/unix_socket-0.5.0/src/lib.rs:719:73
    |
719 |             try!(cvt(libc::bind(inner.0, &addr as *const _ as *const _, len)));
    |                                                                         ^^^ expected i32, found u32

error: aborting due to 2 previous errors

error: Could not compile `unix_socket`.
warning: build failed, waiting for other jobs to finish...
error: build failed

I added code, to support this minor difference to androids socket implementation.

#[cfg(target_os="android")]
(...)
#[cfg(not(target_os="android"))]
(...)

Target definition: .cargo/config:

[target.x86_64-linux-android]
ar = "toolchain/bin/x86_64-linux-android-ar"
linker = "toolchain/bin/x86_64-linux-android-clang"

The android toolchain i am using has been created with the following command [NDK: r16b]:

android-ndk/build/tools/make_standalone_toolchain.py \
 --arch x86_64 \
 --api 24 \
 --stl=gnustl \
 --install-dir=.

@sfackler
Copy link
Member

Just so you're aware, Unix socket functionality is in the standard library now: https://doc.rust-lang.org/std/os/unix/net/

@sweisgerber-dev
Copy link
Author

Thanks for the hint, does this mean, I need to submit the fix somewhere else?

@sfackler
Copy link
Member

No, it means you can stop depending on this crate, and change your imports from unix_socket::... to std::os::unix::net::....

@sweisgerber-dev
Copy link
Author

Okay, that's easily done for my code (already happened now), but there are also other crates depending on your external crate.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants