android toolchain,GitHub - gnustep/tools-android: GNUstep Android Toolchain – Objective-C on Android...

2023-10-30

GNUstep Android Toolchain

This project comprises a collection of scripts to build a GNUstep toolchain for Android. The toolchain can then be used in an Android project to compile and run Objective-C code using the Foundation and CoreFoundation libraries.

The toolchain is built using the Android NDK (installed e.g. via Android Studio), and is set up to target Android API level 23 (6.0 / Marshmallow) and all common Android ABIs (armeabi-v7a, arm64-v8a, x86, x86_64).

Libraries

The toolchain currently compiles the following libraries for Android:

libobjc2 (using gnustep-2.0 runtime)

libdispatch (official Apple release from the Swift Core Libraries)

Requirements

Supported host platforms are macOS and Linux.

You must have the Android NDK installed. The toolchain assumes the following version to be installed via Android Studio’s SDK Manager:

NDK (Side by side) – version 22.0.7026061 (r22)

A different NDK version or location can be provided using the --ndk flag (see below). Please note that NDK r21 (or later) is required, as earlier NDK releases contain Clang versions with bugs which prevent usage of the gnustep-2.0 Objective-C runtime.

Additionally, the following packages are required depending on your system.

macOS

Install required packages via Homebrew:

brew install git-lfs cmake autoconf automake libtool pkg-config

git lfs install

Linux

Install required packages via APT:

sudo apt install git git-lfs curl cmake make autoconf libtool pkg-config texinfo python3-distutils

git lfs install

Please note that you need to have CMake version 3.15.1 or later (for libdispatch).

Usage

Run the build.sh script to build the toolchain:

Usage: ./build.sh

--prefix INSTALL_ROOT Install toolchain into given directory (default: ~/Library/Android/GNUstep)

--dist-root DIST_ROOT Make toolchain relocatable to given path relative to home folder on other machines

(use "HOME" as placeholder for home folder, e.g. "HOME/Library/Android/GNUstep")

-n, --ndk NDK_PATH Path to existing Android NDK (default: ~/Library/Android/sdk/ndk/22.0.7026061)

-a, --abis ABI_NAMES ABIs being targeted (default: "armeabi-v7a arm64-v8a x86 x86_64")

-l, --level API_LEVEL Android API level being targeted (default: 23)

-b, --build BUILD_TYPE Build type "Debug" or "Release" or "RelWithDebInfo" (default: RelWithDebInfo)

-u, --no-update Don't update projects to latest version from GitHub

-c, --no-clean Don't clean projects during build (e.g. for building local changes, only applies to first ABI being built)

-p, --patches DIR Apply additional patches from given directory

-o, --only PHASE Build only the given phase (e.g. "gnustep-base", requires previous build)

-h, --help Print usage information and exit

The toolchain builds and installs the GNUstep toolchain into the following location ($GNUSTEP_HOME):

macOS: ~/Library/Android/GNUstep

Linux: ~/Android/GNUstep

The build for each supported ABI is installed into its separate subfolder at that location (both libraries and header files differ per ABI).

To use the toolchain from an Android project, you can use $GNUSTEP_HOME/$ABI_NAME/bin/gnustep-config to obtain various flags that should be used to compile and link Objective-C files, e.g.

gnustep-config --variable=CC

gnustep-config --objc-flags (or --debug-flags)

gnustep-config --base-libs

Call gnustep-config --help to obtain the full list of available variables.

Status and Known Issues

GNUstep base currently has no native integration between the Android run-loop and NSRunLoop or the libdispatch main queue, so things like -performSelector:withObject:afterDelay: or dispatching on dispatch_get_main_queue() will not work out of the box. An integration depends on the setup of the app (e.g. whether using Android Studio, Qt, or something else), and is possible to add in the app by swizzing NSRunLoop. Feel free to open an issue if this is of interest to you and you would like more information.

