hyperboria / bugs

Peer-to-peer IPv6 networking, secure and near-zero-conf.
154 stars 17 forks source link

Multiple android build fixes #61

Closed guworks closed 8 years ago

guworks commented 9 years ago
  1. This commit uses gyp from the current maintained project.
  2. Builds libuv from a commit which has ndk build fixes on the v1.x branch.
  3. Fixes compiler issues with gcc related to function pointer types.
  4. Passes proper build flags to libuv when building android
guworks commented 9 years ago

CC @benhylau

benhylau commented 9 years ago

@guworks What is the build command?

ghost commented 9 years ago

Hey, thanks a lot! -- I did the initial port to android.

Is it possible to apply the libuv/ndk patch to our vendored libuv? We'd lose changes in there which are neccessary for windows support, which is a deal-breaker.

Upstream rejected cjd's patch (https://github.com/joyent/libuv/pull/1327) and went with a different approach instead. We might be able to use that, and get rid of our vendored fork. I have no idea about windows networking though.

benhylau commented 9 years ago

@lgierth The original script clones from here: http://github.com/joyent/libuv.git Where is this vendored fork you are referring to?

ghost commented 9 years ago

@benhylau node_build/dependencies/libuv

ghost commented 8 years ago

Closing for now -- please reopen if you're still interested in this

benhylau commented 8 years ago

@sssemil has this scripted now -> https://github.com/hyperboria/cjdns/blob/master/android_do

When I run ./android_do on Darwin x86_64, I end up with this:

Error: gcc -Wl,-z,relro,-z,now,-z,noexecstack,-pie,-flto,-O3 -o build_linux/contrib_c_publictoip6_c build_linux/util_Assert_c.o,build_linux/util_Bits_c.o,build_linux/memory_Allocator_c.o,build_linux/util_CString_c.o,build_linux/benc_String_c.o,build_linux/crypto_AddressCalc_c.o,build_linux/crypto_Key_c.o,build_linux/util_Hex_c.o,build_linux/util_platform_Sockaddr_c.o,build_linux/util_AddrTools_c.o,build_linux/contrib_c_publictoip6_c.o build_linux/dependencies/cnacl/jsbuild/libnacl.a,build_linux/dependencies/libuv/out/Release/libuv.a

i686-linux-android-gcc: error: build_linux/dependencies/libuv/out/Release/libuv.a: No such file or directory

    at error (/Users/benedict/Dev/projects/github/cjdns-libuv/node_build/builder.js:53:15)
    at /Users/benedict/Dev/projects/github/cjdns-libuv/node_build/builder.js:122:22
    at /Users/benedict/Dev/projects/github/cjdns-libuv/node_build/builder.js:92:13
    at ChildProcess.<anonymous> (/Users/benedict/Dev/projects/github/cjdns-libuv/tools/lib/Semaphore.js:7:30)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Socket.<anonymous> (child_process.js:969:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)

Am I missing something?

benhylau commented 8 years ago

Yay this finally works from the Mac. Thanks @guworks! Merge if this looks okay? @sssemil @lgierth @kpcyrd

guworks commented 8 years ago

@sssemil @kpcyrd @benhylau done

sssemil commented 8 years ago

Did you test it on any android device?

guworks commented 8 years ago

@sssemil on both arm and x86 emulators the binary runs and I can see the usage information when running it. Not sure I know how to test beyond that? @benhylau are you able to help with this?

sssemil commented 8 years ago

That's enough if it executes. Looks good to me now.

sssemil commented 8 years ago

@guworks, you can also check if tun0 is setup

benhylau commented 8 years ago

@lgierth and I looked into this today and have the following conclusions:

  1. The current codebase contains a recent change that crashes cjdns on launch on Android 4.4.4, but works fine on 5+ :(
  2. Running a binary that @prurigro built based on an earlier codebase (as root, manually from a rooted 4.4.4 Nexus S) worked perfectly. The peering showed up on the other end, I was able to ping other nodes and load up a Hyperboria webpage from the phone browser. Running as root was necessary for this to happen, otherwise I get peering but no ping or data flow. The TUN probably didn't get created in that latter case.
  3. The app is not starting cjdroute and passing cjdroute.conf probably. I am working on this atm.

This PR I believe is ready to be merged. @sssemil are you on #cjdns IRC channels?

sssemil commented 8 years ago

@benhylau, no, I'm not.

benhylau commented 8 years ago

Merge?? @lgierth @kpcyrd