From e7dca73eb4f41b2e8151e01429db97b5c138e3de Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 6 May 2025 22:58:48 -0400 Subject: [PATCH 1/3] iodbc/connect.c: include time.h for the time() function Without this the build can fail on musl: connect.c: In function '_iodbcdm_pool_set_retry_wait': connect.c:489:25: error: implicit declaration of function 'time' [-Wimplicit-function-declaration] 489 | pdbc->cp_retry_wait = time(NULL) + retry_wait; | ^~~~ Presumably glibc includes time.h incidentally via some other header. --- iodbc/connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/iodbc/connect.c b/iodbc/connect.c index 641c2377..75aeaedd 100644 --- a/iodbc/connect.c +++ b/iodbc/connect.c @@ -83,6 +83,7 @@ #include #include #include +#include #include "dlproc.h" From 19c83ac53e6188dc693d66e3c0e370109f490658 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 6 May 2025 23:02:02 -0400 Subject: [PATCH 2/3] include/iodbc.h: include strings.h for the strcasecmp() function Without this, the build can fail on musl: info.c: In function 'SQLDrivers_Internal': ../include/iodbc.h:117:34: error: implicit declaration of function 'strcasecmp'; did you mean 'wcscasecmp'? [-Wimplicit-function-declaration] 117 | #define STRCASEEQ(a, b) (strcasecmp((char*)(a), (char*)(b)) == 0) | ^~~~~~~~~~ Presumably glibc includes strings.h incidentally via some other header. --- include/iodbc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/iodbc.h b/include/iodbc.h index 5d9fc12c..a5df482e 100644 --- a/include/iodbc.h +++ b/include/iodbc.h @@ -101,6 +101,7 @@ #include #include #include +#include #include #define MEM_ALLOC(size) (malloc((size_t)(size))) From 00829385f0b83b943e8cb09bece70d26316903d9 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 6 May 2025 23:08:31 -0400 Subject: [PATCH 3/3] include/iodbc.h: define _POSIX_C_SOURCE=200809L for strdup() Without this, the build can fail on musl: SQLGetInstalledDrivers.c: In function 'SQLGetInstalledDrivers_Internal': ../include/iodbc.h:117:34: error: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration] 117 | #define STRDUP(t) (strdup((char*)(t))) | ^~~~~~ --- include/iodbc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/iodbc.h b/include/iodbc.h index a5df482e..11ad2c2e 100644 --- a/include/iodbc.h +++ b/include/iodbc.h @@ -98,6 +98,11 @@ #if !defined(WINDOWS) && !defined(WIN32_SYSTEM) #define _UNIX_ +#ifndef _POSIX_C_SOURCE +/* POSIX.1-2008 is required for strdup() */ +#define _POSIX_C_SOURCE 200809L +#endif + #include #include #include