mackron / miniaudio

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

miniaudio compile error under mips toolchain #666

Closed shawnchain closed 1 year ago

shawnchain commented 1 year ago

miniaudio compile error under MIPS toolchain "mipsel-openwrt-linux-musl-g++" with following parameters an error message

-DMA_NO_JACK -DMA_NO_RESOURCE_MANAGER -DMA_NO_NODE_GRAPH -DMA_NO_ENGINE -DMA_NO_DECODING -DMA_NO_ENCODING -DMA_NO_GENERATION

error:

miniaudio/miniaudio.o: In function `ma_job_queue_cas':
miniaudio.c:(.text+0x4e4): undefined reference to `__sync_val_compare_and_swap_8'
miniaudio/miniaudio.o: In function `ma_job_queue_post':
miniaudio.c:(.text+0x208c): undefined reference to `__atomic_load_8'
miniaudio.c:(.text+0x20ac): undefined reference to `__atomic_load_8'
miniaudio.c:(.text+0x20ba): undefined reference to `__atomic_load_8'
miniaudio/miniaudio.o: In function `ma_job_queue_next':
miniaudio.c:(.text+0x217c): undefined reference to `__atomic_load_8'
miniaudio.c:(.text+0x218e): undefined reference to `__atomic_load_8'
miniaudio/miniaudio.o:miniaudio.c:(.text+0x21ac): more undefined references to `__atomic_load_8' follow
collect2: error: ld returned 1 exit status

Affected version: possibly all ?

mackron commented 1 year ago

Can you try compiling with -latomic?

shawnchain commented 1 year ago

It fixes the atomic reference error and now only 1 left:

miniaudio/miniaudio.o: In function `ma_job_queue_cas':
miniaudio.c:(.text+0x4e4): undefined reference to `__sync_val_compare_and_swap_8'
collect2: error: ld returned 1 exit status
mackron commented 1 year ago

Can you try the dev branch? By a very strange coincidence, someone on my Discord server reported the exact same issue just a few hours after your report and I did a potential fix this morning in response (only difference is theirs was relating to PowerPC).

shawnchain commented 1 year ago

I applied commit 1ac2abc and compile success. I Will test the binary later. Thank you for kind help.

mackron commented 1 year ago

Thanks for checking that and for the report. The person who reported it on Discord has reported that it's working at runtime for them. I'll go ahead and close this one, but if you encounter any runtime issues feel free to reopen this. I've just released version 0.11.15 which includes this fix.