GNUstep Base is integrated with Android’s app-specific storage and uses the path returned by Context.getFilesDir() as NSHomeDirectory() and when querying for directory paths (NSLibraryDirectory, NSApplicationSupportDirectory, etc.). It also uses Context.getCacheDir() as NSTemporaryDirectory and NSCachesDirectory (with NSUserDomainMask).

GNUstep Base is further integrated with the Android asset manager, and supports accessing the app’s resources from [NSBundle mainBundle] via APIs such as -pathForResource:ofType: and -URLForResource:ofType:, and reading them using NSFileManager, NSFileHandle, and NSDirectoryEnumerator APIs. This is done by returning paths from NSBundle APIs with a fixed, fake, per-app prefix (Context.getPackageCodePath() without extension + /Resources), which internally get routed through the NDK’s AAsset API for reading.

Note that NSDirectoryEnumerator is not able to enumerate directories in the app’s main bundle due to a limitation of the AAssetDir API.

The app must call GSInitializeProcessAndroid() (defined in NSProcessInfo.h) on launch in order to initialize the above Android-specific functionality in GNUstep.

GNUstep Base doesn’t currently get the system languages on Android, which combined with the inability to list directories in the main bundle (see above) means that NSLocalizedString() won’t work out of the box even if localized strings are present in the app’s assets. As a workaround, the app should manually call -[NSUserDefaults setUserLanguages:] with a list of supported locales ordered by the user’s system language preferences.

GNUstep Base will also currently not return the system locale as the current NSLocale on Android (the current locale will always default to en_US_POSIX). As a workaround, the app can manually set the system’s locale identifier for the key "Locale" in NSUserDefaults, and use -[NSLocale autoupdatingCurrentLocale] to retreive the locale.

Android will not output stdout or stderr to logcat by default, which might cause some log or error output from GNUstep or other libraries to be missing. You can run a thread in your app to write these streams to the Android log to work around this, which is recommended for debugging.

For the last three points above please refer to GSInitialize.m in the examples for details.

Examples

The android-examples repository contains example projects using this project.

Acknowledgements

Based on original work by Ivan Vučica.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

