[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: Tor on Android



On Sun, Dec 28, 2008 at 6:30 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
> Hm.  Libevent should be made to detect this.  Ordinarily, fd_mask is
> defined in sys/select.h or something it includes.  Can you grep around
> a little in the Android headers to make sure it's not defined
> anywhere?  If it isn't, we can probably define it to long without
> hurting anything, so long as we define NFDBITS to match.

It's not defined. This is probably a mistake on bionic's part since,
from reading around, fd_mask is POSIX. Rather than change libevent,
probably bionic should be changed. I'll look at doing that tomorrow.

Also, android has a config include file which is included in all
compiles. This might well be a mistake as it defines HAVE_SYS_SOCKET_H
and that's pretty rude.

> This way, we won't need to copy code from OpenSSL and make our license
> even more complicated. ;)
>
> (A reminder to folks: when you paste code that you didn't write,
> please mention the fact?  Thanks!)

Sorry! That is, indeed, OpenSSL code.

> I noticed in trunk that the header files didn't use a consistent macro
> naming scheme, so I've switched them all to use the "_TOR_FILENAME_H"
> convention, which seemed least likely to collide with anything.

Great!

> Hm.  Usually if system headers are getting searched before our
> headers, that's a sign that the C compiler is acting weird.  Can you
> investigate this one a little more?  As you can tell, I'd like 0.2.1.x
> to build out-of-the-box for Android, especially given how little code
> changing seems to be required.

With custom libc etc, this C compiler is certainly acting a little weird!

With a little investigate, the issue is in the agcc script. I had it
add the libevent directory as an include path, but it put's -I options
last on the resulting command line. Thus libevent's log.h was getting
picked up. I've attached a version which collects -I arguments and
puts them first on the gcc command line and this allows tip-of-SVN to
build with these modifications:

--- or.h        (revision 17805)
+++ or.h        (working copy)
@@ -2872,7 +2872,7 @@

 int config_get_lines(const char *string, config_line_t **result);
 void config_free_lines(config_line_t *front);
-int options_trial_assign(config_line_t *list, int use_defaults,
+setopt_err_t options_trial_assign(config_line_t *list, int use_defaults,
                          int clear_first, char **msg);
 int resolve_my_address(int warn_severity, or_options_t *options,
                        uint32_t *addr, char **hostname_out);

This looks like the compiler is just being more picky (maybe because
it's GCC 4.3?) Enums aren't technically ints.

Index: eventdns.c
===================================================================
--- eventdns.c  (revision 17805)
+++ eventdns.c  (working copy)
@@ -102,7 +102,7 @@
 #endif

 #ifdef HAVE_NETINET_IN6_H
-#include <netinet6/in6.h>
+#include <netinet/in6.h>
 #endif

 #ifdef WIN32

The configure script checks for netinet/in6.h, but eventdns.c uses
netinet6/in6.h. The former exists in bionic, but not the latter.


AGL

-- 
Adam Langley agl@xxxxxxxxxxxxxxxxxx http://www.imperialviolet.org

Attachment: agcc
Description: Binary data