Unable to build for Android on OSX

Yo,

it’s so cool that I can also work on OSX. I mainly work on Windows at the office, but during weekends and night I use MacBook Pro. However doing a Android release build fails on OSX with following error:

fuse build --target=android --release -v

Building Android app
1/2: libConradWise.so
ERROR: GCC 4.9, 4.8 or 4.6 was not found in '/toolchains/arm-linux-androideabi-4.**'.
(unknown): E0200: Android build failed -- rerun with '-v' for more information
(29.41 ms)

Build completed in 42.88 seconds.
    0 Warning(s)
    1 Error(s)

Error Summary
-------------

(unknown): E0200: Android build failed -- rerun with '-v' for more information
FATAL ERROR: Build failed.
fuse: Errors were encountered while building the project

Hi!

First of all, your work is very inspiring. Second, you need to install the android SDK NDK.

fuse install android

Then you can build it. Have fun!

Adam Palinkas wrote:

Hi!

First of all, your work is very inspiring. Second, you need to install the android SDK NDK.

fuse install android

Then you can build it. Have fun!

Worked perfectly for me! Thanks a lot!

I’m on day one of learning Fuse version 0.22.0 (build 6996) on OSX El Capitan and fail when trying to build for android. I apologize if I am missing something obvious or resurrecting a known problem with a posted solution that I failed to locate on this forum.

First question: does building via uno build --target=ios or uno build --target=android require a device to be physically connected or does it simply compile and allows you to bootstrap to your ios or android device later?

When I ran

$uno build --target=android --run

I receive this:

ERROR: GCC 4.9 or 4.8 was not found in '/Users/calvin/Library/Application Support/Fusetools/Fuse/Android/AndroidNDK/toolchains/arm-linux-androideabi-4.**'.
(unknown): E0200: Android build failed

After going through the Fuse Forum, and arriving at this bug, I ran

$fuse install android

I receive this:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

(lldb) quit
Process 23779 detached
/Applications/Fuse.app/Contents/Modules/AndroidSDKPackages/../SDKDownloader/sdkdownloader.sh: line 10: 23779 Abort trap: 6           "$MONO_PATH" sdkdownloader.exe $@
fuse: Failed to install AndroidSDKPackages

As an aside, I inspected the reference to the “sdkdownloader.sh” file to understand what and why it was logged within the error text. Nothing struck me but its content is this:

#!/bin/bash
cd "$(dirname "$0")"

MONO_PATH=../../Mono/bin/mono
if [ ! -f "$MONO_PATH" ]; then    
    MONO_PATH=/Library/Frameworks/Mono.framework/Commands/mono
    echo "WARNING: Trying to use pre-installed Mono from: $MONO_PATH"
fi

"$MONO_PATH" sdkdownloader.exe $@

After some more troubleshooting, I installed Android SDK and then was still receiving the same error with a log suggesting that $MONO_PATH was missing. I then decided to add that environment variable to .bash_profile but still received the same error. That in turn, led me to more troubleshooting that steered me towards installing MONO which I did via >brew install mono and then added the bin path as $MONO_PATH.

After all of this building still fails for me in response to either of the following commands.

$uno build --target=android --run

or

$fuse build --target=Android

Hi, and thanks for the very detailed bug report!

First of all, I took the liberty of cleaning up your post a bit by surrounding code with single backticks, and code blocks with triple backticks.

The core of your problem seems to be that fuse install android fails, leaving you with an installation missing vital components.

Fuse does not work with all versions of mono, which is why we ship our own version of it along with the installer. When you do fuse install android, does it print the WARNING: Trying to use pre-installed Mono from: $MONO_PATH warning?

To be sure the bundled mono version is ok, could you please try to do /Applications/Fuse.app/Contents/Mono/bin/mono --version and paste the output here?

Hi Anders, thanks for the response. I’ll used the correct formatters going forward.

When I run: $/Applications/Fuse.app/Contents/Mono/bin/mono --version

