Hi Erich,

thank you for your helpful feedback.
Its a cross compile Arch Linux - Android
I just took the Android Toolchain File from the Android NDK. I did not modify 
this file at all.
In the cmake command I define gcc as C compiler and g++ as C++ compiler.

My initial cmake command is:

cmake 
-DCMAKE_TOOLCHAIN_FILE=~/coding/android-ndk-r22b/build/cmake/android.toolchain.cmake
 -DANDROID_ABI="x86" -DCMAKE_BUILD_TYPE=Release \
                                                      -DCMAKE_C_COMPILER=$CC 
-DCMAKE_CXX_COMPILER=$CXX -DANDROID_NATIVE_API_LEVEL=22

r22b is the latest stable version of the android native developer kit (NDK) 
which provides for example the Android Toolchain File. Back in 2015 the 
Toolchain File was a project of an external developer. It still exists on 
Github but is now officially included in the Android NDK. Bionic Software 
provides for example the spawn.h file. With 28 they must refer to the API-Level 
of the Target System.
The API Level is set to 22. So below 28 as you mentioned. API Level 22 is 
Android Lollipop 5.1. 28 would be Android Pie 9.0. I did a little research and 
found out that up to API level 28, there were about 70 Posix functions missing. 
These were added with level 28. So it makes a lot of sense to try out to build 
for 28.

Indeed my CMake run has problems. I didn't noticed them till I took a closer 
look.
The output is:
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_mutexattr_settype
-- Looking for pthread_mutexattr_settype - not found
-- Looking for pthread_mutex_timedlock
-- Looking for pthread_mutex_timedlock - not found
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK - Failed
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE - Failed

There are some other problems also. E.g. ncurses.h is also not found. When i 
remember correctly this file is also needed for the installation of ooRexx on 
Ubuntu. But it installed just fine on my Arch Linux System wiithout it.

First thing for me todo is the build for API Level 28 I guess. I will update as 
soon as I know more about this.

Have a great evening

Best regards
Thomas


On 5/23/21 9:36 PM, Erich Steinböck wrote:
Hi Thomas!

Removing ${ORX_SYSLIB_PTTHREAD} in CMakeLists.txt helps a bit but instead of 
getting the error:
"cannot find -lpthread"

As far as I can see, Android doesn't have libpthread, so your fix seems 
reasonable

"error: use of undeclared identifier 'posix_spawn_file_actions_init'; did you 
mean 'posix_spawn_file_actions_t'?"
In spawn.h, where your compiler complains that there is a  
posix_spawn_file_actions_t, but no posix_spawn_file_actions_init, I can see that
posix_spawn_file_actions_init is actually declared in line 81 (see 
https://android.googlesource.com/platform/bionic/+/master/libc/include/spawn.h)
Can you check your actual spawn.h whether it declares it?
Regarding the "__INTRODUCED_IN(28)" declaration: maybe your compile is 
restricted to a certain API level below 28
Does "android-ndk-r22b" mean your development toolkit is level 22?

if (ANDROID)
    add_definitions(-DHAVE_PTHREAD_MUTEXATTR_SETTYPE)
    add_definitions(-DHAVE_PTHREAD_MUTEX_RECURSIVE)
endif ()
I don't think this makes sense.  When CMake runs, it checks for available 
features (you can see found features in the CMake output) and then sets those 
defines appropriately.
A typical run will show below CMake output.  What do you see?
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_mutexattr_settype
-- Looking for pthread_mutexattr_settype - found
-- Looking for pthread_mutex_timedlock
-- Looking for pthread_mutex_timedlock - found
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK
-- Performing Test HAVE_PTHREAD_MUTEX_ERRORCHECK - Success
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE
-- Performing Test HAVE_PTHREAD_MUTEX_RECURSIVE - Success


What's the general setup here .. how did you set up your Android tool chain?
Which compiler is this? CLANG?
Is this a cross-compile - host Mac, target Android?

Regards,
E




_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net<mailto:Oorexx-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to