Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Android and iOS ports available for testing  (Read 337610 times)

0 Members and 6 Guests are viewing this topic.

ncsu121978

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Android and iOS ports available for testing
« Reply #60 on: January 03, 2014, 11:11:56 pm »
Whenever I try to use cmake on ubuntu I get the following results:

The commands I use are:
export ANDROID_NDK=/home/daniel/Desktop/programming/android/adt-x86/ndk/
and
cmake -CMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_USE_STLPORT=1 ..


This is the result and cant get to the bottom of it:
loading initial cache file MAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake
CMake Error: Error processing file:MAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/i386-linux-gnu/libX11.so;/usr/lib/i386-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/i386-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/i386-linux-gnu/libGL.so
-- Found GLEW: /usr/lib/i386-linux-gnu/libGLEW.so
-- Found JPEG: /usr/lib/i386-linux-gnu/libjpeg.so
-- Found Freetype: /usr/lib/i386-linux-gnu/libfreetype.so
-- Found OpenAL: /usr/lib/i386-linux-gnu/libopenal.so
-- Found SNDFILE: /usr/lib/i386-linux-gnu/libsndfile.so
-- Configuring incomplete, errors occurred!



So not sure what the config error is as it doesnt actually tell me any specific error.....anything I am missing here?

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #61 on: January 03, 2014, 11:23:22 pm »
Your command line is wrong. To set a define on the command line you'll have to make sure to start with a "D" (for define):

cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_USE_STLPORT=1 ..

ncsu121978

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Android and iOS ports available for testing
« Reply #62 on: January 04, 2014, 03:17:25 am »
inserted the D there and now I have different issues.  I consider myself pretty computer savy but not overly so on Linux so I am trying to track it down as much as possible....but this is what i am getting now

Quote
daniel@ubuntu:~/Desktop/programming/android/SFML/build$ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_USE_STLPORT=1 ..
CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/x86-4.6/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/arm-linux-androideabi-clang3.3/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/mipsel-linux-android-4.6/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/x86-clang3.2/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/llvm-3.2/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/arm-linux-androideabi-clang3.2/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/mipsel-linux-android-clang3.3/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/x86-4.8/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/mipsel-linux-android-clang3.2/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/llvm-3.3/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/x86-clang3.3/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Warning at cmake/toolchains/android.toolchain.cmake:326 (message):
  Could not uniquely determine machine name for compiler from
  /home/daniel/Desktop/programming/android/adt-x86/ndk-r9/toolchains/mipsel-linux-android-4.8/prebuilt/linux-x86_64.
Call Stack (most recent call first):
  cmake/toolchains/android.toolchain.cmake:502 (__DETECT_TOOLCHAIN_MACHINE_NAME)
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Error at cmake/toolchains/android.toolchain.cmake:514 (message):
  Could not any working toolchain in the NDK.  Probably your Android NDK is
  broken.
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:86 (INCLUDE)
  CMakeLists.txt:17 (project)


CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/home/daniel/Desktop/programming/android/SFML/build/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/home/daniel/Desktop/programming/android/SFML/build/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

I know that is a lot to look at so here is what I figure out about it so far on my own.  All those initial warnings looks like they are looking for the compilers in the NDK directories but for some reason it seems to be looking in a linux-x86_64 directory which wont exist in that location for any of those since I am on an x86 system (actually in WMware Player) and only have the linux-86 directory there because I downloaded the x86 NDK from the Android website.

So it looks like it goes through all the folders i guess looking for a compatible compiler but it cant find one do to the fact that the folder it tries to look in doesnt exist.  And since it cant find one, it is unable to set all the variables at the bottom of that error list.

I know overall the NDK works as I can do a simple project using the ADT and use native code on my own making some OpenGL calls with success.

Anyone have had a similar issue?  I been trying to hack through this most of the day and am about to go back and give it a shot in Windows but am trying to teach myself Linux stuff at the same time so would like to develop in that system to become more familiar with it.





EDIT:
It seems if I run the same command twice consecutively, the second time it looks in the linux-86 directories and gives warning on a few of the directories but seems to find some of the compatible compilers and is therefore able to set those variables and it reports "Configuring done" and "Generating done".