I get the followig output: Mono JIT compiler version 4.0.4 ((detached/5ab4c0d Thu Oct 22 15:59:33 CEST 2015) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: altstack Notification: kqueue Architecture: x86 Disabled: aot,profiler Misc: softdebug LLVM: supported, not enabled. GC: sgen

And when I re-ran fuse install android, I confirmed that I do not get the WARNING: Trying to use pre-installed Mono from: $MONO_PATH output.

Slightly odd is that when I simply run $which mono I get /usr/local/bin/mono

and running $mono --version results in this output: Mono JIT compiler version 4.4.1 (Nightly 4.4.1.0/4747417 Tue Jul 5 17:44:19 BST 2016) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: normal SIGSEGV: altstack Notification: kqueue Architecture: amd64 Disabled: none Misc: softdebug LLVM: supported, not enabled. GC: sgen Note that the latter indicates a different version (4.4.1.0/4747417 rather than 4.0.4 from above) than what was indicated from above as result of running the fully path’d out $/Applications/Fuse.app/Contents/Mono/bin/mono --version

Thoughts on what I can do to fix this up?

Hi Calvin,

Could you have posted the whole crash log? There should be a callstack too (where it crashed)

Emil, this is the entire logged out display including stacktrace.

# Starting AndroidSDKPackages installer
* Assertion at metadata.c:3481, condition `ptr' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at SDKDownloader.Platform.Platform.GetAndroidSDKPackagesInstaller (Outracks.IO.AbsoluteDirectoryPath) <0x0001b>
  at SDKDownloader.InstallerGenerator.GetAndroidSDKPackagesInstaller (Outracks.IO.AbsoluteDirectoryPath,SDKDownloader.IPlatform) <0x0001c>
  at SDKDownloader.Client.RootCommands.InstallerParser/<ParseAndCreateInstallerFactory>c__AnonStorey0.<>m__2 (Outracks.IO.AbsoluteDirectoryPath) <0x0001b>
  at SDKDownloader.Client.RootCommands.Install/<Execute>c__AnonStorey0.<>m__1 (Outracks.IO.AbsoluteDirectoryPath) <0x0001e>
  at System.Linq.Enumerable/<CreateSelectIterator>c__Iterator10`2.MoveNext () <0x00119>
  at System.Linq.Enumerable.ToArray<TSource> (System.Collections.Generic.IEnumerable`1<TSource>) <0x00203>
  at SDKDownloader.Client.RootCommands.Install.Execute (System.Collections.Generic.IEnumerable`1<string>,System.Threading.CancellationToken) <0x002f3>
  at SDKDownloader.Client.ConsoleProgram.Execute (string[]) <0x003b0>
  at SDKDownloader.Client.ConsoleProgram.Run (string[],SDKDownloader.IPlatform) <0x0005f>
  at SDKDownloader.Client.Program.Main (string[]) <0x00133>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

    0   mono                                0x00155d9c mono_handle_native_sigsegv + 444
    1   mono                                0x002075e8 sigabrt_signal_handler + 184
    2   libsystem_platform.dylib            0x98cf079b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   libsystem_c.dylib                   0x9ab94c38 abort + 156
    5   mono                                0x0042a9e0 monoeg_log_default_handler + 240
    6   mono                                0x0042a8db monoeg_g_logv + 155
    7   mono                                0x0042aa84 monoeg_assertion_message + 68
    8   mono                                0x002abab6 mono_method_get_header_summary + 566
    9   mono                                0x000a22d2 mono_method_check_inlining + 146
    10  mono                                0x00057767 mono_method_to_ir + 72359
    11  mono                                0x0002fec4 mini_method_compile + 6084
    12  mono                                0x0003a4bd mono_jit_compile_method_inner + 2141
    13  mono                                0x000345f5 mono_jit_compile_method_with_opt + 1317
    14  mono                                0x0003404f mono_jit_compile_method + 79
    15  mono                                0x0033c43f mono_compile_method + 111
    16  mono                                0x00159da8 common_call_trampoline + 3608
    17  mono                                0x00158f86 mono_magic_trampoline + 118
    18  ???                                 0x0083c088 0x0 + 8634504

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.X3g1XA'
Executing commands in '/tmp/mono-gdb-commands.X3g1XA'.
(lldb) process attach --pid 50534
Process 50534 stopped
* thread #1: tid = 0x767c3, 0x9b982cee libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x9b982cee libsystem_kernel.dylib`__wait4 + 10
libsystem_kernel.dylib`__wait4:
->  0x9b982cee <+10>: jae    0x9b982cfe                ; <+26>
    0x9b982cf0 <+12>: calll  0x9b982cf5                ; <+17>
    0x9b982cf5 <+17>: popl   %edx
    0x9b982cf6 <+18>: movl   0x87c732f(%edx), %edx

Executable module set to "/Applications/Fuse.app/Contents/Modules/SDKDownloader/../../Mono/bin/mono".
Architecture set to: i386-apple-macosx.
(lldb) thread list
Process 50534 stopped
* thread #1: tid = 0x767c3, 0x9b982cee libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x767cb, 0x9b97b4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10
  thread #3: tid = 0x767cc, 0x9b982d5e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #4: tid = 0x767cd, 0x9b9837fa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
(lldb) thread backtrace all
* thread #1: tid = 0x767c3, 0x9b982cee libsystem_kernel.dylib`__wait4 + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x9b982cee libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x9abb47e0 libsystem_c.dylib`waitpid$UNIX2003 + 48
    frame #2: 0x00155f14 mono`mono_handle_native_sigsegv + 820
    frame #3: 0x002075e8 mono`sigabrt_signal_handler + 184
    frame #4: 0x98cf079b libsystem_platform.dylib`_sigtramp + 43
    frame #5: 0x9b982573 libsystem_kernel.dylib`__pthread_kill + 11
    frame #6: 0x9c0aa654 libsystem_pthread.dylib`pthread_kill + 101
    frame #7: 0x9ab94c38 libsystem_c.dylib`abort + 156
    frame #8: 0x0042a9e0 mono`monoeg_log_default_handler + 240
    frame #9: 0x0042a8db mono`monoeg_g_logv + 155
    frame #10: 0x0042aa84 mono`monoeg_assertion_message + 68
    frame #11: 0x002abab6 mono`mono_method_get_header_summary + 566
    frame #12: 0x000a22d2 mono`mono_method_check_inlining + 146
    frame #13: 0x00057767 mono`mono_method_to_ir + 72359
    frame #14: 0x0002fec4 mono`mini_method_compile + 6084
    frame #15: 0x0003a4bd mono`mono_jit_compile_method_inner + 2141
    frame #16: 0x000345f5 mono`mono_jit_compile_method_with_opt + 1317
    frame #17: 0x0003404f mono`mono_jit_compile_method + 79
    frame #18: 0x0033c43f mono`mono_compile_method + 111
    frame #19: 0x00159da8 mono`common_call_trampoline + 3608
    frame #20: 0x00158f86 mono`mono_magic_trampoline + 118
    frame #21: 0x0083c088

  thread #2: tid = 0x767cb, 0x9b97b4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #0: 0x9b97b4d6 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x004165bf mono`mono_sem_wait + 31
    frame #2: 0x00336feb mono`finalizer_thread + 235
    frame #3: 0x002fec9f mono`start_wrapper_internal + 751
    frame #4: 0x002fe9a2 mono`start_wrapper + 34
    frame #5: 0x00420132 mono`inner_start_thread + 594
    frame #6: 0x9c0a7780 libsystem_pthread.dylib`_pthread_body + 138
    frame #7: 0x9c0a76f6 libsystem_pthread.dylib`_pthread_start + 155
    frame #8: 0x9c0a4f7a libsystem_pthread.dylib`thread_start + 34

  thread #3: tid = 0x767cc, 0x9b982d5e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #0: 0x9b982d5e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x9c0a734b libsystem_pthread.dylib`_pthread_wqthread + 1289
    frame #2: 0x9c0a4f56 libsystem_pthread.dylib`start_wqthread + 34

  thread #4: tid = 0x767cd, 0x9b9837fa libsystem_kernel.dylib`kevent_qos + 10, queue = 'com.apple.libdispatch-manager'
    frame #0: 0x9b9837fa libsystem_kernel.dylib`kevent_qos + 10
    frame #1: 0x95dd17ea libdispatch.dylib`_dispatch_mgr_invoke + 234
    frame #2: 0x95dd13be libdispatch.dylib`_dispatch_mgr_thread + 52
(lldb) detach

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

Process 50534 detached
(lldb) quit
/Applications/Fuse.app/Contents/Modules/AndroidSDKPackages/../SDKDownloader/sdkdownloader.sh: line 10: 50534 Abort trap: 6           "$MONO_PATH" sdkdownloader.exe $@
fuse: Failed to install AndroidSDKPackages

Thank you. Did the installer print warnings before the sigabort?

One of our build agents had a bad configuration, so that it built corrupt versions of Fuse. We aim to release a new version next week. However, in the meanwhile please downgrade to https://www.fusetools.com/downloads/0.21.0.6650, to install Android related dependencies, and then upgrade back to 0.22.

Thanks for triaging this and steering me to the last good build.

BTW, the link – actually any href to ‘/download’ as of last night 7/21/16, seems to be sporadically 404’ing or renders this error An internal error occured while serving your request.

After switching browsers and logging in, I was able to get a download and have started the re-installation and will post an update soon.

I’ve confirmed that release 0.21.0.6650 does allow me to complete the android installation and lets me build some of the examples for Android. I appreciate the assistance and timely responses. I don’t see a “resolve” button but feel free to do so on my behalf. Thank you!

Great! Fuse 0.23 is also out now, in which we’ve fixed this bug. https://www.fusetools.com/downloads