简体   繁体   中英

How to cross compile mono for x86 android

I have tried many different ways. I completed a compile with the NDK and when I run it on an emulator with the adp shell, I get no output.

mono-3.10.0 from a tarball

Here are my environment variables:

export CC=i686-linux-android-gcc
export SYSROOT=/home/XXUSERNAMEXX/Develop/android-ndk-r10d/platform/android-17/arch-x86
export PATH=/tmp/my-android-toolchain/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Here is my configure:

 ./configure --disable-mcs-build --host=i686-linux-android --prefix=/home/XXUSERNAMEXX/vmshare/workspace/HelloJni/jni/mono-2.0 --target=i686-linux-android --build=i686-linux-gnu

then just make then make install

Then build a C# sample of just: // HelloAndroid.cs // Outputs HelloAndroid.exe using System;

namespace HelloAndroid
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Hello World!");
        }
    }
}

then I copy mono-sgen libmonosgen-2.0.so HelloAndroid.exe to an android directory of

/data/data/com.example.helloandroid

change all the permissions to 755 change all the ownerships to system:system

then type

./mono-sgen HelloAndroid.exe

in the adp shell

then I just get nothing. no errors, no output, just the command line returns

You need to compile the .NET Assemblies (System.dll ...) like for regular host and to put them into Android.

In addition define MONO_PATH to mono runtimes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM