Skip to contentSkip to conversation

package/libfreeimage: fix build with GCC 14.x

PATCH Applied Thomas Petazzoni via buildroot 1 participant 3 messages Sep 8, 2025 – Sep 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libfreeimage: fix build with GCC 14.x

Take two patches from the Debian jxrlib package, and integrate them to fix the build of the bundled jxrlib library found in the libfreeimage package.

libfreeimage isn't exactly well maintained: its last version 3.18.0 is quite old (July 2018), there's a fairly large number of tickets in the bug tracker claiming to be CVE
reports (https://sourceforge.net/p/freeimage/bugs/), it is still using SVN as the version control system.

However, it is used as an optional dependency for CEGUI, and a mandatory dependency for Ogre. However, it no longer seems to be a dependency for more recent versions of Ogre. But in any case it cannot simply be dropped.

Fixes:

https://autobuild.buildroot.net/results/452462285bf93b13f092fb41696952f415e75b2f/

---
 .../0005-jxrlib-ftbfs-with-GCC-14.patch       | 40 +++++++++++++++++++
 ...BFS-fix-for-function-prototype-error.patch | 29 ++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 package/libfreeimage/0005-jxrlib-ftbfs-with-GCC-14.patch
 create mode 100644 package/libfreeimage/0006-FTBFS-fix-for-function-prototype-error.patch
package/libfreeimage/0005-jxrlib-ftbfs-with-GCC-14.patch new file +40 -0
new file mode 100644
index 0000000000..c13a8dc26f
@@ -0,0 +1,40 @@
+From 11383a017e8d040f1376c964d2b8769108204f0b Mon Sep 17 00:00:00 2001
+From: YOKOTA Hiroshi <[email protected]>
+Date: Thu, 25 Jul 2024 15:03:31 +0900
+Subject: [PATCH] jxrlib: ftbfs with GCC-14
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Bug-Debian: https://bugs.debian.org/1075105
+
+_byteswap_ulong() is defined in image/sys/strcodec.c
+
+Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
+[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0013-jxrlib-ftbfs-with-GCC-14.patch/]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+----
+/usr/bin/cc -DDISABLE_PERF_MEASUREMENT -D__ANSI__ -Djpegxr_EXPORTS -I"/<<PKGBUILDDIR>>/common/include" -I"/<<PKGBUILDDIR>>/image/sys" -I"/<<PKGBUILDDIR>>/jxrgluelib" -I"/<<PKGBUILDDIR>>/jxrtestlib" -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wall -Wextra -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -w -MD -MT CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -MF CMakeFiles/jpegxr.dir/image/encode/strenc.c.o.d -o CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -c "/<<PKGBUILDDIR>>/image/encode/strenc.c"
+/<<PKGBUILDDIR>>/image/decode/segdec.c: In function ‘_load4’:
+/<<PKGBUILDDIR>>/image/decode/segdec.c:68:12: error: implicit declaration of function ‘_byteswap_ulong’ [-Wimplicit-function-declaration]
+   68 |     return _byteswap_ulong(v);
+      |            ^~~~~~~~~~~~~~~
+---
+ Source/LibJXR/image/decode/segdec.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Source/LibJXR/image/decode/segdec.c b/Source/LibJXR/image/decode/segdec.c
+index 1299458..8050355 100644
+--- a/Source/LibJXR/image/decode/segdec.c
++++ b/Source/LibJXR/image/decode/segdec.c
+@@ -63,6 +63,7 @@ static U32 _FORCEINLINE _load4(void* pv)
+     v |= ((U32)((U16 *) pv)[1]) << 16;
+     return _byteswap_ulong(v);
+ #else // _M_IA64
++    U32 _byteswap_ulong(U32 bits); // from image/sys/strcodec.c
+     return _byteswap_ulong(*(U32*)pv);
+ #endif // _M_IA64
+ #endif // _BIG__ENDIAN_
+-- 
+2.51.0
+
package/libfreeimage/0006-FTBFS-fix-for-function-prototype-error.patch new file +29 -0
new file mode 100644
index 0000000000..bdda376467
@@ -0,0 +1,29 @@
+From 7b59b3757521d82406771cc47127aa70ffb26f3f Mon Sep 17 00:00:00 2001
+From: YOKOTA Hiroshi <[email protected]>
+Date: Thu, 25 Jul 2024 16:01:01 +0900
+Subject: [PATCH] FTBFS fix for function prototype error
+
+Bug-Debian: https://bugs.debian.org/1075105
+
+Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
+[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0015-FTBFS-fix-for-function-prototype-error.patch/]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ Source/LibJXR/jxrgluelib/JXRGlueJxr.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+index 2bf085a..182fc7f 100644
+--- a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
++++ b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+@@ -28,6 +28,7 @@
+ //*@@@---@@@@******************************************************************
+ #include <limits.h>
+ #include <JXRGlue.h>
++#include <wchar.h>
+ 
+ 
+ static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 15 lines · Thomas Petazzoni via buildroot

Take two patches from the Debian jxrlib package, and integrate them to fix the build of the bundled jxrlib library found in the libfreeimage package.

libfreeimage isn't exactly well maintained: its last version 3.18.0 is quite old (July 2018), there's a fairly large number of tickets in the bug tracker claiming to be CVE
reports (https://sourceforge.net/p/freeimage/bugs/), it is still using SVN as the version control system.

However, it is used as an optional dependency for CEGUI, and a mandatory dependency for Ogre. However, it no longer seems to be a dependency for more recent versions of Ogre. But in any case it cannot simply be dropped.

Quoted 6 lines

Fixes:

https://autobuild.buildroot.net/results/452462285bf93b13f092fb41696952f415e75b2f/

Applied to master, thanks.

For info, I fixed the DOS-newlines in the patches, which I believe were correct when you sent the patch but were removed by the mailing list.

Best regards,

Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Thomas Petazzoni via buildroot

In reply of:

Quoted 15 lines

Take two patches from the Debian jxrlib package, and integrate them to fix the build of the bundled jxrlib library found in the libfreeimage package.

libfreeimage isn't exactly well maintained: its last version 3.18.0 is quite old (July 2018), there's a fairly large number of tickets in the bug tracker claiming to be CVE
reports (https://sourceforge.net/p/freeimage/bugs/), it is still using SVN as the version control system.

However, it is used as an optional dependency for CEGUI, and a mandatory dependency for Ogre. However, it no longer seems to be a dependency for more recent versions of Ogre. But in any case it cannot simply be dropped.

Quoted 5 lines

Fixes:

https://autobuild.buildroot.net/results/452462285bf93b13f092fb41696952f415e75b2f/

Applied to 2025.02.x, 2025.05.x & 2025.08.x. Thanks

Quoted 95 lines
---
 .../0005-jxrlib-ftbfs-with-GCC-14.patch       | 40 +++++++++++++++++++
 ...BFS-fix-for-function-prototype-error.patch | 29 ++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 package/libfreeimage/0005-jxrlib-ftbfs-with-GCC-14.patch
 create mode 100644 package/libfreeimage/0006-FTBFS-fix-for-function-prototype-error.patch
package/libfreeimage/0005-jxrlib-ftbfs-with-GCC-14.patch new file +40 -0
new file mode 100644
index 0000000000..c13a8dc26f
@@ -0,0 +1,40 @@
+From 11383a017e8d040f1376c964d2b8769108204f0b Mon Sep 17 00:00:00 2001
+From: YOKOTA Hiroshi <[email protected]>
+Date: Thu, 25 Jul 2024 15:03:31 +0900
+Subject: [PATCH] jxrlib: ftbfs with GCC-14
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Bug-Debian: https://bugs.debian.org/1075105
+
+_byteswap_ulong() is defined in image/sys/strcodec.c
+
+Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
+[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0013-jxrlib-ftbfs-with-GCC-14.patch/]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+----
+/usr/bin/cc -DDISABLE_PERF_MEASUREMENT -D__ANSI__ -Djpegxr_EXPORTS -I"/<<PKGBUILDDIR>>/common/include" -I"/<<PKGBUILDDIR>>/image/sys" -I"/<<PKGBUILDDIR>>/jxrgluelib" -I"/<<PKGBUILDDIR>>/jxrtestlib" -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wall -Wextra -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -w -MD -MT CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -MF CMakeFiles/jpegxr.dir/image/encode/strenc.c.o.d -o CMakeFiles/jpegxr.dir/image/encode/strenc.c.o -c "/<<PKGBUILDDIR>>/image/encode/strenc.c"
+/<<PKGBUILDDIR>>/image/decode/segdec.c: In function ‘_load4’:
+/<<PKGBUILDDIR>>/image/decode/segdec.c:68:12: error: implicit declaration of function ‘_byteswap_ulong’ [-Wimplicit-function-declaration]
+   68 |     return _byteswap_ulong(v);
+      |            ^~~~~~~~~~~~~~~
+---
+ Source/LibJXR/image/decode/segdec.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Source/LibJXR/image/decode/segdec.c b/Source/LibJXR/image/decode/segdec.c
+index 1299458..8050355 100644
+--- a/Source/LibJXR/image/decode/segdec.c
++++ b/Source/LibJXR/image/decode/segdec.c
+@@ -63,6 +63,7 @@ static U32 _FORCEINLINE _load4(void* pv)
+     v |= ((U32)((U16 *) pv)[1]) << 16;
+     return _byteswap_ulong(v);
+ #else // _M_IA64
++    U32 _byteswap_ulong(U32 bits); // from image/sys/strcodec.c
+     return _byteswap_ulong(*(U32*)pv);
+ #endif // _M_IA64
+ #endif // _BIG__ENDIAN_
+-- 
+2.51.0
+
package/libfreeimage/0006-FTBFS-fix-for-function-prototype-error.patch new file +29 -0
new file mode 100644
index 0000000000..bdda376467
@@ -0,0 +1,29 @@
+From 7b59b3757521d82406771cc47127aa70ffb26f3f Mon Sep 17 00:00:00 2001
+From: YOKOTA Hiroshi <[email protected]>
+Date: Thu, 25 Jul 2024 16:01:01 +0900
+Subject: [PATCH] FTBFS fix for function prototype error
+
+Bug-Debian: https://bugs.debian.org/1075105
+
+Upstream: Bug submitted at https://sourceforge.net/p/freeimage/bugs/389/
+[Thomas: patch taken from https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0015-FTBFS-fix-for-function-prototype-error.patch/]
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ Source/LibJXR/jxrgluelib/JXRGlueJxr.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+index 2bf085a..182fc7f 100644
+--- a/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
++++ b/Source/LibJXR/jxrgluelib/JXRGlueJxr.c
+@@ -28,6 +28,7 @@
+ //*@@@---@@@@******************************************************************
+ #include <limits.h>
+ #include <JXRGlue.h>
++#include <wchar.h>
+ 
+ 
+ static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot