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

ubuntu18.10: linux_sigar.c:1177:22: error: called object ‘major’ is not a function or function pointer #128

Open
kebiao opened this issue Feb 27, 2019 · 10 comments

Comments

@kebiao
Copy link

kebiao commented Feb 27, 2019

linux_sigar.c: In function ‘sigar_os_proc_list_get’:
linux_sigar.c:617:5: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0) {
^~~~~
In file included from linux_sigar.c:19:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
linux_sigar.c: In function ‘get_iostat_proc_dstat’:
linux_sigar.c:1177:22: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
#define ST_MAJOR(sb) major((sb).st_rdev)
^~~~~
linux_sigar.c:1253:26: note: in expansion of macro ‘ST_MAJOR’
ST_MAJOR(sb), ST_MINOR(sb));
^~~~~~~~
linux_sigar.c:1178:22: warning: implicit declaration of function ‘minor’; did you mean ‘mknod’? [-Wimplicit-function-declaration]
#define ST_MINOR(sb) minor((sb).st_rdev)
^~~~~
linux_sigar.c:1253:40: note: in expansion of macro ‘ST_MINOR’
ST_MAJOR(sb), ST_MINOR(sb));
^~~~~~~~
linux_sigar.c:1177:22: error: called object ‘major’ is not a function or function pointer
#define ST_MAJOR(sb) major((sb).st_rdev)
^~~~~
linux_sigar.c:1266:23: note: in expansion of macro ‘ST_MAJOR’
if ((major == ST_MAJOR(sb)) &&
^~~~~~~~
linux_sigar.c:1261:23: note: declared here
unsigned long major, minor;
^~~~~
linux_sigar.c:1178:22: error: called object ‘minor’ is not a function or function pointer
#define ST_MINOR(sb) minor((sb).st_rdev)
^~~~~
linux_sigar.c:1267:24: note: in expansion of macro ‘ST_MINOR’
((minor == ST_MINOR(sb)) || (minor == 0)))
^~~~~~~~
linux_sigar.c:1261:30: note: declared here
unsigned long major, minor;
^~~~~
linux_sigar.c:1178:22: error: called object ‘minor’ is not a function or function pointer
#define ST_MINOR(sb) minor((sb).st_rdev)
^~~~~
linux_sigar.c:1318:26: note: in expansion of macro ‘ST_MINOR’
if (minor == ST_MINOR(sb)) {
^~~~~~~~
linux_sigar.c:1261:30: note: declared here
unsigned long major, minor;
^~~~~
linux_sigar.c: In function ‘get_iostat_procp’:
linux_sigar.c:1177:22: error: called object ‘major’ is not a function or function pointer
#define ST_MAJOR(sb) major((sb).st_rdev)
^~~~~
linux_sigar.c:1369:23: note: in expansion of macro ‘ST_MAJOR’
if ((major == ST_MAJOR(sb)) && (minor == ST_MINOR(sb))) {
^~~~~~~~
linux_sigar.c:1364:23: note: declared here
unsigned long major, minor;
^~~~~
linux_sigar.c:1178:22: error: called object ‘minor’ is not a function or function pointer
#define ST_MINOR(sb) minor((sb).st_rdev)
^~~~~
linux_sigar.c:1369:50: note: in expansion of macro ‘ST_MINOR’
if ((major == ST_MAJOR(sb)) && (minor == ST_MINOR(sb))) {
^~~~~~~~
linux_sigar.c:1364:30: note: declared here
unsigned long major, minor;
^~~~~
linux_sigar.c: In function ‘sigar_proc_port_get’:
linux_sigar.c:2505:5: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(dirp, &dbuf, &ent) == 0) {
^~~~~
In file included from linux_sigar.c:19:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
linux_sigar.c:2546:9: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
while (readdir_r(fd_dirp, &fd_dbuf, &fd_ent) == 0) {
^~~~~
In file included from linux_sigar.c:19:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
In file included from linux_sigar.c:30:
linux_sigar.c: At top level:
../../../include/sigar_util.h:82:20: warning: inline function ‘sigar_skip_multiple_token’ declared but never defined
SIGAR_INLINE char *sigar_skip_multiple_token(char *p, int count);
^~~~~~~~~~~~~~~~~~~~~~~~~
../../../include/sigar_util.h:80:20: warning: inline function ‘sigar_skip_token’ declared but never defined
SIGAR_INLINE char *sigar_skip_token(char *p);
^~~~~~~~~~~~~~~~
../../../include/sigar_util.h:78:20: warning: inline function ‘sigar_skip_line’ declared but never defined
SIGAR_INLINE char *sigar_skip_line(char buffer, int buflen); ^~~~~~~~~~~~~~~ linux_sigar.c: In function ‘sigar_cpu_list_get’: linux_sigar.c:453:11: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] (void)fgets(cpu_total, sizeof(cpu_total), fp); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c: In function ‘get_iostat_procp’: linux_sigar.c:1362:11: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] (void)fgets(buffer, sizeof(buffer), fp); / skip header / ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c: In function ‘sigar_net_route_list_get’: linux_sigar.c:1734:11: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] (void)fgets(buffer, sizeof(buffer), fp); / skip header / ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c: In function ‘sigar_net_interface_stat_get’: linux_sigar.c:1777:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buffer, sizeof(buffer), fp); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c:1778:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buffer, sizeof(buffer), fp); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c: In function ‘proc_net_read’: linux_sigar.c:1942:5: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] fgets(buffer, sizeof(buffer), fp); / skip header / ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ linux_sigar.c: In function ‘sigar_arp_list_get’: linux_sigar.c:2423:11: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result] (void)fgets(buffer, sizeof(buffer), fp); / skip header */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [Makefile:396: linux_sigar.lo] Error 1
make[3]: Leaving directory '/home/kbe/sigar/src/os/linux'
make[2]: *** [Makefile:368: all-recursive] Error 1
make[2]: Leaving directory '/home/kbe/sigar/src/os'
make[1]: *** [Makefile:604: all-recursive] Error 1
make[1]: Leaving directory '/home/kbe/sigar/src'
make: *** [Makefile:392: all-recursive] Error 1
root@kbe-VirtualBox:/home/kbe/sigar#

