* [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build
@ 2022-05-24 17:28 Fabrice Fontaine
2022-05-28 20:13 ` Yann E. MORIN
2022-06-06 10:17 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2022-05-24 17:28 UTC (permalink / raw)
To: buildroot; +Cc: Rémi Rérolle, Fabrice Fontaine
Fix the following musl build failure:
In file included from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/pthread.h:31,
from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr-default.h:35,
from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr.h:148,
from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/ext/atomicity.h:35,
from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/bits/basic_string.h:39,
from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/string:55,
from Source/Utilities.h:44,
from Source/FreeImage/PluginPSD.cpp:27:
Source/FreeImage/PluginPSD.cpp: In function 'BOOL Save(FreeImageIO*, FIBITMAP*, fi_handle, int, int, void*)':
Source/FreeImage/PluginPSD.cpp:130:10: error: cannot convert 'std::nullptr_t' to 'BOOL' {aka 'int'} in return
130 | return NULL;
| ^~~~
Fixes:
- http://autobuild.buildroot.org/results/f9c4ba83a506d374d8a28673aac619d8ff80f3da
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
.../0004-fixed-C-11-warnings.patch | 94 +++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 package/libfreeimage/0004-fixed-C-11-warnings.patch
diff --git a/package/libfreeimage/0004-fixed-C-11-warnings.patch b/package/libfreeimage/0004-fixed-C-11-warnings.patch
new file mode 100644
index 0000000000..cf9c47303a
--- /dev/null
+++ b/package/libfreeimage/0004-fixed-C-11-warnings.patch
@@ -0,0 +1,94 @@
+fixed C++11 warnings
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from: https://sourceforge.net/p/freeimage/svn/1896]
+
+Index: trunk/Source/FreeImage/CacheFile.cpp
+===================================================================
+--- trunk/Source/FreeImage/CacheFile.cpp (révision 1895)
++++ trunk/Source/FreeImage/CacheFile.cpp (révision 1896)
+@@ -147,10 +147,14 @@
+ m_current_block->data = new BYTE[BLOCK_SIZE];
+
+ fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET);
+- fread(m_current_block->data, BLOCK_SIZE, 1, m_file);
+-
+- m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
+- m_page_map[nr] = m_page_cache_mem.begin();
++ if (fread(m_current_block->data, BLOCK_SIZE, 1, m_file) == 1) {
++ m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
++ m_page_map[nr] = m_page_cache_mem.begin();
++ }
++ else {
++ FreeImage_OutputMessageProc(FIF_UNKNOWN, "Failed to lock a block in CacheFile");
++ return NULL;
++ }
+ }
+
+ // if the memory cache size is too large, swap an item to disc
+Index: trunk/Source/FreeImage/MultiPage.cpp
+===================================================================
+--- trunk/Source/FreeImage/MultiPage.cpp (révision 1895)
++++ trunk/Source/FreeImage/MultiPage.cpp (révision 1896)
+@@ -271,8 +271,8 @@
+ }
+ }
+
+- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
+- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
++ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
++ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
+ header->m_filename = filename;
+ // io is default
+ header->node = node;
+@@ -339,8 +339,8 @@
+ PluginNode *node = list->FindNodeFromFIF(fif);
+
+ if (node) {
+- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
+- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
++ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
++ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
+ header->io = *io;
+ header->node = node;
+ header->fif = fif;
+Index: trunk/Source/FreeImage/PSDParser.cpp
+===================================================================
+--- trunk/Source/FreeImage/PSDParser.cpp (révision 1895)
++++ trunk/Source/FreeImage/PSDParser.cpp (révision 1896)
+@@ -97,7 +97,7 @@
+ template <int N>
+ class PSDGetValue {
+ public:
+- static inline int get(const BYTE * iprBuffer) {} // error
++ static inline int get(const BYTE * iprBuffer) { return -1; } // error
+ };
+
+ template <>
+Index: trunk/Source/FreeImage/PluginPSD.cpp
+===================================================================
+--- trunk/Source/FreeImage/PluginPSD.cpp (révision 1895)
++++ trunk/Source/FreeImage/PluginPSD.cpp (révision 1896)
+@@ -127,7 +127,7 @@
+ static BOOL DLL_CALLCONV
+ Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
+ if(!handle) {
+- return NULL;
++ return FALSE;
+ }
+ try {
+ psdParser parser;
+Index: trunk/Source/FreeImage/PluginHDR.cpp
+===================================================================
+--- trunk/Source/FreeImage/PluginHDR.cpp (révision 1895)
++++ trunk/Source/FreeImage/PluginHDR.cpp (révision 1896)
+@@ -244,7 +244,8 @@
+ }
+ else if((buf[0] == '#') && (buf[1] == 0x20)) {
+ header_info->valid |= RGBE_VALID_COMMENT;
+- strcpy(header_info->comment, buf);
++ strncpy(header_info->comment, buf, HDR_MAXLINE - 1);
++ header_info->comment[HDR_MAXLINE - 1] = '\0';
+ }
+ }
+ if(!bHeaderFound || !bFormatFound) {
--
2.35.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build
2022-05-24 17:28 [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build Fabrice Fontaine
@ 2022-05-28 20:13 ` Yann E. MORIN
2022-06-06 10:17 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2022-05-28 20:13 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: Rémi Rérolle, buildroot
Fabrice, All,
On 2022-05-24 19:28 +0200, Fabrice Fontaine spake thusly:
> Fix the following musl build failure:
>
> In file included from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/pthread.h:31,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr-default.h:35,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr.h:148,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/ext/atomicity.h:35,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/bits/basic_string.h:39,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/string:55,
> from Source/Utilities.h:44,
> from Source/FreeImage/PluginPSD.cpp:27:
> Source/FreeImage/PluginPSD.cpp: In function 'BOOL Save(FreeImageIO*, FIBITMAP*, fi_handle, int, int, void*)':
> Source/FreeImage/PluginPSD.cpp:130:10: error: cannot convert 'std::nullptr_t' to 'BOOL' {aka 'int'} in return
> 130 | return NULL;
> | ^~~~
>
> Fixes:
> - http://autobuild.buildroot.org/results/f9c4ba83a506d374d8a28673aac619d8ff80f3da
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Applied to master, thanks.
Regards,
Yann E. MORIN.
> ---
> .../0004-fixed-C-11-warnings.patch | 94 +++++++++++++++++++
> 1 file changed, 94 insertions(+)
> create mode 100644 package/libfreeimage/0004-fixed-C-11-warnings.patch
>
> diff --git a/package/libfreeimage/0004-fixed-C-11-warnings.patch b/package/libfreeimage/0004-fixed-C-11-warnings.patch
> new file mode 100644
> index 0000000000..cf9c47303a
> --- /dev/null
> +++ b/package/libfreeimage/0004-fixed-C-11-warnings.patch
> @@ -0,0 +1,94 @@
> +fixed C++11 warnings
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +[Retrieved from: https://sourceforge.net/p/freeimage/svn/1896]
> +
> +Index: trunk/Source/FreeImage/CacheFile.cpp
> +===================================================================
> +--- trunk/Source/FreeImage/CacheFile.cpp (révision 1895)
> ++++ trunk/Source/FreeImage/CacheFile.cpp (révision 1896)
> +@@ -147,10 +147,14 @@
> + m_current_block->data = new BYTE[BLOCK_SIZE];
> +
> + fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET);
> +- fread(m_current_block->data, BLOCK_SIZE, 1, m_file);
> +-
> +- m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
> +- m_page_map[nr] = m_page_cache_mem.begin();
> ++ if (fread(m_current_block->data, BLOCK_SIZE, 1, m_file) == 1) {
> ++ m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
> ++ m_page_map[nr] = m_page_cache_mem.begin();
> ++ }
> ++ else {
> ++ FreeImage_OutputMessageProc(FIF_UNKNOWN, "Failed to lock a block in CacheFile");
> ++ return NULL;
> ++ }
> + }
> +
> + // if the memory cache size is too large, swap an item to disc
> +Index: trunk/Source/FreeImage/MultiPage.cpp
> +===================================================================
> +--- trunk/Source/FreeImage/MultiPage.cpp (révision 1895)
> ++++ trunk/Source/FreeImage/MultiPage.cpp (révision 1896)
> +@@ -271,8 +271,8 @@
> + }
> + }
> +
> +- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
> +- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
> ++ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
> ++ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
> + header->m_filename = filename;
> + // io is default
> + header->node = node;
> +@@ -339,8 +339,8 @@
> + PluginNode *node = list->FindNodeFromFIF(fif);
> +
> + if (node) {
> +- std::auto_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
> +- std::auto_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
> ++ std::unique_ptr<FIMULTIBITMAP> bitmap (new FIMULTIBITMAP);
> ++ std::unique_ptr<MULTIBITMAPHEADER> header (new MULTIBITMAPHEADER);
> + header->io = *io;
> + header->node = node;
> + header->fif = fif;
> +Index: trunk/Source/FreeImage/PSDParser.cpp
> +===================================================================
> +--- trunk/Source/FreeImage/PSDParser.cpp (révision 1895)
> ++++ trunk/Source/FreeImage/PSDParser.cpp (révision 1896)
> +@@ -97,7 +97,7 @@
> + template <int N>
> + class PSDGetValue {
> + public:
> +- static inline int get(const BYTE * iprBuffer) {} // error
> ++ static inline int get(const BYTE * iprBuffer) { return -1; } // error
> + };
> +
> + template <>
> +Index: trunk/Source/FreeImage/PluginPSD.cpp
> +===================================================================
> +--- trunk/Source/FreeImage/PluginPSD.cpp (révision 1895)
> ++++ trunk/Source/FreeImage/PluginPSD.cpp (révision 1896)
> +@@ -127,7 +127,7 @@
> + static BOOL DLL_CALLCONV
> + Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
> + if(!handle) {
> +- return NULL;
> ++ return FALSE;
> + }
> + try {
> + psdParser parser;
> +Index: trunk/Source/FreeImage/PluginHDR.cpp
> +===================================================================
> +--- trunk/Source/FreeImage/PluginHDR.cpp (révision 1895)
> ++++ trunk/Source/FreeImage/PluginHDR.cpp (révision 1896)
> +@@ -244,7 +244,8 @@
> + }
> + else if((buf[0] == '#') && (buf[1] == 0x20)) {
> + header_info->valid |= RGBE_VALID_COMMENT;
> +- strcpy(header_info->comment, buf);
> ++ strncpy(header_info->comment, buf, HDR_MAXLINE - 1);
> ++ header_info->comment[HDR_MAXLINE - 1] = '\0';
> + }
> + }
> + if(!bHeaderFound || !bFormatFound) {
> --
> 2.35.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build
2022-05-24 17:28 [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build Fabrice Fontaine
2022-05-28 20:13 ` Yann E. MORIN
@ 2022-06-06 10:17 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-06-06 10:17 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: Rémi Rérolle, buildroot
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> Fix the following musl build failure:
> In file included from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/sysroot/usr/include/pthread.h:31,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr-default.h:35,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/armeb-buildroot-linux-musleabi/bits/gthr.h:148,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/ext/atomicity.h:35,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/bits/basic_string.h:39,
> from /nvmedata/autobuild/instance-12/output-1/per-package/libfreeimage/host/armeb-buildroot-linux-musleabi/include/c++/9.4.0/string:55,
> from Source/Utilities.h:44,
> from Source/FreeImage/PluginPSD.cpp:27:
> Source/FreeImage/PluginPSD.cpp: In function 'BOOL Save(FreeImageIO*, FIBITMAP*, fi_handle, int, int, void*)':
> Source/FreeImage/PluginPSD.cpp:130:10: error: cannot convert 'std::nullptr_t' to 'BOOL' {aka 'int'} in return
> 130 | return NULL;
> | ^~~~
> Fixes:
> - http://autobuild.buildroot.org/results/f9c4ba83a506d374d8a28673aac619d8ff80f3da
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Committed to 2022.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-06 10:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-24 17:28 [Buildroot] [PATCH 1/1] package/libfreeimage: fix musl build Fabrice Fontaine
2022-05-28 20:13 ` Yann E. MORIN
2022-06-06 10:17 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox