Page 1 of 1

Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Tue Sep 20, 2016 11:08 pm
by Spekoda
Hei!
Ogre dependencies uses FreeImage 3.15.3 that is using a vulnerable version of libPng. Versions before libPng 1.5.26 are affected.
Beginning Sep 17, 2016, Google Play will block publishing of any new apps or updates that use vulnerable versions of libpng. https://support.google.com/faqs/answer/7011127
My app was blocked and I'm unable to build the latest FreeImage (tried adding it to the ogre dependencies repo directory manually and build with CMake using the old CMakeLists.txt).
Can the ogredeps repo be updated to use valid version of FreeImage? Any advice as how to build Ogre with the new version, please?

Re: Urgent:Google play now blocking apps /w old FreeImage

Posted: Tue Sep 20, 2016 11:50 pm
by dark_sylinc
Why are you unable to build the latest FreeImage? What went wrong?

Re: Urgent:Google play now blocking apps /w old FreeImage

Posted: Wed Sep 21, 2016 11:23 pm
by spacegaier
I just created a new branch "freeimage-3.18.0" in our dependency repository: https://bitbucket.org/cabalistic/ogrede ... age-3.18.0

I did not push to "default" since there is still some testing to be done if it works for all OS and compiler versions. On MS VS 2015 everything works fine and on some older versions as well. However, there is a potential issue with the function "strnlen" which gets re-defined by FreeImage and might need an #if/#endif guard. Also some of the old iOS and Android modifications might need to be moved to the new branch as well.

I am subscribed to this thread. If anyone finds something, let me know or even create a PR.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Thu Sep 22, 2016 10:44 am
by Spekoda
Thanks for quick action! I updated to the freeimage-3.18.0 branch but get this strange error when running nmake:

Code: Select all

[  6%] Building CXX object src/FreeImage/CMakeFiles/FreeImage.dir/Source/FreeIma
ge/PluginG3.cpp.o
In file included from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginG3.c
pp:23:0:
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibTIFF4/tiffiop.h:54:21: fa
tal error: search.h: No such file or directory
compilation terminated.
Maybe it's something trivial, I'm bad when it comes to builds (did manage to build boost for android once though).

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Thu Sep 22, 2016 11:07 am
by spacegaier
The file "search.h" is part of the Windows SDK. for Android however that does not work, which is why we have a custom modifiction in the old FreeImage. I will push that to the new branch in a few minutes. Doing a test build right now.

Update: Pushed: https://bitbucket.org/cabalistic/ogrede ... 711d966825

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 8:55 am
by Spekoda
I get a new error now:

Code: Select all

[  7%] Building CXX object src/FreeImage/CMakeFiles/FreeImage.dir/Source/FreeIma
ge/PluginJXR.cpp.o
In file included from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibJXR
/jxrgluelib/JXRGlue.h:34:0,
                 from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.
cpp:26:
C:\Ogre\depsrepo\src\FreeImage\Source\LibJXR\jxrgluelib/JXRMeta.h:32:26: fatal e
rror: wmspecstring.h: No such file or directory
compilation terminated.
NMAKE : fatal error U1077: 'C:\droid\ndk8e_32\toolchains\arm-linux-androideabi-4
.6\prebuilt\windows\bin\arm-linux-androideabi-g++.exe' : return code '0x1'
Stop.
Sounds like it's also Win SDK issue?

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 9:53 am
by spacegaier
Spekoda wrote:Sounds like it's also Win SDK issue?
No, this time it's an include folder issue. On non-Win platforms some more files are required by LibJXR which are all part of FreeImage, but in the CMake script the folder path was incorrect. On my Windows machines this error does not happen.

I committed a fix. Please try again.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 10:58 am
by Spekoda
This time there are multiple errors.
This is repeated for every 'GUID_PKPixelFormat...':

Code: Select all

In file included from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.
cpp:26:0:
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibJXR/jxrgluelib/JXRGlue.h:
99:1: error: expected initializer before 'GUID_PKPixelFormatDontCare'
...
Then in the end:

Code: Select all

C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.cpp: In function 'ERR
GetOutputPixelFormat(FIBITMAP*, PKPixelFormatGUID*, BOOL*)':
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.cpp:326:17: error: 'GU
ID_PKPixelFormatDontCare' was not declared in this scope
...
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.cpp: In function 'ERR
CopyPixels(PKImageDecode*, PKPixelFormatGUID, FIBITMAP*, int, int)':
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.cpp:1097:35: error: 'G
UID_PKPixelFormat24bppRGB' was not declared in this scope
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginJXR.cpp:1097:95: error: 'G
UID_PKPixelFormat32bppRGB' was not declared in this scope

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 11:42 am
by spacegaier
After a bit of googling I found a possible solution. I updated the CMakeList.txt.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 12:41 pm
by Spekoda
It goes past the previous error but there's a new one:

Code: Select all

[  9%] Building CXX object src/FreeImage/CMakeFiles/FreeImage.dir/Source/FreeIma
ge/PluginRAW.cpp.o
In file included from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibRaw
Lite/libraw/libraw_datastream.h:36:0,
                 from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibRaw
Lite/libraw/libraw.h:40,
                 from C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\PluginRAW.cpp:22:
C:\Ogre\depsrepo\src\FreeImage\Source\FreeImage\/../LibRawLite/libraw/libraw_typ
es.h:484:2: error: #error Unable to figure out byte order.
Something about byte endianness?

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 1:49 pm
by spacegaier
If you look at the file causing the error (libraw_types.h lines 463ff), you will see that in your Android build no condition is met. I am not sure which one to actually use on Android, so you would have to test that and then let us know and we can add it to the CMake script.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Fri Sep 23, 2016 10:01 pm
by farrer
When building with:

Code: Select all

-DANDROID_ABI=armeabi-v7a
which is my case, we should be at:

Code: Select all

#elif defined(_ARM_)
(line 480)
so, for this ABI, the CMake script must either define "_ARM_" or check ANDROID_ABI here.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Mon Sep 26, 2016 11:53 am
by spacegaier
@Spekoda: Did the proposal from "farrer" work for you as well? If it does, we can adopt the CMake script to sent _ARM_ for Android builds.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Tue Oct 04, 2016 3:17 pm
by Spekoda
Sorry for late reply, I was away for a week. I was able to get it built further by these hacky steps:

1. Add "#define _ARM_ 1" to libraw_types.h before the /*Byte order*/ block (It should be defined at CMake level I think)
2. Moved the swab function from dcraw_common.cpp to libraw.h because it wasn't visible from libraw_cxx.cpp compilation unit

But then the following error:

Code: Select all

[ 50%] Building C object src/FreeImage/CMakeFiles/FreeImage.dir/Source/LibWebP/s
rc/dsp/dsp.cpu.c.o
C:\Ogre\depsrepo\src\FreeImage\Source\LibWebP\src\dsp\dsp.cpu.c:22:26: fatal err
or: cpu-features.h: No such file or directory
compilation terminated.
There is a file cpu-features.h in the android ndk. I tried adding it to the path and copying it to LibWebP source but it didn't help.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Sun Oct 16, 2016 5:17 pm
by Spekoda
I managed to get it built after learning cmake script basics. However FreeImage's new LibWebP plugin library refused to build / link no matter what I tried. Well I got it built by pulling and building webp separately from:

Code: Select all

git clone https://chromium.googlesource.com/webm/libwebp
The source of webp included CMakeLists.txt that I used to build libwebp.a for armeabi-v7a, by using the ogredeps android.toolchain.cmake toolchain file. Then imported the libwebp.a from the CMakeLists of FreeImage and libFreeImage.a was created. However during the linking of an Ogre android project all references to webp functions were undefined. I therefore removed the webp plugin from the build of FreeImage and everything is working now.

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Posted: Tue Mar 21, 2017 8:59 pm
by kobraksq
Hi Spekoda,

Thanks, your post help me to make my build for Play store successfully. :D