Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#3909 closed defect (fixed)

Tor 0.2.2.32 no longer cross compile (to iOS)

Reported by: sid77 Owned by:
Priority: Medium Milestone: Tor: 0.2.2.x-final
Component: Core Tor/Tor Version: Tor: 0.2.2.32
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Since version 0.2.2.32 I can no longer cross compile Tor to iOS.
Configure step is fine, build step runs smooth up until the linking phase, from the build log:

 ...
 arm-apple-darwin9-gcc -DHAVE_CONFIG_H -I. -I../.. ...
 mv -f .deps/config_codedigest.Tpo ...
 rm -f libtor.a
 ar cru libtor.a buffers.o ...
 arm-apple-darwin9-ranlib libtor.a
 ...

as you can see, the program "ar" is called instead of "arm-apple-darwin9-ar" causing quite some problems as architectures are being mixed and matched ;-)
If I prepend to my $PATH an "ar" which is a symlink to "arm-apple-darwin9-ar" everything builds fine.
I can reproduce the behavior while cross compiling to iOS but I suppose it could happen with other architectures as no patches are needed to build the program under such operating system.

Child Tickets

Change History (12)

comment:1 Changed 9 years ago by nickm

Strange; I don't see any change in the build scripts that would have this effect. What's the last version that is known to cross-compile properly for you? And how are you invoking "configure" ?

comment:2 in reply to:  1 Changed 9 years ago by rransom

Replying to nickm:

Strange; I don't see any change in the build scripts that would have this effect. What's the last version that is known to cross-compile properly for you? And how are you invoking "configure" ?

He is using git bisect to find this bug now. See #tor-dev.

comment:3 in reply to:  description Changed 9 years ago by sid77

This is the final output of "git bisect":

acd25558b825f5d1254738fc45f5c7f0ccb3fb94 is the first bad commit
commit acd25558b825f5d1254738fc45f5c7f0ccb3fb94
Author: Karsten Loesing <karsten.loesing@gmx.net>
Date:   Wed Aug 11 14:13:08 2010 +0200

    Refactor exit port statistics code and add unit tests.

:040000 040000 d702db1418e7f3f3127b090ec1047cff6ae4d704 d3f1528ae793a076e32759f7e66c45512d3c441d M      src

and this is my test configure line:

CFLAGS="-I/tmp/buildenv/usr/include -L/tmp/buildenv/usr/lib" ./configure --host=arm-apple-darwin9

where /tmp/buildenv holds the "dpkg -X" contents of libevent_2.0.13-stable-1_iphoneos-arm.deb and openssl_0.9.8k-9_iphoneos-arm.deb.

comment:4 Changed 9 years ago by nickm

That git bisect output is pretty odd; there are no changes to configure.in or any of the Makefile.am files in that commit.

If that's the first broken commit, though, we'd expect that tor-0.2.2.14-alpha succeeds for you, and tor-0.2.2.15-alpha fails. Can you confirm that?

comment:5 Changed 9 years ago by sid77

Owner: set to sid77
Status: newassigned

tor-0.2.2.14-alpha does not build, maybe I have messed up the bisect. I'm going to rerun it again.

comment:6 Changed 9 years ago by sid77

Owner: sid77 deleted

comment:7 in reply to:  4 ; Changed 9 years ago by sid77

Re run the following commands:

git bisect reset
git bisect start
git bisect bad tor-0.2.2.32
git bisect good tor-0.2.1.30

at the end of the bisect run I got:

fdbdb4dc15004fdb74c57b9bc67cbfca24c6e7ea is the first bad commit
commit fdbdb4dc15004fdb74c57b9bc67cbfca24c6e7ea
Author: Nick Mathewson <nickm@torproject.org>
Date:   Fri May 8 12:35:36 2009 -0400

    Include the *_sha1.i files in their own *_codedigest.c files.
    
    This way we do not need to rebuild util.c and/or config.c whenever
    any unrelated source file in src/common or src/or has changed.

:040000 040000 f415db2775eb4ac93b56c2f530f07245e33c110e 9417d37e325685fb1d339d46855f9af853131fe4 M      src

I skipped one bisect where there was an error regarding dns.c IIRC and I treated like "bisect bad" some outputs which were always related to ar/ld finding wrong architectures but with outputs different from the one I reported in the original comment.

comment:8 in reply to:  7 Changed 9 years ago by sid77

successful build log: http://pastebin.com/Q675sXCr
broken build log: http://pastebin.com/3zxxxcdB

comment:9 Changed 9 years ago by nickm

Status: assignedneeds_review

Fix found.

Note that in both the above logs, we make the .a files using plain old vanilla "ar", not with the fancy apple-flavored ar.

This is apparently because we aren't searching for a cross-compiling ar at all, and never were: it's just that some place around fdbdb4dc1500, we started doing something that made fancy ar needful here.

I tried a patch to tell autoconf to look for a good cross-compiling ar, and it worked for sid77. See branch "bug3909" in my public repository.

comment:10 Changed 9 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged after revisions and comments from rransom. Thanks, all!

comment:11 Changed 8 years ago by nickm

Keywords: tor-client added

comment:12 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.