Coder Social home page Coder Social logo

gnustep / tools-android Goto Github PK

View Code? Open in Web Editor NEW
42.0 12.0 11.0 229 KB

Objective-C on Android with Foundation, CoreFoundation, and libdispatch.

License: MIT License

Shell 100.00%
android objective-c objective-c-plus-plus gnustep foundation corefoundation libdispatch

tools-android's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tools-android's Issues

x86 build fails due relocation linker error against libffi on x86

With the latest libffi v3.4.3 update we get the following linker error:

 Linking library libgnustep-base ...
ld.lld: error: relocation R_386_PC32 cannot be used against symbol open_temp_exec_file; recompile with -fPIC
>>> defined in /build/x86/lib/libffi.a(closures.o)
>>> referenced by closures.c
>>>               closures.o:(dlmmap_locked) in archive /build/x86/lib/libffi.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

The libffi issue contains more details.

Build failure in libcurl with NDK r26

libcurl/lib/formdata.c:796:10: error: call to undeclared function 'fseeko'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  return fseeko(stream, (off_t)offset, whence);
         ^

This error was also discussed in curl/curl#12086.

Building libxml2 fails

Building the toolchain fails with the following error:

### Updating project
From https://github.com/GNOME/libxml2
* [new branch]        mainline   -> origin/mainline
Your configuration specifies to merge with the ref ‘refs/heads/master’
from the remote, but no such ref was fetched.

### phases/14-libxml2.sh failed for ABI armeabi-v7a

Building with NDK r25 fails

The default NDK version of the GitHub Actions runner images has been updated to r25, which makes the CI builds fail with the following error:

CMake Error at /Users/runner/Library/Android/sdk/ndk/25.1.8937393/build/cmake/android-legacy.toolchain.cmake:168 (message): 15866 Disabling Neon is no longer supported

Build failure in libffi with NDK r26

Building with the newly released NDK 26.0.10792818 results in the following build error in libffi:

../src/tramp.c:262:22: error: call to undeclared function 'open_temp_exec_file'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  tramp_globals.fd = open_temp_exec_file ();
                     ^

This was already fixed in upstream libffi, but the fix is not yet part of a public release.

libxml2 not found when building libxslt

[...]
checking for fprintf... yes
checking for snprintf... yes
checking for vfprintf... yes
checking for vsprintf... yes
checking for vsnprintf... yes
checking for sscanf... yes
checking for clock_gettime... yes
checking for perl... perl
checking for python... /usr/bin/python
PYTHON is pointing at /usr/bin/python
Found Python version 2.7
Found libxml2-python module
could not find python2.7/Python.h
Disabling crypto support
Enabling debugger
Enabling profiler
checking for armv7a-linux-androideabi-xml2-config... no
checking for xml2-config... /Users/jbheuschen/Library/Android/GNUstep/armeabi-v7a/bin/xml2-config
configure: error: Could not find libxml2 anywhere, check ftp://xmlsoft.org/.

### phases/17-libxslt.sh failed for ABI armeabi-v7a

The previous toolchain build has been restored. The failed build can be found at:
/Users/jbheuschen/Library/Android/GNUstep.failed

Unfortunately, I'm unable to build the project as the libxslt-phase always fails to configure, saying it couldn't find the previously-built libxml2. The libxml2 build-phase, however, compiles and installs successfully. Hence, the libxml2 files in "Android/GNUStep/amreabi-v7a" are present, too. I have to admit, though, that I'm not very experienced with this kind of stuff - I hope I didn't miss something. Is this a known problem and can it be fixed? Thanks in advance for any help!

My system:
OS: macOS 11.3.1 (M1/arm64)
CMake: 3.20.2
Android NDK: 22.1.7171670
build.log

Build fails in libdispatch on macOS 12.6

