php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18728 Fails to compile using net-snmp 5.0.3
Submitted: 2002-08-03 18:01 UTC Modified: 2002-10-14 20:10 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: stover_david at hotmail dot com Assigned:
Status: Closed Package: SNMP related
PHP Version: 4.2.2 OS: FreeBSD 4.6-RELEASE
Private report: No CVE-ID: None
 [2002-08-03 18:01 UTC] stover_david at hotmail dot com
On a nearly blank, vanilla-flavored Intel installation of FreeBSD 4.6-RELEASE with apache-1.3.24_7 and mysql-3.23.49 (both built from the ports tree), a pathing issue exists with the *.h files in net-snmp-5.0.3 when building php-4.2.2 configured --with-snmp=/usr/local:

Locally (not package installs, or builds from the ports tree), builds and installs of  zlib-1.1.4 (./configure --prefix=/usr/local --libdir=/usr/local/lib --includedir=/usr/local/include), openssl-0.9.6e (with no options to configure), and then net-snmp-5.0.3 (./configure --with-openssl=/usr/local --with-mib-modules="host misc/ipfwacc disman/event-mib" --enable-embedded-perl).  After installation of net-snmp, built gd-1.8.4, then started build of php-4.2.2 (./configure --with-apxs --with-openssl=/usr/local/ssl --with-mysql=/usr/local --with-gd=/usr/local --with-snmp=/usr/local --enable-ucd-snmp-hack).  

Build failed when attempting to compile ext/snmp.c

Below are the unified diffs of a freshly untar'd copy of php-4.2.2, and the modified version that built for me.

diff -ru php-4.2.2/configure php-4.2.2p1/configure
--- php-4.2.2/configure Sun Jul 21 05:56:19 2002
+++ php-4.2.2p1/configure       Sat Aug  3 14:01:15 2002
@@ -57912,16 +57912,16 @@
     if test "$PHP_SNMP" = "yes"; then
       for i in /usr/include /usr/local/include; do
         test -f $i/snmp.h                       && SNMP_INCDIR=$i
-        test -f $i/ucd-snmp/snmp.h              && SNMP_INCDIR=$i/ucd-snmp
+        test -f $i/net-snmp/snmp.h              && SNMP_INCDIR=$i/net-snmp
         test -f $i/snmp/snmp.h                  && SNMP_INCDIR=$i/snmp
-        test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
+        test -f $i/snmp/include/net-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/net-snmp
       done
       for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
         test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
       done
     else
       SNMP_INCDIR=$PHP_SNMP/include
-      test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
+      test -d $PHP_SNMP/include/net-snmp && SNMP_INCDIR=$PHP_SNMP/include/net-snmp
       SNMP_LIBDIR=$PHP_SNMP/lib
     fi
 
@@ -57980,7 +57980,7 @@
 #line 57981 "configure"
 #include "confdefs.h"
 
-        #include <ucd-snmp-config.h>
+        #include <net-snmp-config.h>
         #if USE_OPENSSL
         yes
         #endif

diff -ru php-4.2.2/ext/snmp/config.m4 php-4.2.2p1/ext/snmp/config.m4
--- php-4.2.2/ext/snmp/config.m4        Wed Jan 16 14:32:40 2002
+++ php-4.2.2p1/ext/snmp/config.m4      Sat Aug  3 14:02:30 2002
@@ -10,16 +10,16 @@
     if test "$PHP_SNMP" = "yes"; then
       for i in /usr/include /usr/local/include; do
         test -f $i/snmp.h                       && SNMP_INCDIR=$i
-        test -f $i/ucd-snmp/snmp.h              && SNMP_INCDIR=$i/ucd-snmp
+        test -f $i/net-snmp/snmp.h              && SNMP_INCDIR=$i/net-snmp
         test -f $i/snmp/snmp.h                  && SNMP_INCDIR=$i/snmp
-        test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
+        test -f $i/snmp/include/net-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/net-snmp
       done
       for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
         test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
       done
     else
       SNMP_INCDIR=$PHP_SNMP/include
-      test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
+      test -d $PHP_SNMP/include/net-snmp && SNMP_INCDIR=$PHP_SNMP/include/net-snmp
       SNMP_LIBDIR=$PHP_SNMP/lib
     fi
 
@@ -35,7 +35,7 @@
     if test "$ac_cv_header_default_store_h" = "yes"; then
       AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
       AC_EGREP_CPP(yes,[
-        #include <ucd-snmp-config.h>
+        #include <net-snmp-config.h>
         #if USE_OPENSSL
         yes
         #endif

diff -ru php-4.2.2/ext/snmp/snmp.c php-4.2.2p1/ext/snmp/snmp.c
--- php-4.2.2/ext/snmp/snmp.c   Thu Feb 28 19:31:01 2002
+++ php-4.2.2p1/ext/snmp/snmp.c Sat Aug  3 14:26:18 2002
@@ -59,13 +59,14 @@
 #ifdef HAVE_DEFAULT_STORE_H
 #include "default_store.h"
 #endif
-#include "asn1.h"
-#include "snmp_api.h"
-#include "snmp_client.h"
-#include "snmp_impl.h"
-#include "snmp.h"
-#include "parse.h"
-#include "mib.h"
+#include "net-snmp-config.h"
+#include "library/asn1.h"
+#include "library/snmp_api.h"
+#include "library/snmp_client.h"
+#include "library/snmp_impl.h"
+#include "library/snmp.h"
+#include "library/parse.h"
+#include "library/mib.h"
 #include "version.h"
 
 /* ucd-snmp 3.3.1 changed the name of a few #defines... They've been changed back to the original ones in 3.5.3! */
@@ -130,7 +131,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_row(2, "UCD-SNMP Support", "enabled");
-       php_info_print_table_row(2, "UCD-SNMP Version", VersionInfo);
+       php_info_print_table_row(2, "UCD-SNMP Version", NetSnmpVersionInfo);
        php_info_print_table_end();
 }
 /* }}} */

I made no changes other than those which would complete the build (no cosmetic changes of 'ucd' to 'net').  I don't know the stability of this build as I haven't stress-tested it yet, but wanted to pass this along ASAP.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-03 18:26 UTC] stover_david at hotmail dot com
compiled as listed, either with or without --enable-ucd-snmp-hack, causes the following error when performing 'apachectl configtest':

Cannot load /usr/local/libexec/apache/libphp4.so into server: /usr/local/libexec/apache/libphp4.so: Undefined symbol "sprint_value"

This function referred to is in ext/snmp/snmp.c but I'm now at the limit of my knowledge of C/C++
 [2002-10-13 22:17 UTC] sniper@php.net
First you need latest CVS of PHP:

http://snaps.php.net/php4-latest.tar.gz

And then apply this patch:

http://www.kolumbus.fi/jani.taskinen/bugs/php_snmp.patch.gz

Then run './cvsclean && ./buildconf' to generate new configure.

Let me know if this builds okay for you, and also, if snmp functions actually work too.. :)

 [2002-10-14 20:10 UTC] sniper@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC