[rust-dev] Building rustc to cross-compile to Android

Skirmantas Kligys skirmantas.kligys at gmail.com
Sat Jun 28 17:00:06 PDT 2014


Dan,

I thought so too at first, so I tried moving line "#include
<sys/socket.h>" before "#include "android-ifaddrs.h", and still got
the same error.  If you take a closer look at the error message, it is
only failing the third time sockaddr is mentioned, so a missing header
couldn't be the reason.  Commenting just the line "struct sockaddr
*ifa_dstaddr;" out allows the build to proceed, so at that point I
decided I had no idea what was happening.

Could it be that somehow the Linux ifaddrs.h gets included first, and
it contains an incompatible definition of "struct ifaddrs", and this
the first field where the two definitions differ?

On Sat, Jun 28, 2014 at 2:43 PM, Dan Albert <danalbert at google.com> wrote:
> Looks like a bug in libuv to me:
> https://github.com/joyent/libuv/blob/a2506c936296006abe7b8a7517c3f37691191858/src/unix/linux-core.c#L49
>
> android-ifaddrs.h depends on sockaddr (defined in sys/socket.h), but never
> includes it. linux-core.c does include it, but only after including
> android-ifaddrs.h.
>
> On 1403990292582, Skirmantas Kligys <skirmantas.kligys at gmail.com> wrote:
>>
>> I am trying to build a rustc for x86_64 Linux that would cross-compile
>> to Android.  I follow instructions on this page:
>>
>> https://github.com/rust-lang/rust/wiki/Doc-building-for-android
>>
>> Here is my configure command line:
>>
>> ../configure --prefix=/usr/local/stow/rust-android-20140627
>> --target=arm-linux-androideabi
>> --android-cross-path=/home/skligys/Work/Android/android-ndk-standalone
>>
>> Everything seems to go smoothly until compiling libuv, and then
>>
>> 1) I get the message that gyp is missing, so I follow the libuv's
>> readme and do in src/libuv:
>>
>> mkdir build && git clone https://git.chromium.org/external/gyp.git
>> build/gyp
>>
>> 2) Libuv compile proceeds for a while and then fails:
>>
>> make[1]: Entering directory
>> `/home/skligys/Temp/Rust/rust/build/arm-linux-androideabi/rt/libuv'
>>   CC(target)
>> /home/skligys/Temp/Rust/rust/build/arm-linux-androideabi/rt/libuv/Release/obj.target/libuv/src/unix/linux-core.o
>> In file included from ../../../../src/libuv/src/unix/linux-core.c:31:0:
>> ../../../../src/libuv/include/android-ifaddrs.h:35:19: error: expected
>> ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
>>   struct sockaddr *ifa_dstaddr;
>>                    ^
>> make[1]: ***
>> [/home/skligys/Temp/Rust/rust/build/arm-linux-androideabi/rt/libuv/Release/obj.target/libuv/src/unix/linux-core.o]
>> Error 1
>> make[1]: Leaving directory
>> `/home/skligys/Temp/Rust/rust/build/arm-linux-androideabi/rt/libuv'
>> make: *** [arm-linux-androideabi/rt/libuv/Release/libuv.a] Error 2
>>
>> Any thoughts?
>> _______________________________________________
>> Rust-dev mailing list
>> Rust-dev at mozilla.org
>> https://mail.mozilla.org/listinfo/rust-dev


More information about the Rust-dev mailing list