android toolchain,GitHub - gnustep/tools-android: GNUstep Android Toolchain – Objective-C on Android... 的相关文章

  • ubuntu vi/vim退出文件

    要退出 但是不保存 按esc先 然后输入 q 回车键即可退出 无法退出 则在 q 加入一个叹号回车键就行了 要退出保存的 则输入 wq 强制保存退出 则输入 wq 看到此时已经退出 在等待命令状态 以nano开头编辑文件的 则要退出 按 C
  • SQL Server学习之复合索引

    概要什么是单一索引 什么又是复合索引呢 何时新建复合索引 复合索引又需要注意些什么呢 本篇文章主要是对网上一些讨论的总结 一 概念单一索引是指索引列为一列的情况 即新建索引的语句只实施在一列上 用户可以在多个列上建立索引 这种索引叫做复合索
  • GPT系列模型技术路径演进

    目录 前言 Transformer GPT 1 BERT GPT 2 GPT 3 InstructGPT ChatGPT GPT 4 类ChatGPT产品 Google Bard 诗人 facebook LLaMA 羊驼 复旦 MOSS 清
  • 源码安装ODOO12

    要从源码安装 Odoo 我们首先要从 GitHub 上克隆一套 Odoo 源代码 mkdir home tderp conda envs odoo12 odoo dev 在odoo12虚环境下创建工作目录 cd home tderp con
  • linux怎么打开.o文件,Linux下文件I/O操作的相关知识

    Linux文件I O主要指的是文件的输入输出 很多初学者对文件的I O不是很了解 Linux文件I O的操作较多 下面小编就给大家详细介绍下Linux文件I O linux 文件I O教程 1 一 文件描述符 对内核而言 所以打开的文件都通
  • Android UI架构(十)--App请求切换帧率(1).md

    文章目录 参考资料 前言 背景 查看设备可支持的刷新率和分辨率 App设置设备帧率 Android Q及以下版本 Android R 参考资料 https zhuanlan zhihu com p 142212769 from voters
  • CC00041.bigdatajava——

    一 逻辑运算符概念使用 逻辑运算短路特性 逻辑运算符概念 gt 表示逻辑与运算符 相当于 并且 同真为真 一假为假 gt 表示逻辑或运算符 相当于 或者 一真为真 同假为假 gt 表示逻辑非运算符 相当于 取反 真为假 假为真 gt 逻辑运
  • ES(四)ES使用(基本查询、聚合查询)

    基本操作 操作索引 1 新建索引 curl XPUT localhost 9200 index01 2 查看索引 curl XGET http 192 168 168 101 9200 index01 settings curl XGET
  • Session和Cookie的用法及区别

    Session Cookie是什么 1 1 概念理解 要了解session和cookie是什么 先要了解以下几个概念 1 1 1 无状态的HTTP协议 协议 是指计算机通信网络中两台计算机之间进行通信所必须共同遵守的规定或规则 超文本传输协
  • 独立服务器和虚拟主机,浅谈独立服务器、云服务器、虚拟主机的区别

    当代的生活离不开网络的使用 不管是电商 游戏 还是视频行业 很多业务都需要依赖网络才得以开展 包括海外市场的推广与后期的联系巩固 真是巨大的市场需求 也使网络根据一些特性与使用衍生出了不同的类型 包括服务器 云服务器 虚拟主机等 那么 小编
  • 解决 k8s 集群1.26.3使用nfs时nfs provider selfLink was empty

    背景 1 使用1 26 3版本的集群 2 搭建nfs服务器 3 使用storageclass创建pvc时 一直pending 4 尝试修改vim etc kubernetes manifests kube apiserver yaml 文件
  • makefile工具的使用,编写一个或多个文件!(简单易上手)

    一 make 和 makefile 是什么 1 make 是一个 命令 2 makefile 是一个 文件 可以自动化的构建项目 3 编写 makefile 需要 1 依赖关系 2 依赖方法 二 什么是依赖关系 什么是依赖方法 下面我简单写
  • JUC学习系列五(ThreadLocal)

    该类提供了线程局部 thread local 变量 这些变量不同于它们的普通对应物 因为访问某个变量 通过其 get 或 set 方法 的每个线程都有自己的局部变量 它独立于变量的初始化副本 ThreadLocal 实例通常是类中的 pri
  • 删除oracle数据库用户

    如果在drop 后还提示ORA 01940 无法删除当前已链接的用户 说明还有连接的session 可以通过查看session的状态来确定该session是否被kill 了 用如下语句查看 select saddr sid serial p
  • selenium官方文档——2.入门

    2 1 简单用法 如果你已经安装了Selenium Python绑定 你可以像这样从Python开始使用它 from selenium import webdriver from selenium webdriver common keys
  • 新闻资讯CMS内容管理系统的设计与实现(一)

    新闻资讯CMS内容管理系统的设计与实现 一 目录 1 项目背景 2 项目规划 3 系统结构图 4 系统架构图 5 系统用例图 6 业务流程图 7 E R图 8 领域模型 9 数据字典 10 DDL建表语句 11 数据流图 1 项目背景 如标
  • 2021-1-9 吴恩达-C5 序列模型-w2 自然语言处理与词嵌(课后编程1-Operations on word vectors 词向量运算-含UnicodeDecodeError解决)

    原文链接 如果打不开 也可以复制链接到https nbviewer jupyter org中打开 自然语言处理与词嵌 Operations on word vectors 词向量运算 1 余弦相似度 2 词语类比任务 3 去除词向量中的偏见
  • 阿里巴巴Easyexcel无法追加写入Csv文件的问题

    版本为当前最新版本3 2 1
  • 【分享帖】LCD的MCU接口和SPI接口详解

    LCD Liquid Crystal Display 液晶屏 作为电子产品的重要组成部分 是终端用户与电子产品交互的重要载体 现在市场上的LCD 按照尺寸 功能 接口 用途等分为很多种 本文主要介绍如下两种LCD物理接口 1 MCU接口 8

随机推荐