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

Compile error #16

Open
RGBCube opened this issue Feb 24, 2024 · 5 comments
Open

Compile error #16

RGBCube opened this issue Feb 24, 2024 · 5 comments

Comments

@RGBCube
Copy link

RGBCube commented Feb 24, 2024

rat> building '/nix/store/0is25j3abjgfc1wkf1h2p08gb4j1pl71-rat-2.0.1.drv'
rat> Running phase: unpackPhase
rat> unpacking source archive /nix/store/hb6i0r4adglv8vycgwdzk5nr7xq6m77p-source
rat> source root is source
rat> Running phase: patchPhase
rat> Running phase: updateAutotoolsGnuConfigScriptsPhase
rat> Running phase: configurePhase
rat> no configure script, doing nothing
rat> Running phase: buildPhase
rat> xxd -i audio/loop.wav > audio/linux_loop.h
rat> mkdir bin
rat> gcc -DAUDIO_EN rat.c audio/linux_audio.c -o bin/rat -lm -lpthread
rat> rat.c: In function 'main':
rat> rat.c:143:9: error: format not a string literal and no format arguments [-Werror=format-security]
rat>   143 |         printf(frames[i]);
rat>       |         ^~~~~~
rat> cc1: some warnings being treated as errors
rat> audio/linux_audio.c: In function 'linux_audioplay':
rat> audio/linux_audio.c:31:9: warning: 'return' with no value, in function returning non-void
rat>    31 |         return;
rat>       |         ^~~~~~
rat> audio/linux_audio.c:19:7: note: declared here
rat>    19 | void *linux_audioplay()
rat>       |       ^~~~~~~~~~~~~~~
rat> In file included from audio/linux_audio.c:2:
rat> audio/miniaudio.h: In function 'ma_device_stop__alsa':
rat> audio/miniaudio.h:28071:9: warning: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Wunused-result]
rat> 28071 |         read(((struct pollfd*)pDevice->alsa.pPollDescriptorsCapture)[0].fd, &t, sizeof(t));
rat>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rat> audio/miniaudio.h:28092:9: warning: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Wunused-result]

On the latest commit, my cc is:

clang version 16.0.6
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/s0rk29zc6n3x6xmpb39rypac36k2gpbj-clang-16.0.6/bin
@thinkingsand
Copy link
Owner

Hi. The code seems to compile fine for me on Debian 12, on a fresh install with build-essential and xxd.
I noticed you're using Nix, that's not something I maintain the package for.
I'd recommend getting in touch with whoever does, this seems to be an issue with the packaging.

thinkingsand added a commit that referenced this issue Feb 24, 2024
@thinkingsand
Copy link
Owner

Turns out it was just the Nix package being configured to treat string warnings as hard errors, this should be fixed now.

@RGBCube
Copy link
Author

RGBCube commented Feb 24, 2024

Works! Although I can't hear the audio for some reason. (Yes I am doing make linux_audio)

@thinkingsand
Copy link
Owner

I've tested the audio code in the past across Debian, Fedora and Arch, and across both PulseAudio and Pipewire. Without more info I can't really troubleshoot things beyond that.
Let me know if you can reproduce on a mainstream distro and I'll take a look.

@RGBCube
Copy link
Author

RGBCube commented Feb 25, 2024

Alright, I'll try it soon on another machine. Will let you know if it doesn't work

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

No branches or pull requests

2 participants