On 2024/03/29 08:20, Stuart Henderson wrote:
> On 2024/03/28 21:51, Brad Smith wrote:
> > On Thu, Mar 28, 2024 at 04:12:55PM +0000, Stuart Henderson wrote:
> > > On 2024/03/25 23:07, Brad Smith wrote:
> > > > Here is an update to OpenImageIO 2.5.9.
> > > 
> > > 2.4.17.0 is broken on i386 - 2.5.9 doesn't fix it
> > 
> > I noticed a package missing on amd64 for the last two bulk builds but
> > haven't seen anything from naddy@ yet. It builds for me on my amd64
> > build host.
> 
> That will have been due to the problem with the cmake update and
> tiff - it built on amd64 in the current bulk.
> 
> > This appears to have something to do with the last commit to 
> > strutil_test.cpp.
> > Try the following..
> 
> Will do.

FAILED: src/libutil/CMakeFiles/strutil_test.dir/strutil_test.cpp.o
/pobj/openimageio-2.4.17.0/bin/c++ -DOIIO_INTERNAL=1 -DUSE_BOOST_FILESYSTEM 
-DUSE_EXTERNAL_PUGIXML=1 -DUSE_FREETYPE=1 -DUSE_JPEG_TURBO=1 -DUSE_OCIO=1 
-DUSE_OPENCOLORIO=1 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS 
-I/pobj/openimageio-2.4.17.0/build-i386/include/OpenImageIO 
-I/pobj/openimageio-2.4.17.0/build-i386/include 
-I/pobj/openimageio-2.4.17.0/build-i386/src/include 
-I/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include -isystem 
/usr/local/include -isystem /usr/local/include/Imath -O2 -pipe -DNDEBUG 
-std=c++14 -Wall -Wno-unused-function -Wno-overloaded-virtual 
-Wno-unneeded-internal-declaration -Wno-unused-private-field 
-Wno-tautological-compare -Qunused-arguments -Wunknown-warning-option 
-Wno-unused-local-typedefs -Wno-expansion-to-defined -fno-math-errno -MD -MT 
src/libutil/CMakeFiles/strutil_test.dir/strutil_test.cpp.o -MF 
src/libutil/CMakeFiles/strutil_test.dir/strutil_test.cpp.o.d -o 
src/libutil/CMakeFiles/strutil_test.dir/strutil_test.cpp.o -c 
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/libutil/strutil_test.cpp
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/libutil/strutil_test.cpp:354:22:
 error: constexpr variable 'hash' must be initialized by a constant expression
    constexpr size_t hash = Strutil::strhash("much longer string");
                     ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/detail/farmhash.h:1207:24:
 note: cannot refer to element -4 of array of 19 elements in a constant 
expression
  uint32_t a = Fetch(s - 4 + (len >> 1));
                       ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/detail/farmhash.h:1246:9:
 note: in call to 'Hash32Len13to24(&"much longer string"[0], 18, 0)'
        Hash32Len13to24(s, len);
        ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/detail/farmhash.h:2070:7:
 note: in call to 'Hash32(&"much longer string"[0], 18)'
      farmhashmk::Hash32(s, len));
      ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/detail/farmhash.h:2100:49:
 note: in call to 'Hash32(&"much longer string"[0], 18)'
  return sizeof(size_t) == 8 ? Hash64(s, len) : Hash32(s, len);
                                                ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/strutil.h:377:12:
 note: in call to 'Hash(&"much longer string"[0], 18)'
    return OIIO::farmhash::inlined::Hash(s, len);
           ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/include/OpenImageIO/strutil.h:389:25:
 note: in call to 'strhash(18, &"much longer string"[0])'
    return s.length() ? strhash(s.length(), s.data()) : 0;
                        ^
/pobj/openimageio-2.4.17.0/OpenImageIO-2.4.17.0/src/libutil/strutil_test.cpp:354:29:
 note: in call to 'strhash({&"much longer string"[0], 18})'
    constexpr size_t hash = Strutil::strhash("much longer string");
                            ^
1 error generated.
ninja: build stopped: subcommand failed.

*** Error 1 in . (/usr/ports/devel/cmake/cmake.port.mk:46 'do-build': @cd 
/pobj/openimageio-2.4.17.0/build-i386 && exec /usr/bin/env -i LIBO...)
*** Error 2 in . (/usr/ports/infrastructure/mk/bsd.port.mk:3057 
'/pobj/openimageio-2.4.17.0/build-i386/.build_done': @cd /usr/ports/graphics...)
*** Error 2 in /usr/ports/graphics/openimageio 
(/usr/ports/infrastructure/mk/bsd.port.mk:2704 'all': 
@lock=openimageio-2.4.17.0p0;  export _...)

> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/graphics/openimageio/Makefile,v
> > retrieving revision 1.69
> > diff -u -p -u -p -r1.69 Makefile
> > --- Makefile        22 Mar 2024 12:25:32 -0000      1.69
> > +++ Makefile        29 Mar 2024 01:33:57 -0000
> > @@ -7,6 +7,7 @@ GH_ACCOUNT =                AcademySoftwareFoundation
> >  GH_PROJECT =               OpenImageIO
> >  GH_TAGNAME =               v2.4.17.0
> >  PKGNAME =          ${DISTNAME:L}
> > +REVISION =         0
> >  
> >  SHARED_LIBS +=             OpenImageIO             14.0 # 2.4.10
> >  SHARED_LIBS +=             OpenImageIO_Util        9.0 # 2.4.10
> > Index: patches/patch-src_include_OpenImageIO_detail_farmhash_h
> > ===================================================================
> > RCS file: patches/patch-src_include_OpenImageIO_detail_farmhash_h
> > diff -N patches/patch-src_include_OpenImageIO_detail_farmhash_h
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-src_include_OpenImageIO_detail_farmhash_h 29 Mar 2024 
> > 01:33:57 -0000
> > @@ -0,0 +1,92 @@
> > +Revert fix(strutil.h): ensure proper constexpr of string hashing (#3901)
> > +8e8dab1215f584ff940ea6240768abecd5c63f07
> > +
> > +Index: src/include/OpenImageIO/detail/farmhash.h
> > +--- src/include/OpenImageIO/detail/farmhash.h.orig
> > ++++ src/include/OpenImageIO/detail/farmhash.h
> > +@@ -244,77 +244,21 @@ STATIC_INLINE uint32_t Fetch32(const char *p) {
> > + 
> > + #else
> > + 
> > +-#if defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L
> > +-// C++20 compiler with constexpr support std::bitcast
> > +-STATIC_INLINE uint64_t Fetch64(const char *p) {
> > +-  struct BlockOfBytes {
> > +-    char bytes[8];
> > +-  };
> > +-  BlockOfBytes bob{p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]};
> > +-  return std::bit_cast<uint64_t>(bob);
> > ++template <typename T>
> > ++STATIC_INLINE T FetchType(const char *p) {
> > ++  T result = 0;
> > ++  for (size_t i = 0; i < sizeof(T); i++)
> > ++      reinterpret_cast<char *>(&result)[i] = p[i];
> > ++  return result;
> > + }
> > +-STATIC_INLINE uint32_t Fetch32(const char *p) {
> > +-  struct BlockOfBytes {
> > +-    char bytes[4];
> > +-  };
> > +-  BlockOfBytes bob{p[0],p[1],p[2],p[3]};
> > +-  return std::bit_cast<uint32_t>(bob);
> > +-}
> > + 
> > +-#else
> > +-
> > +-// constexpr supported for C++14,17 versions that manually load bytes and
> > +-// bitshift into proper order for the unsigned integer.
> > +-// NOTE: bigendian untested
> > + STATIC_INLINE uint64_t Fetch64(const char *p) {
> > +-    // Favor letting uint8_t construction to handle
> > +-    // signed to unsigned conversion vs. uint64_t(p[0]&0xff)
> > +-    uint8_t b0 = p[0];
> > +-    uint8_t b1 = p[1];
> > +-    uint8_t b2 = p[2];
> > +-    uint8_t b3 = p[3];
> > +-    uint8_t b4 = p[4];
> > +-    uint8_t b5 = p[5];
> > +-    uint8_t b6 = p[6];
> > +-    uint8_t b7 = p[7];
> > +-    return littleendian() ?
> > +-        (uint64_t(b0))       | // LSB
> > +-        (uint64_t(b1) <<  8) |
> > +-        (uint64_t(b2) << 16) |
> > +-        (uint64_t(b3) << 24) |
> > +-        (uint64_t(b4) << 32) |
> > +-        (uint64_t(b5) << 40) |
> > +-        (uint64_t(b6) << 48) |
> > +-        (uint64_t(b7) << 56)   // MSB
> > +-      : // Big Endian byte order
> > +-        (uint64_t(b0) << 56) |  // MSB
> > +-        (uint64_t(b1) << 48) |
> > +-        (uint64_t(b2) << 40) |
> > +-        (uint64_t(b3) << 32) |
> > +-        (uint64_t(b4) << 24) |
> > +-        (uint64_t(b5) << 16) |
> > +-        (uint64_t(b6) <<  8) |
> > +-        (uint64_t(b7)) ;       // LSB
> > ++  return FetchType<uint64_t>(p); 
> > + }
> > + 
> > + STATIC_INLINE uint32_t Fetch32(const char *p) {
> > +-    uint8_t b0 = p[0];
> > +-    uint8_t b1 = p[1];
> > +-    uint8_t b2 = p[2];
> > +-    uint8_t b3 = p[3];
> > +-    return littleendian() ?
> > +-        (uint32_t(b0))       | // LSB
> > +-        (uint32_t(b1) <<  8) |
> > +-        (uint32_t(b2) << 16) |
> > +-        (uint32_t(b3) << 24)   // MSB
> > +-      : // Big Endian byte order
> > +-        (uint32_t(b0) << 24) | // MSB
> > +-        (uint32_t(b1) << 16) |
> > +-        (uint32_t(b2) <<  8) |
> > +-        (uint32_t(b3));        // LSB
> > ++  return FetchType<uint32_t>(p);
> > + }
> > +-#endif
> > +-
> > + 
> > + // devices don't seem to have bswap_64() or bswap_32()
> > + template<typename T>
> > Index: patches/patch-src_include_OpenImageIO_string_view_h
> > ===================================================================
> > RCS file: patches/patch-src_include_OpenImageIO_string_view_h
> > diff -N patches/patch-src_include_OpenImageIO_string_view_h
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-src_include_OpenImageIO_string_view_h     29 Mar 2024 
> > 01:33:57 -0000
> > @@ -0,0 +1,39 @@
> > +Revert fix(strutil.h): ensure proper constexpr of string hashing (#3901)
> > +8e8dab1215f584ff940ea6240768abecd5c63f07
> > +
> > +Index: src/include/OpenImageIO/string_view.h
> > +--- src/include/OpenImageIO/string_view.h.orig
> > ++++ src/include/OpenImageIO/string_view.h
> > +@@ -106,8 +106,9 @@ class basic_string_view { (public)
> > +         : m_chars(chars), m_len(len) { }
> > + 
> > +     /// Construct from char*, use strlen to determine length.
> > +-    constexpr basic_string_view(const CharT* chars) noexcept
> > +-        : m_chars(chars), m_len(chars ? cestrlen(chars) : 0) { }
> > ++    OIIO_CONSTEXPR17 basic_string_view(const CharT* chars) noexcept
> > ++        : m_chars(chars), m_len(chars ? Traits::length(chars) : 0) { }
> > ++    // N.B. char_traits::length() is constexpr starting with C++17.
> > + 
> > +     /// Construct from std::string. Remember that a string_view doesn't 
> > have
> > +     /// its own copy of the characters, so don't use the `string_view` 
> > after
> > +@@ -428,20 +429,6 @@ class basic_string_view { (public)
> > +             if (!traits::find(s.data(), s.length(), *first))
> > +                 return first;
> > +         return last;
> > +-    }
> > +-
> > +-    // Guaranteed constexpr length of a C string
> > +-    static constexpr size_t cestrlen(const charT* chars) {
> > +-#if OIIO_CPLUSPLUS_VERSION >= 17
> > +-        return Traits::length(chars);
> > +-#else
> > +-        if (chars == nullptr)
> > +-            return 0;
> > +-        size_t len = 0;
> > +-        while (chars[len] != 0)
> > +-            len++;
> > +-        return len;
> > +-#endif
> > +     }
> > + 
> > +     class traits_eq {
> > Index: patches/patch-src_libutil_strutil_test_cpp
> > ===================================================================
> > RCS file: patches/patch-src_libutil_strutil_test_cpp
> > diff -N patches/patch-src_libutil_strutil_test_cpp
> > --- /dev/null       1 Jan 1970 00:00:00 -0000
> > +++ patches/patch-src_libutil_strutil_test_cpp      29 Mar 2024 01:33:57 
> > -0000
> > @@ -0,0 +1,16 @@
> > +Revert fix(strutil.h): ensure proper constexpr of string hashing (#3901)
> > +8e8dab1215f584ff940ea6240768abecd5c63f07
> > +
> > +Index: src/libutil/strutil_test.cpp
> > +--- src/libutil/strutil_test.cpp.orig
> > ++++ src/libutil/strutil_test.cpp
> > +@@ -350,9 +350,6 @@ test_hash()
> > +     OIIO_CHECK_EQUAL(strhash(std::string("foo")), 6150913649986995171);
> > +     OIIO_CHECK_EQUAL(strhash(string_view("foo")), 6150913649986995171);
> > +     OIIO_CHECK_EQUAL(strhash(""), 0);  // empty string hashes to 0
> > +-    // Check longer hash and ensure that it's really constexpr
> > +-    constexpr size_t hash = Strutil::strhash("much longer string");
> > +-    OIIO_CHECK_EQUAL(hash, 16257490369375554819ULL);
> > + }
> > + 
> > + 
> 

Reply via email to