In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:550:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__threading_support:14:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/chrono:829:
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/ratio:157:7: error: explicit specialization of undeclared template class '__ll_add'
class __ll_add<_Xp, _Yp, -1>
      ^       ~~~~~~~~~~~~~~
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/ratio:156:1: error: templates must have C++ linkage
template <intmax_t _Xp, intmax_t _Yp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/heron/Development/gnustep/tools-android/src/libdispatch/src/internal.h:323:1: note: extern "C" language linkage specification begins here
__BEGIN_DECLS
^
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/sys/cdefs.h:46:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS extern "C" {
                      ^
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/block.cpp:31:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/internal.h:666:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims.h:220:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims/atomic.h:38:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/include/stdatomic.h:45:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:550:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__threading_support:14:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/chrono:829:
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/ratio:167:50: error: no template named '__static_sign'; did you mean '__static_max'?
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
                                                 ^
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/type_traits:2090:8: note: '__static_max' declared here
struct __static_max;
       ^
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/block.cpp:31:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/internal.h:666:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims.h:220:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims/atomic.h:38:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/include/stdatomic.h:45:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:550:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__threading_support:14:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/chrono:829:
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/ratio:167:1: error: templates must have C++ linkage
template <intmax_t _Xp, intmax_t _Yp, intmax_t = __static_sign<_Yp>::value>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/heron/Development/gnustep/tools-android/src/libdispatch/src/internal.h:323:1: note: extern "C" language linkage specification begins here
__BEGIN_DECLS
^
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/sys/cdefs.h:46:23: note: expanded from macro '__BEGIN_DECLS'
#define __BEGIN_DECLS extern "C" {
                      ^
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/block.cpp:31:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/internal.h:666:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims.h:220:
In file included from /Users/heron/Development/gnustep/tools-android/src/libdispatch/src/shims/atomic.h:38:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/lib64/clang/14.0.6/include/stdatomic.h:45:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:550:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/__threading_support:14:
In file included from /Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/chrono:829:
/Users/heron/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/ratio:171:7: error: explicit specialization of undeclared template class '__ll_sub'
class __ll_sub<_Xp, _Yp, 1>
      ^       ~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [src/CMakeFiles/dispatch.dir/block.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 38%] Built target bsdtests
make[1]: *** [src/CMakeFiles/dispatch.dir/all] Error 2
make: *** [all] Error 2

### phases/12-libdispatch.sh failed for ABI armeabi-v7a

The previous toolchain build has been restored. The failed build can be found at:

ndk

I appear to have the right NDK installed

Missing: How to configure Android project for GNUstep use

As an iOS developer with little Android experience (which makes GNUstep especially tempting) I had no problem going from the toolchain setup instructions to the sample project. However, configuring your own new or existing Android project for GNUstep is not yet documented.

Looking at the linked android-examples I tried the following (maybe this can be used as a draft for a new section at the end of the existing README, once it works):

  1. New project in Android Studio
    a. Basic Fragment with View Model
    b. Enable Kotlin

  2. Create folder app/src/main/cpp

  3. Add CMakeLists.txt () to cpp folder

  4. Edit CMakeLists.txt to include your Objective-C implementation (.m) files in OBJECTIVEC_SRCS

  5. Edit app/build.gradle. Add:

    externalNativeBuild {
    cmake {
    cppFlags ""
    }
    }
    ndk {
    // ABIs supported by GNUstep toolchain
    abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
    }

  6. Edit MainActivity class: Add

    init {
    System.loadLibrary(„native-lib“)
    }

So far this fails at System.loadLibrary("native-lib") with following error:

2020-02-12 12:32:19.933 985-985/zoziapps.ch.sousvidecelsius E/AndroidRuntime: FATAL EXCEPTION: main
Process: zoziapps.ch.sousvidecelsius, PID: 985
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZNSt6__ndk111__call_onceERVmPvPFvS2_E" referenced by "/data/app/zoziapps.ch.sousvidecelsius-qgnwdnfRmeXSFCUffVd7bw==/lib/x86/libgnustep-base.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1669)
at zoziapps.ch.sousvidecelsius.MainActivity.(MainActivity.kt:15)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:69)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:43)
at android.app.Instrumentation.newActivity(Instrumentation.java:1215)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

How can I learn more about it?

Hi,

I would like to know more about the project.
Put simply, what’s this about and what I can do with this? Writing Android apps using Objective-C?
What would be the pros?

Best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.