@kebiao
Copy link
Author

kebiao commented Feb 27, 2019

root@kbe-VirtualBox:/home/kbe/sigar# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 8.2.0-7ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.2.0 (Ubuntu 8.2.0-7ubuntu1)

@kebiao
Copy link
Author

kebiao commented Feb 27, 2019

root@kbe-VirtualBox:/home/kbe/sigar# ldd --version
ldd (Ubuntu GLIBC 2.28-0ubuntu1) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
root@kbe-VirtualBox:/home/kbe/sigar#
root@kbe-VirtualBox:/home/kbe/sigar#
root@kbe-VirtualBox:/home/kbe/sigar# getconf GNU_LIBC_VERSION
glibc 2.28

@kostya
Copy link

kostya commented Feb 28, 2019

i suggest if you add such lines in linux_sigar.c, it should be fixed:

#ifdef HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h>
#endif

kebiao added a commit to kbengine/kbengine that referenced this issue Feb 28, 2019
kebiao added a commit to kbengine/kbengine that referenced this issue Feb 28, 2019
@GrbavaCigla
Copy link

I've tried that and it still doesn't work.

@MiaoXXSSE
Copy link

I've tried that and it still doesn't work.

i tried this, and it works

just add "#include <sys/sysmacros.h>" to linux_sigar.c, not add " #ifdef HAVE_SYS_SYSMACROS_H; #endif"

@GrbavaCigla
Copy link

#include <rpc/rpc.h>: no such file or directory.

@kostya
Copy link

kostya commented Jul 8, 2020

@GrbavaCigla, i fixed this and other compilation errors, in my fork: https://github.com/kostya/sigar

@GrbavaCigla
Copy link

@kostya I get the same error: major is not a function or function pointer

@GrbavaCigla
Copy link

After fixing that I have:

/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../build-src/libsigar.so: undefined reference to `sigar_skip_token'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../build-src/libsigar.so: undefined reference to `get_named_proc_token'
/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../build-src/libsigar.so: undefined reference to `sigar_skip_multiple_token'
collect2: error: ld returned 1 exit status
make[2]: *** [build-tests/CMakeFiles/t_sigar_cpu.dir/build.make:105: build-tests/t_sigar_cpu] Error 1
make[1]: *** [CMakeFiles/Makefile2:989: build-tests/CMakeFiles/t_sigar_cpu.dir/all] Error 2
make: *** [Makefile:183: all] Error 2

@kostya
Copy link

kostya commented Jul 8, 2020

major fixed in this commit: kostya@a2c6758, var: LINUX_SYSMACROS added by ruby installer, when you install gem kostya-sigar. For other languages, need some other fixes.
sigar_skip_token also fixed in ruby installer: kostya@dfe8fe

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

No branches or pull requests

4 participants