Closed rheaton closed 2 years ago
Error was:
gcc -std=c99 -D_GNU_SOURCE -g -I /usr/local/pgdump/include -I /usr/local/pgdump/include/postgresql/server -I /usr/local/pgdump/include/postgresql/internal -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -O2 -Wformat -Wall -Werror=implicit-int -Werror=implicit-function-declaration -Werror=return-type -Wno-declaration-after-statement -Wno-missing-braces -I/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/pg -I/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/log/src/ -I/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/subcommands.c/ -I/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/libs/ -I/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/parson/ -c -MMD -MP -MF/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl//.deps/pgsetup.Po -o pgsetup.o pgsetup.c
pgsetup.c:1361:22: error: implicit declaration of function 'getpwuid' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
struct passwd *pw = getpwuid(uid);
^
pgsetup.c:1361:17: warning: incompatible integer to pointer conversion initializing 'struct passwd *' with an expression of type 'int' [-Wint-conversion]
struct passwd *pw = getpwuid(uid);
^ ~~~~~~~~~~~~~
pgsetup.c:1364:47: error: incomplete definition of type 'struct passwd'
log_trace("username found in passwd: %s", pw->pw_name);
~~^
/Users/rheaton/workspace/pg_auto_failover/src/bin/pg_autoctl/../lib/log/src/log.h:20:63: note: expanded from macro 'log_trace'
#define log_trace(...) log_log(LOG_TRACE, __FILE__, __LINE__, __VA_ARGS__)
^~~~~~~~~~~
pgsetup.c:1361:9: note: forward declaration of 'struct passwd'
struct passwd *pw = getpwuid(uid);
^
pgsetup.c:1366:32: error: incomplete definition of type 'struct passwd'
strlcpy(pgSetup->username, pw->pw_name, sizeof(pgSetup->username));
~~^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_string.h:112:34: note: expanded from macro 'strlcpy'
__builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
^~~~~~~~~~~
pgsetup.c:1361:9: note: forward declaration of 'struct passwd'
struct passwd *pw = getpwuid(uid);
^
1 warning and 3 errors generated.
This is necessary for
make
to run without errors on OSX.Co-authored-by: Jacob Champion pchampion@vmware.com