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

Audacity swap16/32/64 functions conflict with OpenBSD swap macros #6357

Closed
brad0 opened this issue Apr 28, 2024 · 5 comments · Fixed by #6384
Closed

Audacity swap16/32/64 functions conflict with OpenBSD swap macros #6357

brad0 opened this issue Apr 28, 2024 · 5 comments · Fixed by #6384
Assignees
Milestone

Comments

@brad0
Copy link
Contributor

brad0 commented Apr 28, 2024

OpenBSD has some swapping macros that originate from the endian.h / sys/endian.h header.

     uint64_t
     swap64(uint64_t val64);

     uint32_t
     swap32(uint32_t val32);

     uint16_t
     swap16(uint16_t val16);

These currently conflict with functions within Audacity. We have a bit of a hackish patch locally to undefine
the macros, but pretty much every project I've had fixed results in the internal functions being renamed. I would
file a PR but I am not sure what the preference is or naming scheme. So I am opening a bug report to spur
discussion.

[1/1105] /home/ports/pobj/audacity-3.5.1/bin/c++ -DCMTSTUFF -DEXPERIMENTAL_CRASH_REPORT -DEXPERIMENTAL_DRAGGABLE_PLAY_HEAD -DEXPERIMENTAL_FULL_WASAPI -DEXPERIMENTAL_HALF_WAVE -DEXPERIMENTAL_KEY_VIEW -DEXPERIMENTAL_MIDI_OUT -DEXPERIMENTAL_MODULE_PREFS -DEXPERIMENTAL_
NOISE_REDUCTION -DEXPERIMENTAL_NOTETRACK_OVERLAY -DEXPERIMENTAL_NYQUIST_SPLIT_CONTROL -DEXPERIMENTAL_PUNCH_AND_ROLL -DEXPERIMENTAL_SCIENCE_FILTERS -DEXPERIMENTAL_SCRUBBING_SCROLL_WHEEL -DEXPERIMENTAL_SCRUBBING_SUPPORT -DEXPERIMENTAL_SPECTRAL_EDITING -DEXPERIMENTAL_S
UBRIP_LABEL_FORMATS -DEXPERIMENTAL_THEMING -DEXPERIMENTAL_ZOOM_TOGGLE_BUTTON -DEXT -DUSE_NYQUIST=1 -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/cmt -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/n
yquist/cmupv/src -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/ffts/src -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqsrc -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-s
rc/libnyquist/nyquist/nyqstk -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/tran -I/home/ports/pobj/audacity-3.5.1/audacity-Auda
city-3.5.1/lib-src/libnyquist/nyquist/xlisp -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/sys/unix -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist -isystem /usr/local/include -O2 -pipe -DNDEBUG -std
=gnu++17 -MD -MT lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o -MF lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o.d -o lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o -c /home/ports/pobj/auda
city-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp
FAILED: lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o
/home/ports/pobj/audacity-3.5.1/bin/c++ -DCMTSTUFF -DEXPERIMENTAL_CRASH_REPORT -DEXPERIMENTAL_DRAGGABLE_PLAY_HEAD -DEXPERIMENTAL_FULL_WASAPI -DEXPERIMENTAL_HALF_WAVE -DEXPERIMENTAL_KEY_VIEW -DEXPERIMENTAL_MIDI_OUT -DEXPERIMENTAL_MODULE_PREFS -DEXPERIMENTAL_NOISE_RED
UCTION -DEXPERIMENTAL_NOTETRACK_OVERLAY -DEXPERIMENTAL_NYQUIST_SPLIT_CONTROL -DEXPERIMENTAL_PUNCH_AND_ROLL -DEXPERIMENTAL_SCIENCE_FILTERS -DEXPERIMENTAL_SCRUBBING_SCROLL_WHEEL -DEXPERIMENTAL_SCRUBBING_SUPPORT -DEXPERIMENTAL_SPECTRAL_EDITING -DEXPERIMENTAL_SUBRIP_LAB
EL_FORMATS -DEXPERIMENTAL_THEMING -DEXPERIMENTAL_ZOOM_TOGGLE_BUTTON -DEXT -DUSE_NYQUIST=1 -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/cmt -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/cm
upv/src -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/ffts/src -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqsrc -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyq
uist/nyquist/nyqstk -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/tran -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.
1/lib-src/libnyquist/nyquist/xlisp -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/sys/unix -I/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist -isystem /usr/local/include -O2 -pipe -DNDEBUG -std=gnu++17
-MD -MT lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o -MF lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o.d -o lib-src/libnyquist/CMakeFiles/libnyquist.dir/nyquist/nyqstk/instr.cpp.o -c /home/ports/pobj/audacity-3.5.
1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:165:15: error: unknown type name '__builtin_constant_p'
  static void swap16(unsigned char *ptr);
              ^
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:15: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                     ^
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:165:15: error: expected ')'
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:39: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                                             ^
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:165:15: note: to match this '('
/usr/include/sys/endian.h:70:19: note: expanded from macro 'swap16'
#define swap16(x) __swap16(x)
                  ^
