Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetBSD: bswap header use incorrect #1594

Closed
0-wiz-0 opened this issue Nov 15, 2023 · 0 comments · Fixed by #1612
Closed

NetBSD: bswap header use incorrect #1594

0-wiz-0 opened this issue Nov 15, 2023 · 0 comments · Fixed by #1612

Comments

@0-wiz-0
Copy link

0-wiz-0 commented Nov 15, 2023

On NetBSD, compilation with BUILD_TESTING=ON fail with:

[ 75%] Building CXX object src/test/OpenEXRTest/CMakeFiles/OpenEXRTest.dir/testFutureProofing.cpp.o
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'void be16enc(void*, uint16_t)':
/usr/include/sys/endian.h:203:1: error: 'bswap16' was not declared in this scope
  203 | __GEN_ENDIAN_ENC(16, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:203:1: note: the macro 'bswap16' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:71: note: it was later defined here
   71 | #define bswap16(x) \
      |
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'void be32enc(void*, uint32_t)':
/usr/include/sys/endian.h:204:1: error: 'bswap32' was not declared in this scope
  204 | __GEN_ENDIAN_ENC(32, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:204:1: note: the macro 'bswap32' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:67: note: it was later defined here
   67 | #define bswap32(x) \
      |
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'void be64enc(void*, uint64_t)':
/usr/include/sys/endian.h:205:1: error: 'bswap64' was not declared in this scope
  205 | __GEN_ENDIAN_ENC(64, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:205:1: note: the macro 'bswap64' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:63: note: it was later defined here
   63 | #define bswap64(x) \
      |
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'uint16_t be16dec(const void*)':
/usr/include/sys/endian.h:220:1: error: 'bswap16' was not declared in this scope
  220 | __GEN_ENDIAN_DEC(16, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:220:1: note: the macro 'bswap16' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:71: note: it was later defined here
   71 | #define bswap16(x) \
      |
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'uint32_t be32dec(const void*)':
/usr/include/sys/endian.h:221:1: error: 'bswap32' was not declared in this scope
  221 | __GEN_ENDIAN_DEC(32, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:221:1: note: the macro 'bswap32' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:67: note: it was later defined here
   67 | #define bswap32(x) \
      |
In file included from /usr/include/amd64/endian.h:3,
                 from /usr/include/sys/types.h:98,
                 from /usr/include/amd64/byte_swap.h:42,
                 from /usr/include/amd64/bswap.h:10,
                 from /usr/include/sys/bswap.h:11,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/endian.h: In function 'uint64_t be64dec(const void*)':
/usr/include/sys/endian.h:222:1: error: 'bswap64' was not declared in this scope
  222 | __GEN_ENDIAN_DEC(64, be)
      | ^~~~~~~~~~~~~~~~
/usr/include/sys/endian.h:222:1: note: the macro 'bswap64' had not yet been defined
In file included from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/bswap_32.h:22,
                 from /scratch/graphics/openexr/work/openexr-3.2.1/src/test/OpenEXRTest/testFutureProofing.cpp:10:
/usr/include/sys/bswap.h:63: note: it was later defined here
   63 | #define bswap64(x) \
      |
*

The problem is that the NetBSD section in src/test/OpenEXRTest/bswap_32.h is just wrong. Fixing it by following the man page, to:

#elif defined(__NetBSD__)
#    include <sys/types.h>
#    include <machine/bswap.h>
#    define bswap_32(x) bswap32 (x)

fixes the build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant