Bug 242134 - graphics/openimageio: fix build on powerpc64 elfv2
Summary: graphics/openimageio: fix build on powerpc64 elfv2
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Piotr Kubaj
URL:
Keywords: buildisok
Depends on:
Blocks:
 
Reported: 2019-11-21 10:03 UTC by Piotr Kubaj
Modified: 2019-12-10 09:05 UTC (History)
1 user (show)

See Also:
FreeBSD: maintainer-feedback+


Attachments
patch (1.57 KB, patch)
2019-11-21 10:03 UTC, Piotr Kubaj
FreeBSD: maintainer-approval?
Details | Diff
patch to support non-clang build of graphics/openimageio (504 bytes, text/plain)
2019-11-26 03:04 UTC, Shane
FreeBSD: maintainer-approval+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2019-11-21 10:03:08 UTC
Created attachment 209314 [details]
patch

libc++ doesn't define _LIBCPP_BIG_ENDIAN, check for __BIG_ENDIAN__ instead.
Comment 1 Automation User 2019-11-22 01:38:51 UTC
Build info is available at https://gitlab.com/swills/freebsd-ports/pipelines/97725797
Comment 2 Shane 2019-11-22 01:40:58 UTC
Actually looking into this more, clang defines __BIG_ENDIAN__ but not gcc. I have emailed oiio-dev to look into this further.

Both clang and gcc defines __BYTE_ORDER__ so we could use.

# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__


Which is similar to sys/endian.h which has

#define	_LITTLE_ENDIAN	1234	/* LSB first: i386, vax */
#define	_BIG_ENDIAN	4321	/* MSB first: 68000, ibm, net */
#define	_BYTE_ORDER	_LITTLE_ENDIAN

So you could use

#if _BYTE_ORDER == _BIG_ENDIAN
Comment 3 Shane 2019-11-26 03:04:19 UTC
Created attachment 209439 [details]
patch to support non-clang build of graphics/openimageio

Larry suggests wrapping the whole _LIBCPP_ALTERNATE_STRING_LAYOUT if block in a test for _LIBCPP_VERSION.

See https://github.com/OpenImageIO/oiio/pull/2415

A quick test where _LIBCPP_VERSION is never defined builds for me.
Comment 4 Piotr Kubaj freebsd_committer 2019-11-26 11:26:45 UTC
(In reply to Shane from comment #3)
Now I get those errors:
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:805:8: error: redefinition of enumerator 'libcpp_string__long_mask'
enum { libcpp_string__long_mask = 0x1ul };
       ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:332:8: note: previous definition is here
enum { libcpp_string__long_mask = 0x1ul };
       ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:805:1: warning: declaration does not declare anything [-Wmissing-declarations]
enum { libcpp_string__long_mask = 0x1ul };
^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:810:5: error: redefinition of enumerator 'libcpp_string__min_cap'
    libcpp_string__min_cap
    ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:337:5: note: previous definition is here
    libcpp_string__min_cap
    ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:809:1: warning: declaration does not declare anything [-Wmissing-declarations]
enum {
^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:820:20: error: redefinition of 'TableRep'
ustring::TableRep::TableRep(string_view strref, size_t hash)
                   ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:348:20: note: previous definition is here
ustring::TableRep::TableRep(string_view strref, size_t hash)
                   ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:888:20: error: redefinition of '~TableRep'
ustring::TableRep::~TableRep()
                   ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:416:20: note: previous definition is here
ustring::TableRep::~TableRep()
                   ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:899:10: error: redefinition of 'make_unique'
ustring::make_unique(string_view strref)
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:427:10: note: previous definition is here
ustring::make_unique(string_view strref)
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:916:10: error: redefinition of 'getstats'
ustring::getstats(bool verbose)
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:444:10: note: previous definition is here
ustring::getstats(bool verbose)
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:940:10: error: redefinition of 'memory'
ustring::memory()
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:468:10: note: previous definition is here
ustring::memory()
         ^
/tmp/usr/ports/graphics/openimageio/work/oiio-Release-2.0.10/src/libutil/ustring.cpp:184:29: error: no matching constructor for initialization of 'ustring::TableRep'
        return new (repmem) ustring::TableRep(str, hash);
                            ^                 ~~~~~~~~~
Comment 5 Shane 2019-11-27 10:22:39 UTC
(In reply to Piotr Kubaj from comment #4)

Something went wrong, ustring.cpp is 472 lines and the error says line 805. The ifdef in the patch should hide the erring enum lines if the llvm libcpp is not used. It looks like the #endif is being added too early.

The pull request is made against master, while the patch I added here is against 2.0.11 - they have different line numbers.