I then try the make -j8 command and get the following
Quote
daniel@ubuntu:~/Desktop/programming/android/SFML/build$ make -j8
Scanning dependencies of target sfml-system
Scanning dependencies of target sfml-activity
Scanning dependencies of target sfml-main
[  1%] Building CXX object src/SFML/Main/CMakeFiles/sfml-activity.dir/SFMLActivity.cpp.o
/home/daniel/Desktop/programming/android/SFML/src/SFML/Main/SFMLActivity.cpp: In function 'void ANativeActivity_onCreate(ANativeActivity*, void*, size_t)':
/home/daniel/Desktop/programming/android/SFML/src/SFML/Main/SFMLActivity.cpp:151:113: warning: invalid conversion from 'void*' to 'void (*)(ANativeActivity*, void*, size_t) {aka void (*)(ANativeActivity*, void*, unsigned int)}' [-fpermissive]
     void (*ANativeActivity_onCreate)(ANativeActivity*, void*, size_t) = dlsym(handle, "ANativeActivity_onCreate");
                                                                                                                 ^
[  2%] Building CXX object src/SFML/Main/CMakeFiles/sfml-main.dir/MainAndroid.cpp.o
[  3%] [  4%] Linking CXX shared library ../../../lib/libsfml-activity.so
[  6%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Clock.cpp.o
arm-linux-androideabi-g++: error: SONAME_FLAGlibsfml-activity.so: No such file or directory
make[2]: *** [lib/libsfml-activity.so] Error 1
make[1]: *** [src/SFML/Main/CMakeFiles/sfml-activity.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  7%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Err.cpp.o
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Lock.cpp.o
[  8%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Mutex.cpp.o
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Sleep.cpp.o
[  9%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/String.cpp.o
[ 10%] [ 12%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/ThreadLocal.cpp.o
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Thread.cpp.o
[ 13%] [ 14%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Time.cpp.o
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ClockImpl.cpp.o
[ 15%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/MutexImpl.cpp.o
[ 17%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/SleepImpl.cpp.o
[ 18%] [ 19%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadImpl.cpp.o
[ 20%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Unix/ThreadLocalImpl.cpp.o
Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Android/Activity.cpp.o
[ 21%] Building CXX object src/SFML/System/CMakeFiles/sfml-system.dir/Android/ResourceStream.cpp.o
Linking CXX static library ../../../lib/libsfml-main.a
[ 21%] Built target sfml-main
Linking CXX shared library ../../../lib/libsfml-system.so
arm-linux-androideabi-g++: error: SONAME_FLAGlibsfml-system.so: No such file or directory
make[2]: *** [lib/libsfml-system.so] Error 1
make[1]: *** [src/SFML/System/CMakeFiles/sfml-system.dir/all] Error 2
make: *** [all] Error 2
daniel@ubuntu:~/Desktop/programming/android/SFML/build$

errors in building the actual libraries
« Last Edit: January 04, 2014, 03:29:19 am by ncsu121978 »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #63 on: January 04, 2014, 11:31:26 am »
There's something going wrong. I'd suggest you clear your build directory by hand and try once again. Maybe the first attempts screwed up something. Or did you do that already?

ncsu121978

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Android and iOS ports available for testing
« Reply #64 on: January 04, 2014, 06:18:41 pm »
yeah i have tried multiple times deleting the entire build directory and starting over from scratch with the same results.

Cpl.Bator

  • Hero Member
  • *****
  • Posts: 540
    • View Profile
Re: Android and iOS ports available for testing
« Reply #65 on: January 04, 2014, 06:44:25 pm »
Quote
arm-linux-androideabi-g++: error: SONAME_FLAGlibsfml-system.so: No such file or directory

Same problem here.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Android and iOS ports available for testing
« Reply #66 on: January 04, 2014, 07:32:00 pm »
Can't test is right now,  but looks like a typo in the code (like missing space or something similar).

ncsu121978

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Android and iOS ports available for testing
« Reply #67 on: January 05, 2014, 03:33:40 am »
it it helps i am using cmake version 2.8.7 from the command line on Ubuntu 12.04

ncsu121978

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Android and iOS ports available for testing
« Reply #68 on: January 05, 2014, 08:25:09 am »
so it appears i finally got success in using cmake and compiling sfml for android....here is what i found out should others have the same issue.

1 - I was initially using cmake 2.8.7 and was having all of those problems and errors outlined in my first post
2 - I then put some message statements into the cmake toolchain file and realized that it wasnt pulling in the ANDROID_NDK environment variable i was setting from the command line so as far as cmake was concerned the path to the ANDROID_NDK was "".  So I just added that variable on the command line to cmake and was able to cmake successfully
Quote
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_USE_STLPORT=1 -DANDROID_NDK=/home/daniel/Desktop/programming/android/adt-x86/ndk-r9 ..
3 - but at that point I would then try to do the make but would receive errors in the compilation process due to the SONAME_FLAG issue that was detailed in the other post.  I did some googling and people recommened to update cmake to at least 2.8.9 to fix that issue
4 - So i go to the cmake website and get the latest version of 2.8.12 and installed it
5 - I then went back and deleted my build dir and recreated it empty and ran cmake again.....now cmake would give errors about unable to find certain files and I found that it was putting its version number (2.8.12) into that path of where it expected some of the cmake files inside the SFML drectories
6 - I then went and downgraded to cmake 2.8.9 and started this process over again
7 - this time success with cmake and make to build the libraries
8 - now i did still have to specify the ANDROID_NDK on the command line for cmake as for some reason it wouldnt pick up the environment variable of the same name i would export right before doing the cmake

hopefully anyone else running into this problem then this will help them out

now my next task is figuring out how to get the sfml into my programs.  I have already been doing some NDK stuff on my own with raw OpenGL so I have figured out a little of it.  I also dabbled with SDL2 when I was hitting these brick walls with SFML and successfully got it setup, but I much prefer the c++ interface of SFML so I came back to give it another shot in compiling it and success this time.

If anyone has a step by step process to use SFML in an eclipse project then let me know.

Fizix

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Android and iOS ports available for testing
« Reply #69 on: January 08, 2014, 03:24:20 am »
Tried testing on x86 emulator with the following results:

1.  Creating a pbuffer with 0 size (which is the default if no params are specified in the attribs) results in an EGL_BAD_ALLOC error and crashes the app.

2.  I could not get it to load an image successfully.  new priv::ResourceStream(filename); in Image.cpp:134 causes: Fatal signal 11 (SIGSEGV)...

When not trying to load textures, the rest works as expected.

EDIT: Tried the same thing for arm on an actual device (galaxy s4) and get a similar problem.  It gets fatal signal 11 at 0xdeadbaad, so somewhere something uninitialized is used it seems.
« Last Edit: January 08, 2014, 03:40:56 am by Fizix »

Fizix

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Android and iOS ports available for testing
« Reply #70 on: January 09, 2014, 02:41:42 pm »
After testing some devices it's clear that the pbuffer problem only happens on some devices.  Creating it with size 1x1 solves it for all devices.

My seg fault problems was due to main creating a temp std::string to call things like Texture::loadFromFile and Music::openFromFile.  I don't know much about these things but it looks like a library linking issue.  Adding a new method that takes a const char* and forwarding it to the std::string version solves the problem 100%.

Also, I'm new here and would like to know if I can log bugs somewhere or send pull requests or anything else to help out.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile

OgreValley

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Android and iOS ports available for testing
« Reply #72 on: January 10, 2014, 07:30:23 pm »
Hi,

Am I the only one getting an error message telling that 'EGL/egl.h file not found', when building for iOS?

I've looked through the whole post, and it doesn't seem that anyone else have the same problem.

I'm running OSX 10.9 Mavericks, iOS 7 on x64 simulator.

/Kenneth

PaoloOrange

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Android and iOS ports available for testing
« Reply #73 on: January 21, 2014, 02:36:59 pm »
Hi,

Am I the only one getting an error message telling that 'EGL/egl.h file not found', when building for iOS?

I've looked through the whole post, and it doesn't seem that anyone else have the same problem.

I'm running OSX 10.9 Mavericks, iOS 7 on x64 simulator.

/Kenneth

I have the same issue (and the same system configuration).

nero81af

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Android and iOS ports available for testing
« Reply #74 on: January 27, 2014, 02:02:57 am »
hello! I'm new to the forum and I'm doing some testings on ios and android ports in order to make a cross platform framework.

I'm building sfml in my own makefiles and building only window and system modules in libsfml.a on windows using mingw: these are my compilation flags:

DEFS= -DSFML_STATIC -DSFML_OPENGL_ES -D__STDC_FORMAT_MACROS -D__USE_BSD -D_BSD_SOURCE -DPOSIX_SOURCE -DGL_GLEXT_PROTOTYPES -Dfdatasync=fsync -DPIC -fPIC -fexceptions -frtti -std=gnu++11
LDFLAGS = -lGLESv1_CM -lGLESv2 -lstlport_static -lc -ldl -lgcc -landroid -lEGL
CFLAGS = -shared -LC:\android\ndk\sources/cxx-stl/stlport/libs/armeabi-v7a -LC:\android\ndk\platforms/android-17/arch-arm/usr/lib C:\android\ndk\platforms/android-17/arch-arm/usr/lib/crtbegin_static.o -nostdlib -Wl,--no-undefined -Wl,--whole-archive libsfml.a -Wl,--no-whole-archive

everything goes ok in window and linux but once I try android things gets hard: I managed to compile and make an apk but when I run a simple main creating a window and displaying a cube, I get a black screen in emulator. in particular eglCreatePbufferSourface returns egl_bad_alloc. I tried to fix it using some custom attributes list: no more errors but still I get black screen with eglSurfaceAttrib not implemented.

#include <stdio.h>

#include <exception>

#include "rs.hpp"
#ifdef RS_PLATFORM_ANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#elif RS_PLATFORM_IOS
#include <OpenGLES/ES1/gl.h>
#include <OpenGLES/ES1/glext.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include "glew/GL/glew.h"
#endif
#include "sfml/SFML/Window.hpp"

#define _PLAYGROUND_NAME    "playground"
#define _PLAYGROUND_VERSION "0.1.0"

using namespace std;

int main(int argc,char **p_argv)
{
        try
        {
                sf::Window window(sf::VideoMode::getDesktopMode(),"OpenGL");
                glEnable(GL_DEPTH_TEST);
                glDepthMask(GL_TRUE);
#ifdef RS_PLATFORM_ANDROID
                glClearColor(1.0,1.0,1.0,1.0);
                glClearDepthf(1.f);
#elif RS_PLATFORM_IOS
                glClearColor(1.0,1.0,1.0,1.0);
                glClearDepthf(1.f);
#else
                glClearDepth(1.f);
#endif
                glDisable(GL_LIGHTING);
                glViewport(0,0,window.getSize().x,window.getSize().y);
                glMatrixMode(GL_PROJECTION);
                glLoadIdentity();
                GLfloat ratio = static_cast<float>(window.getSize().x) / window.getSize().y;
#ifdef RS_PLATFORM_ANDROID
                glFrustumf(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#elif RS_PLATFORM_IOS
                glFrustumf(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#else
                glFrustum(-ratio, ratio, -1.f, 1.f, 1.f, 500.f);
#endif

                GLfloat cube[] =
                {
                        -20, -20, -20,  0, 0,
                        -20,  20, -20,  1, 0,
                        -20, -20,  20,  0, 1,
                        -20, -20,  20,  0, 1,
                        -20,  20, -20,  1, 0,
                        -20,  20,  20,  1, 1,
                         20, -20, -20,  0, 0,
                         20,  20, -20,  1, 0,
                         20, -20,  20,  0, 1,
                         20, -20,  20,  0, 1,
                         20,  20, -20,  1, 0,
                         20,  20,  20,  1, 1,
                        -20, -20, -20,  0, 0,
                         20, -20, -20,  1, 0,
                        -20, -20,  20,  0, 1,
                        -20, -20,  20,  0, 1,
                         20, -20, -20,  1, 0,
                         20, -20,  20,  1, 1,
                        -20,  20, -20,  0, 0,
                         20,  20, -20,  1, 0,
                        -20,  20,  20,  0, 1,
                        -20,  20,  20,  0, 1,
                         20,  20, -20,  1, 0,
                         20,  20,  20,  1, 1,
                        -20, -20, -20,  0, 0,
                         20, -20, -20,  1, 0,
                        -20,  20, -20,  0, 1,
                        -20,  20, -20,  0, 1,
                         20, -20, -20,  1, 0,
                         20,  20, -20,  1, 1,
                        -20, -20,  20,  0, 0,
                         20, -20,  20,  1, 0,
                        -20,  20,  20,  0, 1,
                        -20,  20,  20,  0, 1,
                         20, -20,  20,  1, 0,
                         20,  20,  20,  1, 1
                };

                glEnableClientState(GL_VERTEX_ARRAY);
                glEnableClientState(GL_TEXTURE_COORD_ARRAY);
                glVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), cube);
                glTexCoordPointer(2, GL_FLOAT, 5 * sizeof(GLfloat), cube + 3);
                glDisableClientState(GL_NORMAL_ARRAY);
                glDisableClientState(GL_COLOR_ARRAY);
                sf::Clock clock;

                while (window.isOpen())
                {
                        sf::Event event;
                        while (window.pollEvent(event))
                        {
                                        if (event.type == sf::Event::Closed)
                                                        window.close();
                        }

                        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                        glMatrixMode(GL_MODELVIEW);
                        glLoadIdentity();
                        glTranslatef(0, 0, -100.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 50.f, 1.f, 0.f, 0.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 30.f, 0.f, 1.f, 0.f);
                        glRotatef(clock.getElapsedTime().asSeconds() * 90.f, 0.f, 0.f, 1.f);
                        glDrawArrays(GL_TRIANGLES, 0, 36);
                        window.display();
                }
        }
        catch(exception &exception)
        {

        }

        return 0;
}