EnterpriseDB / system_stats

A Postgres extension for exposing system metrics such as CPU, memory and disk information
Other
111 stars 24 forks source link

fix the compilation errors in extension with latest PG source #9

Closed neel5481 closed 1 year ago

neel5481 commented 1 year ago

Fix the compilation error while building the extension with latest PG source build. It is getting failed on mac osx with below error

darwin/disk_info.c:140:35: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "total_space_bytes does not have type int64"
                values[Anum_disk_total_space] = Int64GetDatumFast(total_space_bytes);
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
darwin/disk_info.c:141:34: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "used_space_bytes does not have type int64"
                values[Anum_disk_used_space] = Int64GetDatumFast(used_space_bytes);
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
darwin/disk_info.c:142:34: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "available_space_bytes does not have type int64"
                values[Anum_disk_free_space] = Int64GetDatumFast(available_space_bytes);
                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
darwin/disk_info.c:143:36: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "total_inodes does not have type int64"
                values[Anum_disk_total_inodes] = Int64GetDatumFast(total_inodes);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
darwin/disk_info.c:144:35: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "used_inodes does not have type int64"
                values[Anum_disk_used_inodes] = Int64GetDatumFast(used_inodes);
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
darwin/disk_info.c:145:35: error: static_assert failed due to requirement '__builtin_types_compatible_p(unsigned long, long)' "free_inodes does not have type int64"
                values[Anum_disk_free_inodes] = Int64GetDatumFast(free_inodes);
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/postgres.h:550:3: note: expanded from macro 'Int64GetDatumFast'
        (AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:962:3: note: expanded from macro 'AssertVariableIsOfTypeMacro'
        (StaticAssertExpr(__builtin_types_compatible_p(__typeof__(varname), typename), \
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:918:13: note: expanded from macro 'StaticAssertExpr'
        ((void) ({ StaticAssertStmt(condition, errmessage); true; }))
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server/c.h:916:7: note: expanded from macro 'StaticAssertStmt'
        do { _Static_assert(condition, errmessage); } while(0)
             ^              ~~~~~~~~~
6 errors generated.
make: *** [darwin/disk_info.o] Error 1

With this PR, it has been compiled fine.

"Platform is: darwin"
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/disk_info.o darwin/disk_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/io_analysis.o darwin/io_analysis.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/cpu_info.o darwin/cpu_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/cpu_usage_info.o darwin/cpu_usage_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/os_info.o darwin/os_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/memory_info.o darwin/memory_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/load_avg.o darwin/load_avg.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/process_info.o darwin/process_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/network_info.o darwin/network_info.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -I. -I./ -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/server -I/Users/neelpatel/Projects/snapshot-pg/install-pg/include/postgresql/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -I/usr/local/opt/openssl@1.1/include  -c -o darwin/cpu_memory_by_process.o darwin/cpu_memory_by_process.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -Wno-compound-token-split-by-macro -O2  -fvisibility=hidden -bundle -multiply_defined suppress -o system_stats.dylib system_stats.o darwin/system_stats_utils.o darwin/disk_info.o darwin/io_analysis.o darwin/cpu_info.o darwin/cpu_usage_info.o darwin/os_info.o darwin/memory_info.o darwin/load_avg.o darwin/process_info.o darwin/network_info.o darwin/cpu_memory_by_process.o -framework IOKit -framework CoreFoundation -L/Users/neelpatel/Projects/snapshot-pg/install-pg/lib -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk   -L/usr/local/opt/openssl@1.1/lib -Wl,-dead_strip_dylibs   -fvisibility=hidden -bundle_loader /Users/neelpatel/Projects/snapshot-pg/install-pg/bin/postgres