intel / ledmon

Enclosure LED Utilities
GNU General Public License v2.0
72 stars 44 forks source link

1.0.0: build fails #214

Closed kloczek closed 1 month ago

kloczek commented 3 months ago

Description

Looks like 1.0.0 is not finished and build fails because missing #include lines.

Steps to reproduce bug

clone -> `autoreconf -fiv`` -> configure -> make

Expected behavior

Build should not fail.

Actual behavior

```console [tkloczko@pers-jacek ledmon-1.0.0]$ make -k V=1 make all-recursive make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0' Making all in src make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src' Making all in common make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/common' make[3]: Nothing to be done for 'all'. make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/common' Making all in lib make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib' Making all in include make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include' Making all in led make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include/led' make[5]: Nothing to be done for 'all'. make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include/led' make[5]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include' make[5]: Nothing to be done for 'all-am'. make[5]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include' make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib/include' make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib' /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o libledinternal_la-block.lo `test -f 'block.c' || echo './'`block.c libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c block.c -fPIC -DPIC -o .libs/libledinternal_la-block.o block.c: In function 'block_set_devnode': block.c:244:22: error: implicit declaration of function 'basename'; did you mean 'rename'? [-Wimplicit-function-declaration] 244 | char *name = basename(device->sysfs_path); | ^~~~~~~~ | rename block.c:244:22: error: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] make[4]: *** [Makefile:630: libledinternal_la-block.lo] Error 1 /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o libledinternal_la-vmdssd.lo `test -f 'vmdssd.c' || echo './'`vmdssd.c libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c vmdssd.c -fPIC -DPIC -o .libs/libledinternal_la-vmdssd.o vmdssd.c: In function 'vmdssd_get_domain': vmdssd.c:85:29: error: implicit declaration of function 'basename'; did you mean 'rename'? [-Wimplicit-function-declaration] 85 | SYSFS_VMD, basename(path)); | ^~~~~~~~ | rename vmdssd.c:84:46: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'int' [-Wformat=] 84 | snprintf(domain_path, PATH_MAX, "%s/%s/domain", | ~^ | | | char * | %d 85 | SYSFS_VMD, basename(path)); | ~~~~~~~~~~~~~~ | | | int vmdssd.c:89:23: error: passing argument 1 of 'strtok' makes pointer from integer without a cast [-Wint-conversion] 89 | return strtok(basename(real_domain_path), ":"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from vmdssd.c:26: /usr/include/string.h:356:39: note: expected 'char * restrict' but argument is of type 'int' 356 | extern char *strtok (char *__restrict __s, const char *__restrict __delim) | ~~~~~~~~~~~~~~~~~^~~ make[4]: *** [Makefile:714: libledinternal_la-vmdssd.lo] Error 1 /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o libledinternal_la-npem.lo `test -f 'npem.c' || echo './'`npem.c libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c npem.c -fPIC -DPIC -o .libs/libledinternal_la-npem.o npem.c: In function 'get_pci_dev': npem.c:98:13: error: implicit declaration of function 'basename'; did you mean 'rename'? [-Wimplicit-function-declaration] 98 | p = basename(dpath); | ^~~~~~~~ | rename npem.c:98:11: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 98 | p = basename(dpath); | ^ make[4]: *** [Makefile:749: libledinternal_la-npem.lo] Error 1 /bin/sh ../../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o libledinternal_la-slot.lo `test -f 'slot.c' || echo './'`slot.c libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c slot.c -fPIC -DPIC -o .libs/libledinternal_la-slot.o slot.c: In function 'find_slot_by_device_name': slot.c:46:29: error: implicit declaration of function 'basename'; did you mean 'rename'? [-Wimplicit-function-declaration] 46 | if (strncmp(basename(slot->bl_device->devnode), | ^~~~~~~~ | rename slot.c:46:29: error: passing argument 1 of 'strncmp' makes pointer from integer without a cast [-Wint-conversion] 46 | if (strncmp(basename(slot->bl_device->devnode), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | int In file included from slot.c:22: /usr/include/string.h:159:33: note: expected 'const char *' but argument is of type 'int' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ~~~~~~~~~~~~^~~~ slot.c:47:29: error: passing argument 2 of 'strncmp' makes pointer from integer without a cast [-Wint-conversion] 47 | basename(device_name), PATH_MAX) == 0) | ^~~~~~~~~~~~~~~~~~~~~ | | | int /usr/include/string.h:159:51: note: expected 'const char *' but argument is of type 'int' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ~~~~~~~~~~~~^~~~ slot.c: In function 'find_slot_by_slot_path': slot.c:61:29: error: passing argument 1 of 'strncmp' makes pointer from integer without a cast [-Wint-conversion] 61 | if (strncmp(basename(slot->slot_id), basename(slot_path), PATH_MAX) == 0) | ^~~~~~~~~~~~~~~~~~~~~~~ | | | int /usr/include/string.h:159:33: note: expected 'const char *' but argument is of type 'int' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ~~~~~~~~~~~~^~~~ slot.c:61:54: error: passing argument 2 of 'strncmp' makes pointer from integer without a cast [-Wint-conversion] 61 | if (strncmp(basename(slot->slot_id), basename(slot_path), PATH_MAX) == 0) | ^~~~~~~~~~~~~~~~~~~ | | | int /usr/include/string.h:159:51: note: expected 'const char *' but argument is of type 'int' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ~~~~~~~~~~~~^~~~ make[4]: *** [Makefile:763: libledinternal_la-slot.lo] Error 1 make[4]: Target 'all-am' not remade because of errors. make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib' make[3]: *** [Makefile:785: all-recursive] Error 1 make[3]: Target 'all' not remade because of errors. make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/lib' Making all in ledctl make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/ledctl' /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -I../../src/lib -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o ledctl-ledctl.o `test -f 'ledctl.c' || echo './'`ledctl.c ledctl.c: In function ‘print_slot’: ledctl.c:869:31: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration] 869 | const char *slot_id = basename(led_slot_id(s)); | ^~~~~~~~ | rename ledctl.c:869:31: error: initialization of ‘const char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion] make[3]: *** [Makefile:465: ledctl-ledctl.o] Error 1 make[3]: *** No rule to make target '../lib/libledinternal.la', needed by 'ledctl'. make[3]: Target 'all' not remade because of errors. make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/ledctl' Making all in ledmon make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/ledmon-1.0.0/src/ledmon' /usr/bin/gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib/include -I../../src -I../../config -I../../src/lib -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o ledmon-ledmon.o `test -f 'ledmon.c' || echo './'`ledmon.c ledmon.c: In function ‘_close_parent_fds’: ledmon.c:929:42: error: implicit declaration of function ‘basename’; did you mean ‘rename’? [-Wimplicit-function-declaration] 929 | if (str_toi(&fd, basename(elem), NULL, 10) != 0) | ^~~~~~~~ | rename ledmon.c:929:42: error: passing argument 2 of ‘str_toi’ makes pointer from integer without a cast [-Wint-conversion] 929 | if (str_toi(&fd, basename(elem), NULL, 10) != 0) | ^~~~~~~~~~~~~~ | | | int In file included from ledmon.c:57: ../../src/lib/utils.h:428:43: note: expected ‘const char *’ but argument is of type ‘int’ 428 | int str_toi(signed int *dest, const char *strptr, char **endptr, int base); | ~~~~~~~~~~~~^~~~~~ make[3]: *** [Makefile:469: ledmon-ledmon.o] Error 1 make[3]: *** No rule to make target '../lib/libledinternal.la', needed by 'ledmon'. ```

Environment

OS: Linux x86/64

Ledmon version

1.0.0

Ledmon logs

N/A

Ledctl logs

N/A

Ledmon supported controllers

N/.A

Additional information

N/A

mtkaczyk commented 3 months ago

@kloczek I would like to ask you to create github action which will compile ledmon exactly same way you are doing that. With that we will be forced to take care of it. Could you do that?

kloczek commented 3 months ago

If you are using rpm based distribution could you please try execute rpm -ql glibc-headers-x86 | xargs grep basename? On my system it shows

[tkloczko@pers-jacek SPECS]$ rpm -ql glibc-headers-x86 | xargs grep basename
grep: /usr/include/arpa: Is a directory
grep: /usr/include/bits: Is a directory
grep: /usr/include/bits/platform: Is a directory
grep: /usr/include/bits/types: Is a directory
grep: /usr/include/finclude: Is a directory
grep: /usr/include/gnu: Is a directory
/usr/include/libgen.h:extern char *__xpg_basename (char *__path) __THROW;
/usr/include/libgen.h:#define basename  __xpg_basename
grep: /usr/include/net: Is a directory
grep: /usr/include/netash: Is a directory
grep: /usr/include/netatalk: Is a directory
grep: /usr/include/netax25: Is a directory
grep: /usr/include/neteconet: Is a directory
grep: /usr/include/netinet: Is a directory
grep: /usr/include/netipx: Is a directory
grep: /usr/include/netiucv: Is a directory
grep: /usr/include/netpacket: Is a directory
grep: /usr/include/netrom: Is a directory
grep: /usr/include/netrose: Is a directory
grep: /usr/include/nfs: Is a directory
grep: /usr/include/protocols: Is a directory
grep: /usr/include/rpc: Is a directory
grep: /usr/include/scsi: Is a directory
/usr/include/string.h:# ifndef basename
/usr/include/string.h:   declare the function if the `basename' macro is available (defined
/usr/include/string.h:extern "C++" char *basename (char *__filename)
/usr/include/string.h:     __THROW __asm ("basename") __nonnull ((1));
/usr/include/string.h:extern "C++" const char *basename (const char *__filename)
/usr/include/string.h:     __THROW __asm ("basename") __nonnull ((1));
/usr/include/string.h:extern char *basename (const char *__filename) __THROW __nonnull ((1));
grep: /usr/include/sys: Is a directory
grep: /usr/include/sys/platform: Is a directory
mtkaczyk commented 3 months ago

FYI, I received similar suggestion in mdadm to add libgen.h, so please review my comment: https://patchwork.kernel.org/project/linux-raid/patch/20240325061537.275811-1-raj.khem@gmail.com/

I think that it applies here. I didn't compare those two basename implementations to determine if we can use POSIX version safely.

On both RHEL-9.2 and Opensuse 15.sp4 I don't have this package:

[gklab-localhost ~]# rpm -qa | grep glibc
glibc-gconv-extra-2.34-83.el9_3.7.x86_64
glibc-2.34-83.el9_3.7.x86_64
glibc-common-2.34-83.el9_3.7.x86_64
glibc-langpack-en-2.34-83.el9_3.7.x86_64
glibc-doc-2.34-83.el9_3.7.noarch
glibc-headers-2.34-83.el9_3.7.x86_64
glibc-devel-2.34-83.el9_3.7.x86_6

Which distribution you are using?

mtkaczyk commented 2 months ago

Hi @kloczek Ping?

mtkaczyk commented 1 month ago

No feedback. Closing.