From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!Lx7EM+81f32E0bqku+QpCA.user.46.165.242.75.POSTED!not-for-mail From: "Luke A. Guest" Newsgroups: comp.lang.ada Subject: Re: Can GNAT Community projects be compiled to the Android platform? Date: Fri, 9 Sep 2022 07:52:43 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <6230d0eb-d62d-4a54-92f3-75f9cccd4282n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="55052"; posting-host="Lx7EM+81f32E0bqku+QpCA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-GB Xref: reader01.eternal-september.org comp.lang.ada:64299 List-Id: On 08/09/2022 23:28, 梅煜 wrote: > Can GNAT Community projects be compiled to the Android platform? or NDK? > If so, how should it be done? Since google moved to clang, you'd need to check to see if they do what apple does which prohibits gpl components being used. It's not been done for a while afaik, I've not compiled the compiler for a long time and I'm rusty on the details. You basically need an arm (--target= you should get this from the equivalent c/c++ compiler in the ndk for the version you are targetting) cross compiler. You then need either a Java startup activity which calls into Ada code or an Ada NativeActivity which binds the C version in the ndk, that will call AdaInit and AdaFinal (think that's the right name). If you need to call into any lib on Android which requires a binding, you need to generate that, so either a C binding or a JNI binding. I have a JNI package on my github which you can use as a start, a tool to get generate the bindings to Java would be required as JNI is really tedious. https://github.com/Lucretia/jni https://github.com/Lucretia/jni/blob/master/tests/test.adb