Bug 249996

Summary: net-mgmt/php74-snmp requires ipv6
Product: Ports & Packages Reporter: ari
Component: Individual Port(s)Assignee: Torsten Zuehlsdorff <tz>
Status: In Progress ---    
Severity: Affects Many People CC: bretislav.kubesa, kan
Priority: --- Flags: bugzilla: maintainer-feedback? (tz)
Version: Latest   
Hardware: Any   
OS: Any   

Description ari 2020-09-29 22:32:58 UTC
When net-mgmt/net-snmp is compiled without ipv6, net-mgmt/php74-snmp then fails with

   fatal error: 'net-snmp/library/snmpUDPIPv6Domain.h' file not found
Comment 1 Torsten Zuehlsdorff freebsd_committer 2020-10-13 18:15:17 UTC
Hi ari,

do you have some buildlogs for this?

Most important: have you disabled IPv6 in lang/php74 before compiling the snmp module?

There is no dedicated way to disable IPv6 in snmp. I am guessing that this issue can vanish when disabling IPv6 completely when compiling lang/php74.

Greetings,
Torsten
Comment 2 B.K. 2020-10-25 12:06:56 UTC
I disabled IPV6 and rebuild lang/php72 - yet the php72-snmp fails with the same error :

checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd12.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC...
checking if c++ static flag  works... yes
checking if c++ supports -c -o file.o... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd12.1 ld.so
(cached) (cached) checking how to hardcode library paths into programs... unsupported
configure: creating ./config.status
config.status: creating config.h
===>  Building for php72-snmp-7.2.34
--- snmp.lo ---
/bin/sh /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/libtool --mode=compile cc  -I. -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -DPHP_ATOM_INC -I/usr/ports/net-mgmt/php72-snmp/work/php-7/ext/snmp/include -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/main -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/inclhp/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -O2 -pipe -march=athlon64 -fstack-protector-strong -fno-strict-alia  -c /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c -o snmp.lo
mkdir .libs
 cc -I. -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -DPHP_ATOM_INC -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/include -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/main -/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/in/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O2 -pipe -march=athlon64 -fstack-protector-strong -fno-strict-aliasing -c /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c  -fPIC -DPIC -o .lnmp.o
In file included from /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c:33:
In file included from ./php_snmp.h:45:
In file included from /usr/local/include/net-snmp/net-snmp-includes.h:24:
In file included from /usr/local/include/net-snmp/definitions.h:22:
In file included from /usr/local/include/net-snmp/types.h:425:
In file included from /usr/local/include/net-snmp/library/snmp_api.h:33:
In file included from /usr/local/include/net-snmp/varbind_api.h:102:
In file included from /usr/local/include/net-snmp/library/snmp_client.h:33:
/usr/local/include/net-snmp/session_api.h:317:10: fatal error: 'net-snmp/library/snmpUDPIPv6Domain.h' file not found
#include <net-snmp/library/snmpUDPIPv6Domain.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** [snmp.lo] Error code 1

make[1]: stopped in /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp
1 error

make[1]: stopped in /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/net-mgmt/php72-snmp
[root@proxypro:/usr/ports/net-mgmt/php72-snmp] #
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... freebsd12.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking for c++ option to produce PIC...
checking if c++ static flag  works... yes
checking if c++ supports -c -o file.o... yes
checking whether the c++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd12.1 ld.so
(cached) (cached) checking how to hardcode library paths into programs... unsupported
configure: creating ./config.status
config.status: creating config.h
===>  Building for php72-snmp-7.2.34
--- snmp.lo ---
/bin/sh /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/libtool --mode=compile cc  -I. -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -DPHP_ATOM_INC -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/include -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/main -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -O2 -pipe -march=athlon64 -fstack-protector-strong -fno-strict-aliasing   -c /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c -o snmp.lo
mkdir .libs
 cc -I. -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -DPHP_ATOM_INC -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/include -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/main -I/usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -O2 -pipe -march=athlon64 -fstack-protector-strong -fno-strict-aliasing -c /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c  -fPIC -DPIC -o .libs/snmp.o
In file included from /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp/snmp.c:33:
In file included from ./php_snmp.h:45:
In file included from /usr/local/include/net-snmp/net-snmp-includes.h:24:
In file included from /usr/local/include/net-snmp/definitions.h:22:
In file included from /usr/local/include/net-snmp/types.h:425:
In file included from /usr/local/include/net-snmp/library/snmp_api.h:33:
In file included from /usr/local/include/net-snmp/varbind_api.h:102:
In file included from /usr/local/include/net-snmp/library/snmp_client.h:33:
/usr/local/include/net-snmp/session_api.h:317:10: fatal error: 'net-snmp/library/snmpUDPIPv6Domain.h' file not found
#include <net-snmp/library/snmpUDPIPv6Domain.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
*** [snmp.lo] Error code 1

make[1]: stopped in /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp
1 error

make[1]: stopped in /usr/ports/net-mgmt/php72-snmp/work/php-7.2.34/ext/snmp
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/net-mgmt/php72-snmp
Comment 3 Torsten Zuehlsdorff freebsd_committer 2020-11-11 23:42:09 UTC
I am sorry, i wasn't able to fix this until now. And i also think its something you need to address by the PHP developer themselves. I'm not sure if excluding IPv6 is a wanted support this days and i am not able to handle this kind of patches myself.
Comment 4 Alexander Kabaev freebsd_committer 2020-12-23 19:48:42 UTC
Torsten,

your response does not seem to be accurate and no, this should not be taken up with php, nut, hplip and every other net-snmp using software that is now broken in FreeBSD. The failure is entirely hand made: when IPV6 is 'disabled' (default), pkg-list intentionally omits snmpUDPIPv6Domain.h and friends, but it is pretty obvious that net-snmp itself thinks that ipv6 is available and should be used.
Sure enough, the port makefile passes --enable-ipv6 is IPV6 is requested, but does not bother to do anything in the opposite case, letting configure _successfully_ probe the ipv6, thus creating the problem: library thinks ipv6 _is_ available, but port fails to install necessary files. Please consider doing something along these lines:

https://reviews.freebsd.org/D27744
Comment 5 Torsten Zuehlsdorff freebsd_committer 2020-12-23 22:23:44 UTC
Alexander,

thank you for working on this! This is great progress!

I added zi to the review because your changes only cover net-mgmt/net-snmp. zi is the maintainer of this port and really has more experience with it. So let's pass the review to him. :)

Do you see anything i should adjust at the PHP ports to fix this issue?

Greetings,
Torsten