mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
3.94k stars 346 forks source link

Compile error with gcc: `error: invalid conversion from 'UInt32*' {aka 'long unsigned int*'} to 'ma_uint32*' {aka 'unsigned int*'} [-fpermissive]` #841

Closed barracuda156 closed 4 months ago

barracuda156 commented 5 months ago

It looks like there is a slight misspecification of uint types:

In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/src/audio/ma_impl.cpp:6:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio/miniaudio.h: In function 'ma_result ma_device_init_internal__coreaudio(ma_context*, ma_device_type, const ma_device_id*, ma_device_init_internal_data__coreaudio*, void*)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio/miniaudio.h:34300:93: error: invalid conversion from 'UInt32*' {aka 'long unsigned int*'} to 'ma_uint32*' {aka 'unsigned int*'} [-fpermissive]
34300 |     result = ma_set_AudioObject_buffer_size_in_frames(pContext, deviceObjectID, deviceType, &actualPeriodSizeInFrames);
      |                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                             |
      |                                                                                             UInt32* {aka long unsigned int*}
mackron commented 4 months ago

I finally got around to digging out my MacBook. Unfortunately I was unable to replicate this, but I've applied a potential fix to the dev branch. Are you able to give that a try?

barracuda156 commented 4 months ago

@mackron Sure, let me try now. Thank you very much!

barracuda156 commented 4 months ago

Still fails from 4a5b74bef029b3592c54b6048650ee5f972c1a48 commit (plus the patch from https://github.com/mackron/miniaudio/pull/840 PR):

[  7%] Building CXX object CMakeFiles/abaddon.dir/src/components/cellrendererpixbufanimation.cpp.o
/opt/local/bin/g++-mp-13 -DABADDON_IS_BIG_ENDIAN -DENABLE_NOTIFICATION_SOUNDS -DFMT_SHARED -DSPDLOG_COMPILED_LIB -DSPDLOG_FMT_EXTERNAL -DSPDLOG_SHARED_LIB -DWITH_LIBHANDY -DWITH_MINIAUDIO -DWITH_RNNOISE -DWITH_VOICE -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/src -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/build -I/opt/local/include/gtkmm-3.0 -I/opt/local/lib/gtkmm-3.0/include -I/opt/local/include/gdkmm-3.0 -I/opt/local/lib/gdkmm-3.0/include -I/opt/local/include/gtk-3.0 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/glibmm-2.4 -I/opt/local/lib/glibmm-2.4/include -I/opt/local/include/giomm-2.4 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/lib/giomm-2.4/include -I/opt/local/include/pangomm-1.4 -I/opt/local/lib/pangomm-1.4/include -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include/cairo -I/opt/local/include/freetype2 -I/opt/local/include/cairomm-1.0 -I/opt/local/lib/cairomm-1.0/include -I/opt/local/include/atkmm-1.6 -I/opt/local/lib/atkmm-1.6/include -I/opt/local/include/atk-1.0 -I/opt/local/include/sigc++-2.0 -I/opt/local/lib/sigc++-2.0/include -I/opt/local/include/libhandy-1 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio -isystem /opt/local/include -isystem /opt/local/include/libfmt10 -isystem /opt/local/include/opus -pipe -I/opt/local/libexec/openssl3/include -Os -DNDEBUG -I/opt/local/libexec/openssl3/include -isystem/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++17 -arch ppc -mmacosx-version-min=10.6 -MD -MT CMakeFiles/abaddon.dir/src/components/cellrendererpixbufanimation.cpp.o -MF CMakeFiles/abaddon.dir/src/components/cellrendererpixbufanimation.cpp.o.d -o CMakeFiles/abaddon.dir/src/components/cellrendererpixbufanimation.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/src/components/cellrendererpixbufanimation.cpp
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/src/audio/ma_impl.cpp:6:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio/miniaudio.h: In function 'ma_result ma_device_init_internal__coreaudio(ma_context*, ma_device_type, const ma_device_id*, ma_device_init_internal_data__coreaudio*, void*)':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio/miniaudio.h:34366:93: error: invalid conversion from 'UInt32*' {aka 'long unsigned int*'} to 'ma_uint32*' {aka 'unsigned int*'} [-fpermissive]
34366 |     result = ma_set_AudioObject_buffer_size_in_frames(pContext, deviceObjectID, deviceType, &actualPeriodSizeInFrames);
      |                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                                             |
      |                                                                                             UInt32* {aka long unsigned int*}
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_abaddon/abaddon/work/abaddon-0.2.1/subprojects/miniaudio/miniaudio.h:32652:149: note:   initializing argument 4 of 'ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context*, AudioObjectID, ma_device_type, ma_uint32*)'
32652 | static ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context* pContext, AudioObjectID deviceObjectID, ma_device_type deviceType, ma_uint32* pPeriodSizeInOut)
      |                                                                                                                                          ~~~~~~~~~~~^~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/abaddon.dir/src/audio/ma_impl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
mackron commented 4 months ago

Are you sure that's definitely the dev branch? The line numbers from your error log do not match up with mine: image And that actualPeriodSizeInFrames variable is definitely not UInt32: image So I think our versions might not be in sync?

mackron commented 4 months ago

I just saw the commit you mentioned which points to the latest released version on the master branch. The fix is in the dev branch.

barracuda156 commented 4 months ago

I just saw the commit you mentioned which points to the latest released version on the master branch. The fix is in the dev branch.

Sorry, missed that part. Will re-run the build now.

barracuda156 commented 4 months ago

@mackron Awesome, from 88436b25ef4ca8434d6268f19b748d917ee7f39d no errors now! I dropped -fpermissive and a patch.

mackron commented 4 months ago

Thanks for confirming that fix. Will be released in the next version.