/usr/include/sys/_endian.h:87:14: note: expanded from macro '__swap16'
        (__uint16_t)(__builtin_constant_p(x) ? __swap16gen(x) : __swap16md(x))
                    ^
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:168:15: error: unknown type name '__builtin_constant_p'
  static void swap32(unsigned char *ptr);
              ^
/usr/include/sys/endian.h:71:19: note: expanded from macro 'swap32'
#define swap32(x) __swap32(x)
                  ^
/usr/include/sys/_endian.h:89:15: note: expanded from macro '__swap32'
        (__uint32_t)(__builtin_constant_p(x) ? __swap32gen(x) : __swap32md(x))
                     ^
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:168:15: error: expected ')'
/usr/include/sys/endian.h:71:19: note: expanded from macro 'swap32'
#define swap32(x) __swap32(x)
                  ^
/usr/include/sys/_endian.h:89:39: note: expanded from macro '__swap32'
        (__uint32_t)(__builtin_constant_p(x) ? __swap32gen(x) : __swap32md(x))
                                             ^
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:168:15: note: to match this '('
/usr/include/sys/endian.h:71:19: note: expanded from macro 'swap32'
#define swap32(x) __swap32(x)
                  ^
/usr/include/sys/_endian.h:89:14: note: expanded from macro '__swap32'
        (__uint32_t)(__builtin_constant_p(x) ? __swap32gen(x) : __swap32md(x))
                    ^
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:171:15: error: unknown type name '__builtin_constant_p'
  static void swap64(unsigned char *ptr);
              ^
/usr/include/sys/endian.h:72:19: note: expanded from macro 'swap64'
#define swap64(x) __swap64(x)
                  ^
/usr/include/sys/_endian.h:91:15: note: expanded from macro '__swap64'
        (__uint64_t)(__builtin_constant_p(x) ? __swap64gen(x) : __swap64md(x))
                     ^
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/instr.cpp:2:
In file included from /home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Instrmnt.h:15:
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:171:15: error: expected ')'
/usr/include/sys/endian.h:72:19: note: expanded from macro 'swap64'
#define swap64(x) __swap64(x)
                  ^
/usr/include/sys/_endian.h:91:39: note: expanded from macro '__swap64'
        (__uint64_t)(__builtin_constant_p(x) ? __swap64gen(x) : __swap64md(x))
                                             ^
/home/ports/pobj/audacity-3.5.1/audacity-Audacity-3.5.1/lib-src/libnyquist/nyquist/nyqstk/include/Stk.h:171:15: note: to match this '('
/usr/include/sys/endian.h:72:19: note: expanded from macro 'swap64'
#define swap64(x) __swap64(x)
                  ^
/usr/include/sys/_endian.h:91:14: note: expanded from macro '__swap64'
        (__uint64_t)(__builtin_constant_p(x) ? __swap64gen(x) : __swap64md(x))
                    ^
6 errors generated.
ninja: build stopped: subcommand failed.

@LWinterberg
Copy link
Member

I don't believe there's a strong preference for naming scheme. Feel free to pick a name that works around this.

@chinakov
Copy link
Contributor

chinakov commented May 13, 2024

Installing Nyquist plugins crashes Audacity. The issue was reproduced on Master, so for now this is blocked.

@brad0
Copy link
Contributor Author

brad0 commented May 14, 2024

Installing Nyquist plugins crashes Audacity. The issue was reproduced on Master, so for now this is blocked.

Where are the details about this found?

@chinakov
Copy link
Contributor

@brad0 - #6433
Here is the related bug issue.

@chinakov
Copy link
Contributor

@brad0 - could you please rebase this on the latest master, so that I could test it again, as the fix for nyquist installer has been pushed to master.

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

Successfully merging a pull request may close this issue.

3 participants