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 due to undefined PRId64 #266

Closed
jhgit opened this issue Jan 16, 2023 · 0 comments · Fixed by #267
Closed

compile error due to undefined PRId64 #266

jhgit opened this issue Jan 16, 2023 · 0 comments · Fixed by #267

Comments

@jhgit
Copy link
Contributor

jhgit commented Jan 16, 2023

Compile error due to undefined PRId64, noticed on FreeBSD (noticed when building the libucl python bindings in the textproc/py-ucl port)...

cc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -fPIC -DCURL_FOUND=1 -Iinclude -Isrc -Iuthash -Iklib -c src/ucl_schema.c -o build/temp.freebsd-12.4-STABLE-20221129-amd64-cpython-39/src/ucl_schema.o
src/ucl_schema.c:387:46: error: expected ')'
                                                "string is too big: %u, maximum is: %" PRId64,
                                                                                       ^
src/ucl_schema.c:398:48: error: expected ')'
                                                "string is too short: %u, minimum is: %" PRId64,
                                                                                         ^

In this case, there is a uthash.h in /usr/local/include (from uthash 2.3.0). The older uthash.h (from 1.9.9) bundled with libucl includes inttypes.h - that was removed in newer uthash because it does not need inttypes.h (Avoid inclusion of inttypes.h).

If ucl_schema.c uses PRId64, it should explicitly include the header that provides PRId64 (regardless of the header files that uthash.h may or may not include). Here's a patch to remedy that...

diff --git a/src/ucl_schema.c b/src/ucl_schema.c
index 68f0118..f4ec0ed 100644
--- a/src/ucl_schema.c
+++ b/src/ucl_schema.c
@@ -39,6 +39,7 @@
 #ifdef HAVE_MATH_H
 #include <math.h>
 #endif
+#include <inttypes.h>

 static bool ucl_schema_validate (const ucl_object_t *schema,
            const ucl_object_t *obj, bool try_array,

libucl could import the latest version of uthash.h, but looking at changes from the current bundled version (1.9.9) to 2.3.0, I don't see any critical updates (no security fixes nor any significant changes that would lead to performance improvement).

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

Successfully merging a pull request may close this issue.

1 participant