[uClinux-dev] net-snmp configuration

Hector Oron hector.oron at gmail.com
Mon Oct 17 07:53:06 EDT 2005


On 10/16/05, Doug Kehn <rdkehn at yahoo.com> wrote:
>
> Hi Hector,
>
> Which uClinux-dist are you referring? And what
> compiler errors are you getting?



Let me explain a little, i need to run an agent with a custom mib in a
powerpc, and send some traps when a serial event comes to the board. My host
machine is a i686. I'm using uClinux-dist-20041215.tar.bz2, but this error
logs are with net-snmp version 5.2.2.pre4 (also happend with uClinux-dist's
net-snmp)

I've been able to cross-compile the code under ./user/snmpd/, but i don't
know how to add my mib to it, also i don't know how to send traps with this
little program.

I've not been able to cross-compile ./user/net-snmp/, also i've been trying
to compile native with my mib (adding the mib to the agent) and it doesn't
work very well.

As i'm not an open book explaining myself (poor english, sorry), i paste my
error logs:

First, i try to cross-compile:
 $ ./configure --host=ppc-linux --target=ppc --build=i686-linux
--with-cc=powerpc-linux-gcc --with-ld=powerpc-linux-ld
--with-endianness=little --enable-mini-agent

at config.log:
[...]
configure:3578: checking for C compiler default output file name
configure:3581: powerpc-linux-gcc conftest.c >&5
/opt/host/i686-linux/powerpc-linux/bin/ld: cannot find /lib/libc_nonshared.a
collect2: ld returned 1 exit status
configure:3584: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "Net-SNMP"
| #define PACKAGE_TARNAME "net-snmp"
| #define PACKAGE_VERSION "5.2.2.pre4"
| #define PACKAGE_STRING "Net-SNMP 5.2.2.pre4"
| #define PACKAGE_BUGREPORT "net-snmp-coders at lists.sourceforge.net"
| #define CONFIGURE_OPTIONS "\"'--host=ppc-linux' '--target=ppc'
'--build=i686-linux' '--with-cc=powerpc-linux-gcc'
'--with-ld=powerpc-linux-ld' '--with-endianness=little'
'--enable-mini-agent' 'build_alias=i686-linux' 'host_alias=ppc-linux'
'target_alias=ppc'\""
| #define SCAPI_AUTHPRIV 1
| #define NO_DUMMY_VALUES 1
| #define OPAQUE_SPECIAL_TYPES 1
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3623: error: C compiler cannot create executables
See `config.log' for more details.
[...]


It looks like is there a bug on my toolchain trying to look for
/lib/libc_nonshared.a ?
 $ find . -name libc_nonshared.a
/usr/local/bin/i686-linux/powerpc-linux/lib/libc_nonshared.a

Well, i tweak net-snmp configure script with this changes: (to avoid C
compiler checking):

3580,3585c3580,3585
< #ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
< #if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
< # (eval $ac_link_default) 2>&5
< # ac_status=$?
< # echo "$as_me:$LINENO: \$? = $ac_status" >&5
< # (exit $ac_status); }; then
---
> ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
> if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
> (eval $ac_link_default) 2>&5
> ac_status=$?
> echo "$as_me:$LINENO: \$? = $ac_status" >&5
> (exit $ac_status); }; then
3592c3592
< #ac_cv_exeext=
---
> ac_cv_exeext=
3594,3627c3594,3627
< #for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*
b.out
< #do
< # test -f "$ac_file" || continue
< # case $ac_file in
< # *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o
| *.obj )
< # ;;
< # conftest.$ac_ext )
< # # This is the source file.
< # ;;
< # [ab].out )
< # # We found the default executable, but exeext='' is most
< # # certainly right.
< # break;;
< # *.* )
< # ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
< # # FIXME: I believe we export ac_cv_exeext for Libtool,
< # # but it would be cool to find out if it's true. Does anybody
< # # maintain Libtool? --akim.
< # export ac_cv_exeext
< # break;;
< # * )
< # break;;
< # esac
< #done
< #else
< # echo "$as_me: failed program was:" >&5
< #sed 's/^/| /' conftest.$ac_ext >&5
< #
< #{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
< #See \`config.log' for more details." >&5
< #echo "$as_me: error: C compiler cannot create executables
< #See \`config.log' for more details." >&2;}
< # { (exit 77); exit 77; }; }
< #fi
---
> for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*
b.out
> do
> test -f "$ac_file" || continue
> case $ac_file in
> *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o |
*.obj )
> ;;
> conftest.$ac_ext )
> # This is the source file.
> ;;
> [ab].out )
> # We found the default executable, but exeext='' is most
> # certainly right.
> break;;
> *.* )
> ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
> # FIXME: I believe we export ac_cv_exeext for Libtool,
> # but it would be cool to find out if it's true. Does anybody
> # maintain Libtool? --akim.
> export ac_cv_exeext
> break;;
> * )
> break;;
> esac
> done
> else
> echo "$as_me: failed program was:" >&5
> sed 's/^/| /' conftest.$ac_ext >&5
>
> { { echo "$as_me:$LINENO: error: C compiler cannot create executables
> See \`config.log' for more details." >&5
> echo "$as_me: error: C compiler cannot create executables
> See \`config.log' for more details." >&2;}
> { (exit 77); exit 77; }; }
> fi
3675,3679c3675,3679
< #if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
< # (eval $ac_link) 2>&5
< # ac_status=$?
< # echo "$as_me:$LINENO: \$? = $ac_status" >&5
< # (exit $ac_status); }; then
---
> if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
> (eval $ac_link) 2>&5
> ac_status=$?
> echo "$as_me:$LINENO: \$? = $ac_status" >&5
> (exit $ac_status); }; then
3684,3700c3684,3700
< #for ac_file in conftest.exe conftest conftest.*; do
< # test -f "$ac_file" || continue
< # case $ac_file in
< # *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o
| *.obj ) ;;
< # *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
< # export ac_cv_exeext
< # break;;
< # * ) break;;
< # esac
< #done
< #else
< # { { echo "$as_me:$LINENO: error: cannot compute suffix of executables:
cannot compile and link
< #See \`config.log' for more details." >&5
< #echo "$as_me: error: cannot compute suffix of executables: cannot compile
and link
< #See \`config.log' for more details." >&2;}
< # { (exit 1); exit 1; }; }
< #fi
---
> for ac_file in conftest.exe conftest conftest.*; do
> test -f "$ac_file" || continue
> case $ac_file in
> *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o |
*.obj ) ;;
> *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
> export ac_cv_exeext
> break;;
> * ) break;;
> esac
> done
> else
> { { echo "$as_me:$LINENO: error: cannot compute suffix of executables:
cannot compile and link
> See \`config.log' for more details." >&5
> echo "$as_me: error: cannot compute suffix of executables: cannot compile
and link
> See \`config.log' for more details." >&2;}
> { (exit 1); exit 1; }; }
> fi

Then configure does it job, but make fails.

# make
making all in /home/zumbi/VoIP_CRIC/net-snmp-5.2.2.pre4.bak/snmplib
make[1]: Entering directory `/home/zumbi/VoIP_CRIC/net-snmp-5.2.2.pre4.bak
/snmplib'
/bin/sh ../libtool --mode=compile powerpc-linux-gcc -I../include -I.
-I../snmplib -g -O2 -Dnone -c -o mib.lo mib.c
rm -f .libs/mib.lo
powerpc-linux-gcc -I../include -I. -I../snmplib -g -O2 -Dnone -c mib.c -fPIC
-DPIC -o .libs/mib.lo
In file included from ../include/net-snmp/utilities.h:39,
from mib.c:85:
../include/net-snmp/library/system.h:114: parse error before `__extension__'
../include/net-snmp/library/system.h:114: `__len' undeclared here (not in a
function)
../include/net-snmp/library/system.h:114: initializer element is not
constant
../include/net-snmp/library/system.h:114: parse error before `if'
../include/net-snmp/library/system.h:114: conflicting types for `__retval'
../include/net-snmp/library/system.h:114: previous declaration of `__retval'
../include/net-snmp/library/system.h:114: warning: data definition has no
type or storage class
../include/net-snmp/library/system.h:114: parse error before `}'
../include/net-snmp/library/system.h:135: parse error before `__extension__'
make[1]: *** [mib.lo] Error 1
make[1]: Leaving directory `/home/zumbi/net-snmp-5.2.2.pre4.bak/snmplib'
make: *** [subdirs] Error 1

Also another way i have tried:

 $ ./configure --build=powerpc-linux-gnu --host=i686
--target=powerpc-linux-gnu --with-endianness=little --enable-mini-agent
--disable-shared --enable-static --with-ldflags=-Bstatic


ERROR:
/bin/sh ../libtool --mode=link powerpc-linux-gcc -static
-I/usr/linux/include -I../snmplib -I../modules -Wall -Wstrict-prototypes -O2
-fomit-frame-pointer -Dlinux -o snmpd snmpd.lo -Bstatic
libnetsnmpmibs.la<http://libnetsnmpmibs.la>
libnetsnmpagent.la <http://libnetsnmpagent.la> helpers/libnetsnmphelpers.la
../snmplib/libnetsnmp.la -ldl -lm
powerpc-linux-gcc -I/usr/linux/include -I../snmplib -I../modules -Wall
-Wstrict-prototypes -O2 -fomit-frame-pointer -Dlinux -o snmpd
snmpd.o-Bstatic ./.libs/libnetsnmpmibs.a ./.libs/libnetsnmpagent.a
helpers/.libs/libnetsnmphelpers.a ../snmplib/.libs/libnetsnmp.a -ldl -lm
/opt/host/i686-linux/powerpc-linux/bin/ld: cannot find /lib/libc_nonshared.a
collect2: ld returned 1 exit status
powerpc-linux-gcc: file path prefix `static' never used
make[1]: *** [snmpd] Error 1
make[1]: Leaving directory `/home/zumbi/net-snmp-5.2.2.pre4/agent'
make: *** [subdirs] Error 1


