All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1] package/assimp: fix musl zlib/zip related compile failure
@ 2020-04-10 16:32 Peter Seiderer
  2020-04-10 20:46 ` Thomas Petazzoni
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Seiderer @ 2020-04-10 16:32 UTC (permalink / raw)
  To: buildroot

As assimp fails to use system provided zlib/zip (and is picky
about the provided versions) use assimp contributed one
and backport one part of upstream patch to fix musl compile.

Fixes:

  http://autobuild.buildroot.net/results/4b373ae7d8fd40efe3e2592f94f2d769d6a77669

  In file included from .../assimp-5.0.1/code/3MF/D3MFExporter.cpp:61:
  .../assimp-5.0.1/contrib/zip/src/zip.h:30:15: error: conflicting declaration 'typedef long int ssize_t'
   typedef long  ssize_t;  /* byte count or error */
                 ^~~~~~~

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
 ...ssize_t-typedef-mismatch-for-musl-co.patch | 50 +++++++++++++++++++
 package/assimp/Config.in                      |  1 -
 package/assimp/assimp.mk                      |  3 +-
 3 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch

diff --git a/package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch b/package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch
new file mode 100644
index 0000000000..a9a30c4834
--- /dev/null
+++ b/package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch
@@ -0,0 +1,50 @@
+From 3fef857a570d1ef2c96401358fe8e239625b48c9 Mon Sep 17 00:00:00 2001
+From: Peter Seiderer <ps.report@gmx.net>
+Date: Fri, 10 Apr 2020 18:11:50 +0200
+Subject: [PATCH] contrib/zip: fix ssize_t typedef mismatch for musl compile
+
+Musl uses defines __DEFINED_ssize_t to indicate ssize_t
+availability. So backport this part of upstream commit [1]
+to fixl musl compile.
+
+https://github.com/assimp/assimp/commit/f78446b14aff46db2ef27d062a275b6a01fd68b1
+
+Signed-off-by: Peter Seiderer <ps.report@gmx.net>
+---
+ contrib/zip/src/zip.h | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/zip/src/zip.h b/contrib/zip/src/zip.h
+index 5f39df50..4672eb3e 100644
+--- a/contrib/zip/src/zip.h
++++ b/contrib/zip/src/zip.h
+@@ -20,8 +20,9 @@ extern "C" {
+ #endif
+ 
+ #if !defined(_SSIZE_T_DEFINED) && !defined(_SSIZE_T_DEFINED_) &&               \
+-    !defined(_SSIZE_T) && !defined(_SSIZE_T_) && !defined(__ssize_t_defined)
+-#define _SSIZE_T
++    !defined(__DEFINED_ssize_t) && !defined(__ssize_t_defined) &&              \
++    !defined(_SSIZE_T) && !defined(_SSIZE_T_)
++
+ // 64-bit Windows is the only mainstream platform
+ // where sizeof(long) != sizeof(void*)
+ #ifdef _WIN64
+@@ -29,6 +30,14 @@ typedef long long  ssize_t;  /* byte count or error */
+ #else
+ typedef long  ssize_t;  /* byte count or error */
+ #endif
++
++#define _SSIZE_T_DEFINED
++#define _SSIZE_T_DEFINED_
++#define __DEFINED_ssize_t
++#define __ssize_t_defined
++#define _SSIZE_T
++#define _SSIZE_T_
++
+ #endif
+ 
+ #ifndef MAX_PATH
+-- 
+2.26.0
+
diff --git a/package/assimp/Config.in b/package/assimp/Config.in
index 42bfee945d..9bdc054909 100644
--- a/package/assimp/Config.in
+++ b/package/assimp/Config.in
@@ -2,7 +2,6 @@ config BR2_PACKAGE_ASSIMP
 	bool "assimp"
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR
-	select BR2_PACKAGE_ZLIB
 	help
 	  Open Asset Import Library (assimp) is a portable Open Source
 	  library to import various well-known 3D model formats in a
diff --git a/package/assimp/assimp.mk b/package/assimp/assimp.mk
index 5e8e825375..4aeb2963a9 100644
--- a/package/assimp/assimp.mk
+++ b/package/assimp/assimp.mk
@@ -8,7 +8,6 @@ ASSIMP_VERSION = 5.0.1
 ASSIMP_SITE = $(call github,assimp,assimp,v$(ASSIMP_VERSION))
 ASSIMP_LICENSE = BSD-3-Clause
 ASSIMP_LICENSE_FILES = LICENSE
-ASSIMP_DEPENDENCIES = zlib
 ASSIMP_INSTALL_STAGING = YES
 
 # relocation truncated to fit: R_68K_GOT16O
@@ -28,7 +27,7 @@ ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
 ASSIMP_CXXFLAGS += -O0
 endif
 
-ASSIMP_CONF_OPTS += -DASSIMP_BUILD_TESTS=OFF \
+ASSIMP_CONF_OPTS += -DASSIMP_BUILD_ZLIB=ON -DASSIMP_BUILD_TESTS=OFF \
 	-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) $(ASSIMP_CXXFLAGS)"
 
 $(eval $(cmake-package))
-- 
2.26.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v1] package/assimp: fix musl zlib/zip related compile failure
  2020-04-10 16:32 [Buildroot] [PATCH v1] package/assimp: fix musl zlib/zip related compile failure Peter Seiderer
@ 2020-04-10 20:46 ` Thomas Petazzoni
  2020-04-11 13:01   ` Peter Seiderer
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2020-04-10 20:46 UTC (permalink / raw)
  To: buildroot

On Fri, 10 Apr 2020 18:32:37 +0200
Peter Seiderer <ps.report@gmx.net> wrote:

> As assimp fails to use system provided zlib/zip (and is picky
> about the provided versions) use assimp contributed one
> and backport one part of upstream patch to fix musl compile.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/4b373ae7d8fd40efe3e2592f94f2d769d6a77669
> 
>   In file included from .../assimp-5.0.1/code/3MF/D3MFExporter.cpp:61:
>   .../assimp-5.0.1/contrib/zip/src/zip.h:30:15: error: conflicting declaration 'typedef long int ssize_t'
>    typedef long  ssize_t;  /* byte count or error */
>                  ^~~~~~~
> 
> Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> ---
>  ...ssize_t-typedef-mismatch-for-musl-co.patch | 50 +++++++++++++++++++
>  package/assimp/Config.in                      |  1 -
>  package/assimp/assimp.mk                      |  3 +-
>  3 files changed, 51 insertions(+), 3 deletions(-)
>  create mode 100644 package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch

I've applied, but it's not really great to be forced to use the
internal zlib. Could you try to work this out with upstream?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v1] package/assimp: fix musl zlib/zip related compile failure
  2020-04-10 20:46 ` Thomas Petazzoni
