Build problem on 32-bit NetBSD hosts

Issue #53 duplicate
Håvard Eidnes created an issue

On NetBSD, time_t is 64 bits long irrespective of which port (CPU) it runs on. On ILP32 ports (e.g. i386, powerpc, …), long long and time_t will therefore be the same size integral base type. This causes the build to fail with

../zdb/zdbpp.h:322:14: error: 'void zdb::PreparedStatement::bind(int, time_t)' cannot be overloaded with 'void zdb::PreparedStatement::bind(int, long long int)'
  322 |         void bind(int parameterIndex, time_t x) {
      |              ^~~~
../zdb/zdbpp.h:314:14: note: previous declaration 'void zdb::PreparedStatement::bind(int, long long int)'
  314 |         void bind(int parameterIndex, long long x) {
      |              ^~~~

One possibility to fix this is to make e.g. the long long variant pre-processor conditional on

#if !defined(__NetBSD__) || (defined(__NetBSD__) && (__SIZEOF_LONG_LONG__ != 8))

There’s also a format mismatch in test/unit.c for the same reason, for that you need

#include <inttypes.h>

and

+#ifdef __NetBSD__
+                printf("\tResult: %" PRIu64 "\n", Time_now());
+#else
                 printf("\tResult: %ld\n", Time_now());
+#endif

but that only produces a warning from the compiler.

Comments (2)

  1. Log in to comment