ursachec / CPAProxy

A thin Objective-C wrapper around Tor.
Other
160 stars 49 forks source link

Not able to compile with latest XCode and iOS #49

Open ghost opened 8 years ago

ghost commented 8 years ago

I just tried to compile the CPAProxy for my project, using the latest XCode 8 and iOS, but I am not able to compile.

This is the exception I get: But during the checkout using Cocoapods I get an exception: configure: error: in /.../Library/Caches/CocoaPods/Pods/External/CPAProxy/af463e351d693dc64b763c733b4da397/scripts/build/libevent-2.0.22-stable: configure: error: cannot run C compiled programs. If you meant to cross compile, use --host.

rainwolf commented 8 years ago

I'm seeing this too, albeit a bit differently: checking whether we need extra options to link libevent... configure: error: Found linkable libevent in *******/CPAProxy/scripts/built/i386, but it does not seem to run, even with -R. Maybe specify another using --with-libevent-dir}

Tor's config.log shows the error dyld: Symbol not found: _clock_gettime Referenced from: *********/CPAProxy/scripts/build/tor-0.2.8.7/./conftest Expected in: /usr/lib/libSystem.B.dylib

I don't know how to solve it, but I suspect it will resolve itself when Sierra is released. Can anyone with XCode 8 and the beta of Sierra confirm?

ghost commented 8 years ago

Sorry for not mentioning that: I am already using the latest Safari Release (GM?), so my exception is from Safari with XCode 8...

rainwolf commented 7 years ago

Safari? I meant macOS Sierra (10.12).

I made some changes that allow it to compile now, but there is a catch, my changes only made it compile on macOS Sierra and work only on iOS10 devices.

In both build-libevent.sh and build-tor.sh I changed if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ]; then EXTRA_CONFIG="--host=${ARCH}-apple-darwin" else EXTRA_CONFIG="--host=arm-apple-darwin" fi

and in build-tor.sh I added the -Wno-implicit parameter to the compiler flags to ignore the warning about the implicit function declaration of getentropy. I don't feel this is an adequate fix because it won't run on iOS lower than 10 now, this is because of a different version of libSystem.dylib, one of which doesn't have the symbol _clock_gettime. I'll keep looking for a better fix.

If you patch libevent's configure script and remove checks for clock_gettime, this makes it run on a 9.2 simulator, but not yet on a 9.3.1 device. This feels a bit too hacky too.

I've pushed the changes to my own fork, but might roll back the last commit if @chrisballinger wants to merge without it.

rainwolf commented 7 years ago

Currently my fork compiles on XCode 8 and runs on iOS 10 and probably down to 8, I can confirm it works on 9.3.1.

chrisballinger commented 7 years ago

Oh okay great. Yeah there's no way I can test on iOS 8 either so if it runs on iOS 9 it's probably ok. :)

On Thu, Sep 22, 2016 at 1:12 PM, rainwolf notifications@github.com wrote:

Currently my fork compiles on XCode 8 and runs on iOS 10 and probably down to 8, I can confirm it works on 9.3.1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ursachec/CPAProxy/issues/49#issuecomment-249014717, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfqH4Bk7ayG0ZCJYBc5JciSHiFtkjFlks5qsuE6gaJpZM4KAA6U .