facebookarchive / fb-adb

A better shell for Android devices
Other
1.14k stars 128 forks source link

Cannot build on Ubuntu 14.04.1 #3

Closed evandrix closed 9 years ago

evandrix commented 10 years ago

I encounter the following errors when trying to build according to the prescribed instructions:

checking whether the C compiler works... no
configure: error: in `<redacted>/fb-adb/build/stub-x86':
configure: error: C compiler cannot create executables
See `config.log' for more details
configure: error: ../../stub-x86/configure failed for stub-x86
evandrix commented 10 years ago

I have set ANDROID_NDK as instructed, and added the appropriate toolchain's gcc to PATH, and downloaded both NDK 32-bit and 64-bit.

dcolascione commented 10 years ago

Can you share config.log, or at least the portion relating to the error? I can build on 14.04.

jduck commented 10 years ago

See my comment on #6, perhaps that will work for you too.

evandrix commented 10 years ago

hmm, I can't seem to get it to build on Mac OS X 10.9.4 either, encountering the same error message, even after trying your linked comment #6

niedzielski commented 10 years ago

configure: error: could not find Android cross-compiler for i686-pc-linux-android configure: error: ../../stub-x86/configure failed for stub-x86

I had a similar issue on Mac. I resolved it by downgrading my NDK from "android-ndk-r10b" to "android-ndk-r10". No other changes were necessary.

dcolascione commented 10 years ago

Merged https://github.com/facebook/fb-adb/issues/6 here

dcolascione commented 10 years ago

The build works for me using NDKs r9b and r10b. I can't help debug build issues without a copy of all config.log files produced by the failed configure attempt.

niedzielski commented 10 years ago

@dcolascione apologies for the lack of detail. When experiencing problems, sometimes it is easy to mistakenly assume an issue is self evident. I dug into this a little more. The cause is actually that I'm using the 64b target NDK (android-ndk64-r10b-darwin-x86_64.tar.bz2). The 32b target NDK (android-ndk32-r10b-darwin-x86_64.tar.bz2) works fine. I can provide my config.log on request (GitHub only supports image attachments).

dcolascione commented 10 years ago

@niedzielski Thanks. I tested with both the 32-bit and 64-bit versions of the 10b NDK, but maybe there's something else different. Can you email your config.log to dancol@dancol.org?

niedzielski commented 10 years ago

@dcolascione sent!

niedzielski commented 10 years ago

This is no longer issue using r10c for Mac.

evandrix commented 9 years ago

@niedzielski:

I had a similar issue on Mac. I resolved it by downgrading my NDK from "android-ndk-r10b" to "android-ndk-r10". No other changes were necessary.

This is no longer issue using r10c for Mac.

  • Which of the following "android-ndk-r10" worked for you?
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk32-r10-darwin-x86_64.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86.tar.bz2
http://dl.google.com/android/ndk/android-ndk64-r10-darwin-x86_64.tar.bz2

None of them worked for me, esp. the ndk64's - which both failed in not being able to find i686-linux-android-gcc

I couldn't get any r10{,a,b,c,d} to work on my OSX 10.10.1 - failed at step:

checking for i686-linux-android-gcc... i686-linux-android-gcc
checking whether the C compiler works... no
configure: error: in `/path/to/AndroidSDK/fb-adb/build/stub-x86':
configure: error: C compiler cannot create executables
niedzielski commented 9 years ago

I've only tried on Mac lately, android-ndk-r10d-darwin-x86_64.bin. I tested the build with the following command:

 fb-adb rcmd screencap -p  > screenshot-$(timestamp).png

Happy to share configs, binaries, etc as helpful.

evandrix commented 9 years ago

@niedzielski: mmm, ok. I don't have access to my OSX (now @ work; have to wait till later this evening when I return home) but the command that you've quoted is for when fb-adb is already compiled & installed, right?

I'm still facing trouble getting configure to complete successfully (see previous historical posts in this issue) Reproducing the relevant extract from the failed configure run ([ and ] are added by me):

...
checking for i686-linux-android-gcc... [i686-linux-android-gcc]
checking whether the C compiler works... no
configure: error: in `/path/to/AndroidSDK/fb-adb/build/stub-x86':
configure: error: [C compiler cannot create executables]
...

So then you managed to get past this stage by export ANDROID_NDK=/path/to/extracted/version/of/android-ndk-r10d-darwin-x86_64.bin ?

niedzielski commented 9 years ago

I couldn't say definitively why my build passes but I do have NDK exported as you said. I use the 64b NDK because I'm running on a 64b host. Are you on a 32 or 64b Linux machine? From my fb-adb build directory, I can run file stub-x86*/toolchain/bin/i686-linux-android-gcc and see:

stub-x86-pic/toolchain/bin/i686-linux-android-gcc: Mach-O 64-bit executable x86_64
stub-x86/toolchain/bin/i686-linux-android-gcc:     Mach-O 64-bit executable x86_64

Anything telling in your config.log files?

evandrix commented 9 years ago

Ah!! I finally managed to get it to build (using the latest r10d NDK for my platform - aside: it turns out that after r10, they decided to streamline it and just distribute a single version of the NDK per platform, so that there won't be the -ndk32- or -ndk64- paired with a x86/x86_64 suffix confusion anymore), after days of trying...

So, it turns out that I've stuck some custom export CXXFLAGS and export LDFLAGS in my $SHELL's .rc file. This was the main culprit behind the C compiler cannot create executables error I was encountering time and again.

After that, my make process choked on ptsname, warning that it's not thread-safe, and advising instead to switch it for ptsname_r. Bummer, because OSX apparently doesn't ship with this variant of the function. So instead I opted to modify configure.ac, to remove all instances of -Werror (treat all warnings as errors)

It failed again at the 2nd last step of make, because OSX's Xcode decide that they'd like to ship an old version of the assembler as (or GNU assembler gas if you prefer), which doesn't understand /stubs.s. There's some fixes for people who encounter this in other projects, like someone wrote a Perl script to do this in AndroidFFmpeg, but I just used cc (the clang-based one) instead of gcc, and it worked.

With all that, it now compiles nicely on OSX 10.10.1 (64-bit of course), as well as (X)Ubuntu 14.04.

I'm logging this notes in case anyone (especially the future me) is stuck and needs to refer to this.

Many thanks once again to @niedzielski for your help!