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

IO-Interface-1.06: -Wimplicit-function-declaration error on openindiana with gcc 14 #107

Open
Bill-Sommerfeld opened this issue Jan 24, 2025 · 1 comment

Comments

@Bill-Sommerfeld
Copy link

On a system running a recent version of the OpenIndiana distribution of illumos (with perl 5.40 built with gcc-14), CPAN/buildme.sh fails with:

/usr/gcc/14/bin/gcc -m64 -c    -D_REENTRANT -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -m64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O3    -DVERSION=\"1.06\"  -DXS_VERS\
ION=\"1.06\" -fPIC "-I/usr/perl5/5.40/lib/i86pc-solaris-thread-multi-64/CORE"  -DUSE_GETIFADDRS -DHAVE_SOCKADDR_DL_STRUCT Interface.c
Interface.xs: In function 'XS_IO__Interface_if_addr':
Interface.xs:422:8: error: implicit declaration of function 'bzero' [-Wimplicit-function-declaration]
  422 |        bzero((void*)&ifr,sizeof(struct ifreq));
      |        ^~~~~
Interface.xs:422:8: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
Interface.xs: In function 'XS_IO__Interface_if_broadcast':
Interface.xs:461:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  461 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_netmask':
Interface.xs:499:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  499 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_dstaddr':
Interface.xs:537:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  537 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_flags':
Interface.xs:653:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  653 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_mtu':
Interface.xs:685:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  685 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_metric':
Interface.xs:717:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  717 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
*** Error code 1
make: Fatal error: Command failed for target `Interface.o'

I did not see this failure on an earlier OpenIndiana with perl 5.38 built with gcc-13; this behavior appears to be new with gcc 14 and could potentially affect other platforms.

I patched around it by adding #include <strings.h> to Interface.xs.

Looking upstream in CPAN, there is now an IO::Interface 1.09 which adds an include of <string.h> but that doesn't have bzero on illumos (I believe XPG expects it it in <strings.h>); it also doesn't build as-is on OpenIndiana either with the same error.

It would seem most appropriate to replace bzero(x,y) with the more-portable memset(x,0,y).

Will happily provide a pull request but I'm new to LMS -- not sure what this project's preferences are in terms of tracking newer versions in CPAN, etc.,

@Bill-Sommerfeld
Copy link
Author

I filed https://rt.cpan.org/Ticket/Display.html?id=158683 with CPAN, and lstein/LibIO-Interface-Perl#6 with a fix to IO::Interface 1.09 that works for me.

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

1 participant