Giter Club home page Giter Club logo

Comments (12)

janbar avatar janbar commented on September 28, 2024 1

I will have a look on this issue on BSD. In others Unix like , the function swap16 is declared in header sys/endian.h. It seems some top includes load this header on OpenBSD. The resolution could be to rename my functions or to prefix them in an anonymous namespace.

from noson.

klemensn avatar klemensn commented on September 28, 2024

noson-app has the same problem.

from noson.

janbar avatar janbar commented on September 28, 2024

I pushed a new commit , and a new release 2.12.7. It should help to fix this issue.

from noson.

klemensn avatar klemensn commented on September 28, 2024

Still fails on OpenBSD/amd64 7.4-current with clang and libstd++16.0.6:

FAILED: noson/CMakeFiles/noson.dir/src/private/byteorder.cpp.o 
/usr/ports/pobj/noson-2.12.7/bin/c++ -Dnoson_EXPORTS -I/usr/ports/pobj/noson-2.12.7/build-amd64/noson/public/noson -I/usr/ports/pobj/noson-2.12.7/build-amd64/noson/public -I/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=gnu++11 -fPIC -MD -MT noson/CMakeFiles/noson.dir/src/private/byteorder.cpp.o -MF noson/CMakeFiles/noson.dir/src/private/byteorder.cpp.o.d -o noson/CMakeFiles/noson.dir/src/private/byteorder.cpp.o -c /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp
In file included from /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:19:
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
inline int16_t swap16(int16_t val)
^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:23: error: unexpected type name 'int16_t': expected expression
inline int16_t swap16(int16_t val)
                      ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:31: error: expected ')'
inline int16_t swap16(int16_t val)
                              ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:16: note: to match this '('
inline int16_t swap16(int16_t val)
               ^
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:35: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                         ^
In file included from /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:19:
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:23: error: unexpected type name 'int16_t': expected expression
inline int16_t swap16(int16_t val)
                      ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:31: error: expected ')'
inline int16_t swap16(int16_t val)
                              ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:16: note: to match this '('
inline int16_t swap16(int16_t val)
               ^
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:41: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                               ^
/usr/include/sys/_endian.h:49:31: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                              ^
In file included from /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:19:
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:23: error: unexpected type name 'int16_t': expected expression
inline int16_t swap16(int16_t val)
                      ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:31: error: expected ')'
inline int16_t swap16(int16_t val)
                              ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:16: note: to match this '('
inline int16_t swap16(int16_t val)
               ^
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:41: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                               ^
/usr/include/sys/_endian.h:49:64: note: expanded from macro '__swap16gen'
    (__uint16_t)(((__uint16_t)(x) & 0xffU) << 8 | ((__uint16_t)(x) & 0xff00U) >> 8)
                                                               ^
In file included from /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:19:
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:23: error: unexpected type name 'int16_t': expected expression
inline int16_t swap16(int16_t val)
                      ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:31: error: expected ')'
inline int16_t swap16(int16_t val)
                              ^
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:16: note: to match this '('
inline int16_t swap16(int16_t val)
               ^
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:68: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                                                          ^
In file included from /usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:19:
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.h:61:35: error: expected ';' after top level declarator
inline int16_t swap16(int16_t val)
                                  ^
                                  ;
/usr/ports/pobj/noson-2.12.7/noson-2.12.7/noson/src/private/byteorder.cpp:26:13: error: no member named '__endianess__' in namespace 'SONOS'
int NSROOT::__endianess__ = test_endianess();
    ~~~~~~~~^
1 warning and 10 errors generated.

from noson.

janbar avatar janbar commented on September 28, 2024

mmm, it builds without issue on FreeBSD. The problem is the OS header uses some macros to rename internal function (i.e swap16 etc), and the preprocessor apply those macros to rename my private functions. that's ugly.

from noson.

janbar avatar janbar commented on September 28, 2024

I reverted the repo (noson and noson-app) to the previous tags. The issue is not in the source, but in the OS headers.
The build shouldn't include "sys/endian.h".

What is the release of OpenBSD ?

from noson.

klemensn avatar klemensn commented on September 28, 2024

What is the release of OpenBSD ?

7.4 is the latest stable version: https://www.openbsd.org/

from noson.

janbar avatar janbar commented on September 28, 2024

In header "sys/endian.h" of OpenBSD, we find:

#if __BSD_VISIBLE
#define swap16(x) __swap16(x)
#define swap32(x) __swap32(x)
#define swap64(x) __swap64(x)

Please try to build the app without the definition "__BSD_VISIBLE". Those things are not compliant.
Maybe you have to specify a flag to be in "compatible mode".

from noson.

janbar avatar janbar commented on September 28, 2024

I haven't looked as to why noson needs its own routines for this and/or which one should be used, but a simple fix to unbreak the build is prepending #undef swap16 to the function definition in byteorder.h -- same problem for swap32().

I cannot prepending with undef all the bunch of functions declared in the sources. The OS headers shouldn't declare macros without prefix "__" for names not used in the standards (i.e printf etc).
So, the flag "__BSD_VISIBLE" exists to enable some special stuff of OpenBSD. Those stuff must be disabled.

Edit: Others standard declaration are needed in the section. So it shouldn't be disabled :(

Edit: Those routines aren't standard, and many OSes don't provide them. Only Linux GNU, and FreeBSD provide them, but without the same naming: Linux = bswap_16 , FreeBSD = bswap16 ... etc. For those reasons many app using byte processing (audio, video) have their own routines.

from noson.

janbar avatar janbar commented on September 28, 2024

@klemensn , could you provide a PR with the required changes if you succeed to build using "ifdef/undef" ???
i.e:

#ifdef swap16
#undef swap16
#endif
...

Here the file is "src/private/byteorder.h". In the project "noson-app", the same file is in "backend/NosonMediaScanner/byteorder.h".

Thanks

from noson.

janbar avatar janbar commented on September 28, 2024

I had a look about the same issue for other products, and there is a bunch of media app that get this issue on OpenBSD. The maintainers have choosen to rename their routines. So maybe it is the good choice, until the next collision ...

edit: I pushed the commit

from noson.

klemensn avatar klemensn commented on September 28, 2024

Thanks, both noson and noson-app now build on OpenBSD without any local patches.

from noson.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.