@ 2020-04-11 13:01   ` Peter Seiderer
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Seiderer @ 2020-04-11 13:01 UTC (permalink / raw)
  To: buildroot

Hello Thomas,

On Fri, 10 Apr 2020 22:46:11 +0200, Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> On Fri, 10 Apr 2020 18:32:37 +0200
> Peter Seiderer <ps.report@gmx.net> wrote:
>
> > As assimp fails to use system provided zlib/zip (and is picky
> > about the provided versions) use assimp contributed one
> > and backport one part of upstream patch to fix musl compile.
> >
> > Fixes:
> >
> >   http://autobuild.buildroot.net/results/4b373ae7d8fd40efe3e2592f94f2d769d6a77669
> >
> >   In file included from .../assimp-5.0.1/code/3MF/D3MFExporter.cpp:61:
> >   .../assimp-5.0.1/contrib/zip/src/zip.h:30:15: error: conflicting declaration 'typedef long int ssize_t'
> >    typedef long  ssize_t;  /* byte count or error */
> >                  ^~~~~~~
> >
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
> > ---
> >  ...ssize_t-typedef-mismatch-for-musl-co.patch | 50 +++++++++++++++++++
> >  package/assimp/Config.in                      |  1 -
> >  package/assimp/assimp.mk                      |  3 +-
> >  3 files changed, 51 insertions(+), 3 deletions(-)
> >  create mode 100644 package/assimp/0002-contrib-zip-fix-ssize_t-typedef-mismatch-for-musl-co.patch
>
> I've applied, but it's not really great to be forced to use the
> internal zlib. Could you try to work this out with upstream?

Tried already to get something working...but stumbled over some pitfalls

- assimp references ZLIB_FILEFUNC_MODE_READWRITEFILTER, not present (or not found be me)
  in the various buildroot provided packages...
- maybe assimp uses kuba/zip as internal version ([1], [2]) (not yet a buildroot package?)
- at some location assimp uses ASSIMP_USE_HUNTER (and the internal zlib include path)
  instead of ASSIMP_BUILD_ZLIB, but even with this fixed assimp is not compatible with
  the buldroot provided packages

I would wait for the next assimp major release to give it another try...

Regards,
Peter

[1] https://github.com/kuba--/zip/
[2] https://github.com/kuba--/zip/issues/110

>
> Thanks!
>
> Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-11 13:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 16:32 [Buildroot] [PATCH v1] package/assimp: fix musl zlib/zip related compile failure Peter Seiderer
2020-04-10 20:46 ` Thomas Petazzoni
2020-04-11 13:01   ` Peter Seiderer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.