then i do

ln -s /opt/host/i686-linux/powerpc-linux/lib/libc_nonshared.a
/lib/libc_nonshared.a

[...]
system_mib.o(.text+0x984): relocation truncated to fit: R_PPC_REL24 strlen
system_mib.o(.text+0x9c0): undefined reference to `strlen'
system_mib.o(.text+0x9c0): relocation truncated to fit: R_PPC_REL24 strlen
system_mib.o(.text+0x9e4): undefined reference to `strlen'
system_mib.o(.text+0x9e4): relocation truncated to fit: R_PPC_REL24 strlen
system_mib.o(.text+0xa08): undefined reference to `strlen'
system_mib.o(.text+0xa08): relocation truncated to fit: R_PPC_REL24 strlen
./.libs/libnetsnmpmibs.a(system_mib.o): In function `writeSystem':
system_mib.o(.text+0xc72): undefined reference to `__ctype_b'
system_mib.o(.text+0xc76): undefined reference to `__ctype_b'
system_mib.o(.text+0xcc0): undefined reference to `strcpy'
system_mib.o(.text+0xcc0): relocation truncated to fit: R_PPC_REL24 strcpy
[...]
/opt/host/i686-linux/powerpc-linux/lib/libdl.so: undefined reference to
`_nl_msg_cat_cntr at GLIBC_2.0'
/opt/host/i686-linux/powerpc-linux/lib/libdl.so: undefined reference to
`__ctype_b at GLIBC_2.0'
/opt/host/i686-linux/powerpc-linux/lib/libm.so: undefined reference to
`__strtod_internal at GLIBC_2.0'
/opt/host/i686-linux/powerpc-linux/lib/libdl.so: undefined reference to
`strerror at GLIBC_2.0'
/opt/host/i686-linux/powerpc-linux/lib/libm.so: undefined reference to
`__strtof_internal at GLIBC_2.0'
collect2: ld returned 1 exit status
powerpc-linux-gcc: file path prefix `static' never used
make[1]: *** [snmpd] Error 1
make[1]: Leaving directory `/home/zumbi/net-snmp-5.2.2.pre4/agent'
make: *** [subdirs] Error 1

I also get this error on the MIB

$ snmptranslate -m +SAFEPHONE-MIB -IR safePhone
No log handling enabled - turning on stderr logging
Unlinked OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Undefined identifier: SAFEPHONE near line 501 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Unlinked OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Undefined identifier: SAFEPHONE near line 498 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Unlinked OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Undefined identifier: SAFEPHONE near line 495 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Unlinked OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Undefined identifier: SAFEPHONE near line 492 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Unlinked OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Undefined identifier: SAFEPHONE near line 489 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Unlinked OID in SAFEPHONE-MIB: safePhone ::= { org 1 }
Undefined identifier: org near line 19 of
/home/zumbi/.snmp/mibs/SAFEPHONE_MIB.txt
Cannot adopt OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Cannot adopt OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Cannot adopt OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Cannot adopt OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Cannot adopt OID in SAFEPHONE-MIB: SAFEPHONE# ::= { SAFEPHONE 0 }
Cannot adopt OID in SAFEPHONE-MIB: phoneChanges ::= { SAFEPHONE# 4 }
Cannot adopt OID in SAFEPHONE-MIB: stsPanelStatus ::= { SAFEPHONE# 3 }
Cannot adopt OID in SAFEPHONE-MIB: phoneCall ::= { SAFEPHONE# 2 }
Cannot adopt OID in SAFEPHONE-MIB: stsPanelStatus ::= { SAFEPHONE# 1 }
Cannot adopt OID in SAFEPHONE-MIB: stsTestStatus ::= { SAFEPHONE# 0 }
SAFEPHONE-MIB::safePhone


Thanks for the attention, and if you need more especific information, please
let me know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20051017/b5aeecb1/attachment.html>


More information about the uClinux-dev mailing list