branches/ogl-es compile error

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
guite
Posts: 3
Joined: Sun Mar 05, 2017 9:49 pm

branches/ogl-es compile error

Post by guite »

Hello everyone,

I’m currently trying to compile the branch “branches/ogl-es” of Irrlicht and it seems that the code cannot compile as is. Just follow the guidelines “BUILDING Irrlicht & your App” in the “examples/27.HelloWorld_Android/readme.txt” files, and you should get the following error on step 3:

Code: Select all

 
[armeabi] Compile++ thumb: Irrlicht <= CIrrDeviceAndroid.cpp
In file included from jni/../../Android/CIrrDeviceAndroid.cpp:12:0:
jni/../../Android/CAndroidAssetReader.h:36:18: error: conflicting return type specified for 'virtual size_t irr::io::CAndroidAssetReader::read(void*, size_t)'
   virtual size_t read(void* buffer, size_t sizeToRead);
                  ^
In file included from ../../../include/IFileArchive.h:8:0,
                 from ../../../include/IFileSystem.h:10,
                 from jni/../../CFileSystem.h:8,
                 from jni/../../Android/CIrrDeviceAndroid.cpp:11:
../../../include/IReadFile.h:24:15: error:   overriding 'virtual irr::s32 irr::io::IReadFile::read(void*, irr::u32)'
   virtual s32 read(void* buffer, u32 sizeToRead) = 0;
               ^
make: *** [obj/local/armeabi/objs/Irrlicht/Android/CIrrDeviceAndroid.o] Error 1
 
If you don’t have this error, it is probably that you are building the project with another architecture. Ensure that you are building Irrlicht for the armeabi (potentially, add APP_ABI=all in the Irrlicht Application.mk file, it should fail for at least one architecture).

Actually I admitted this is a problem in Irrlicht but don’t hesitate to tell me if I did something wrong, maybe I missed something.

Anyway, I could easily fix this compile crash, the only problem being that types “size_t” should not appear and been replaced by s32/u32. I have a simple patch for this problem and here it is:

Code: Select all

 
Index: source/Irrlicht/Android/CAndroidAssetReader.h
===================================================================
--- source/Irrlicht/Android/CAndroidAssetReader.h   (revision 5365)
+++ source/Irrlicht/Android/CAndroidAssetReader.h   (working copy)
@@ -33,7 +33,7 @@
        /** \param buffer Pointer to buffer where read bytes are written to.
        \param sizeToRead Amount of bytes to read from the file.
        \return How many bytes were read. */
-       virtual size_t read(void* buffer, size_t sizeToRead);
+       virtual s32 read(void* buffer, u32 sizeToRead);
 
        //! Changes position in file
        /** \param finalPos Destination position in the file.
Index: source/Irrlicht/Android/CAndroidAssetReader.cpp
===================================================================
--- source/Irrlicht/Android/CAndroidAssetReader.cpp (revision 5365)
+++ source/Irrlicht/Android/CAndroidAssetReader.cpp (working copy)
@@ -36,14 +36,14 @@
        AAsset_close(Asset);
 }
 
-size_t CAndroidAssetReader::read(void* buffer, size_t sizeToRead)
+s32 CAndroidAssetReader::read(void* buffer, u32 sizeToRead)
 {
    int readBytes = AAsset_read(Asset, buffer, sizeToRead);
    if ( readBytes >= 0 )
        return size_t(readBytes);
Tell me if I can commit it somewhere… I’d be happy to contribute :-)

Regards,
Guillaume

PS: I’d also like to add a way to compile the branch for all android architectures but maybe some of the core developers think this is a bad idea.
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: branches/ogl-es compile error

Post by CuteAlien »

Thanks, looks like I wasn't careful when merging that interface change (for unknown reasons the header change didn't get merged or maybe not checked-in). I'll check android branch in the evening and fix it.
It should be IReadFile.h which is changed to:
virtual size_t read(void* buffer, size_t sizeToRead) = 0;
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: branches/ogl-es compile error

Post by CuteAlien »

Sorry, I had messed that up. Seems when I merged svn branches last time I was accidentally in the android sub-folder (instead of the ogl-es main folder) when committing to svn server. So only those files in there got updated and the rest was only changed on my local system. It's fixed now.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply