Urgent: GooglePlay now blocking apps with old FreeImage

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Urgent: GooglePlay now blocking apps with old FreeImage

Post 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?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5433
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1341

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

Post by dark_sylinc »

Why are you unable to build the latest FreeImage? What went wrong?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

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

Post 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.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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).
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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
You do not have the required permissions to view the files attached to this post.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post by spacegaier »

After a bit of googling I found a possible solution. I updated the CMakeList.txt.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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?
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
farrer
Halfling
Posts: 64
Joined: Mon Sep 12, 2011 7:35 pm
x 13

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 136

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
Spekoda
Halfling
Posts: 40
Joined: Wed Jun 12, 2013 5:38 pm
Location: Finland
x 2

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post 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.
kobraksq
Gnoblar
Posts: 1
Joined: Tue Mar 21, 2017 8:40 pm

Re: Urgent: GooglePlay now blocking apps with old FreeImage

Post by kobraksq »

Hi Spekoda,

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