prom: missing include for 'sprintf'#2
Open
linuxmaniac wants to merge 2 commits into
Open
Conversation
linuxmaniac
commented
Jan 31, 2025
- https://pkg.cs.ovgu.de/LNF/linux/ubuntu/ package store. - ignore ctag files
> /<<PKGBUILDDIR>>/prom/src/prom_histogram_buckets.c: In function ‘double_to_str’: > /<<PKGBUILDDIR>>/prom/src/prom_histogram_buckets.c:34:19: error: implicit declaration of function ‘sprintf’ [-Werror=implicit-function-declaration] > 34 | int len = sprintf(buf, "%.17g", value); > | ^~~~~~~ > /<<PKGBUILDDIR>>/prom/src/prom_histogram_buckets.c:28:1: note: include ‘<stdio.h>’ or provide a declaration of ‘sprintf’ > 27 | #include "prom_log.h" > +++ |+#include <stdio.h> > 28 | > /<<PKGBUILDDIR>>/prom/src/prom_histogram_buckets.c:34:19: error: incompatible implicit declaration of built-in function ‘sprintf’ [-Werror=builtin-declaration-mismatch] > 34 | int len = sprintf(buf, "%.17g", value); > | ^~~~~~~ > /<<PKGBUILDDIR>>/prom/src/prom_histogram_buckets.c:34:19: note: include ‘<stdio.h>’ or provide a declaration of ‘sprintf’
b9ee077 to
01b03d5
Compare
jelmd
reviewed
Feb 25, 2026
|
|
||
| #include <stdarg.h> | ||
| #include <stdlib.h> | ||
| #include <stdio.h> |
Owner
There was a problem hiding this comment.
Can you provide more info on your environment. Can't see this problem on any Ubuntu/Illumos/Solaris host,
There was a problem hiding this comment.
Somehow, in Debian this happens (besides other small differences)
+++ ./prom/build.debian/CMakeFiles/prom.dir/src/prom_histogram_buckets.c.o.d 2026-03-27 07:07:48.642938782 +0000
- /home/gerardo/apt-src/libprom-1.2.1.jelmd/prom/include/prom_log.h \
- /usr/include/stdio.h /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \
- /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
- /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \
- /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
- /usr/include/x86_64-linux-gnu/bits/types/FILE.h \
- /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \
- /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
- /usr/include/x86_64-linux-gnu/bits/stdio.h
+ /home/gerardo/apt-src/libprom-1.2.1.jelmd/prom/include/prom_log.h
This is due to the definition of PROM_LOG_ENABLE in CFLAGS, missing in debian's CFLAGS (side question: why?)
As the included prom_log.h includes stdio.h when PROM_LOG_ENABLE is defined, cmake picks up the needed include files.
However, prom_histogram_buckets.c needs the patch here on its own, due to sprintf usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.