Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A question for the porting net-snmp to PowerPC.

44 views
Skip to first unread message

zs...@hotmail.com

unread,
Jun 7, 2004, 3:15:24 AM6/7/04
to
I want to use the net-snmp agent on the embeded Linux which run in PowerPC.
Then I change the variables in makefile and libtool to my cross-compiling
tools , such as CC, AR.
//------------------------------------------------------------
makefile
CC = /LinuxPPC/CDK/bin/powerpc-linux-gcc
CPP = /LinuxPPC/CDK/bin/powerpc-linux-gcc \
-Iinclude -I$(srcdir)/include -I$(srcdir)/agent/mibgroup -I. -I$(srcdir)
\
-DDONT_INC_STRUCTS -DBINDIR=$(bindir) \
$(EXTRACPPFLAGS)

Libtool
AR="/LinuxPPC/CDK/bin/power-linux-ar"
CC="/LinuxPPC/CDK/bin/power-linux-gcc"
//-------------------------------------------------------------------

So I use “make” to compile the program. But there is an error:
//----------------------------------------------------------------------------------

making all in /mnt/diskd/net-snmp-5.1.1-for-ppc/snmplib
make[1]: Entering directory `/mnt/diskd/net-snmp-5.1.1-for-ppc/snmplib'
/bin/sh ../libtool --mode=compile /LinuxPPC/CDK/bin/powerpc-linux-gcc
-I../include -I../include -I. -I.. -I. -I./.. -g -O2 -Dlinux -c -o mib.lo
mib.c
rm -f .libs/mib.lo
/LinuxPPC/CDK/bin/powerpc-linux-gcc -I../include -I../include -I. -I.. -I.
-I./.. -g -O2 -Dlinux -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:110: parse error before `get_myaddr'
../include/net-snmp/library/system.h:110: warning: data definition has no
type or storage class
make[1]: *** [mib.lo] Error 1
make[1]: Leaving directory `/mnt/diskd/net-snmp-5.1.1-for-ppc/snmplib'
make: *** [subdirs] Error 1
//----------------------------------------------------------------------------------------


Then I use the libtool without change(CC=gcc, AR=ar), the result of
compiling is right. But it is obviously that the file compiled can’t be
used in my target board.
What should I do with my makefile and libtool file? Thank you very much !

_________________________________________________________________
免费下载 MSN Explorer: http://explorer.msn.com/lccn/

-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the one
installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
Net-snmp-coders mailing list
Net-snm...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Robert Story (Coders)

unread,
Jun 7, 2004, 8:35:16 AM6/7/04
to
On Mon, 07 Jun 2004 15:13:53 +0800 =01 wrote:
> I want to use the net-snmp agent on the embeded Linux which run in PowerP=
C.=20
> Then I change the variables in makefile and libtool to my cross-compiling=
=20

> tools , such as CC, AR.

You can't just change the Makefile. You need to re-run configure for the new
environment. There are some cross compiling tips here:

http://www.net-snmp.org/faqs/rstory/#cross

--=20
Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
<irc://irc.freenode.net/#net-snmp>
Archive: <http://sourceforge.net/mailarchive/forum.php?forum=3Dnet-snmp-cod=
ers>

You are lost in a twisty maze of little standards, all different.=20

Robert Story (Coders)

unread,
Jun 8, 2004, 1:08:29 PM6/8/04
to
[ First - *please* don't mail me directly. Keep discussions on
the list, where others can both learn and offer advice. Thanks. ]

On Tue, 08 Jun 2004 13:52:55 +0800 =01 wrote:
> hello!
> I can't open open the webpage u gave=20
> me(http://www.net-snmp.org/faqs/rstory/#cross). Would u send me a copy of=
=20
> .txt or .html? Thank u very much!

From the net-snmp INSTALL file:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Specifying the System Type
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D

There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=3DTYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM

See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.

If you are building compiler tools for cross-compiling, you can also
use the `--target=3DTYPE' option to select the type of system they will
produce code for and the `--build=3DTYPE' option to select the type of
system on which you are compiling the package.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

The most important configure options are:

--with-cc=3D[cross-compiler]
--with-ld=3D[cross-linker]
--target=3D[target-environment]
--with-endianness=3D[big|little]

Other potentially useful options:

--with-cflags=3D"..."
--with-ldlags=3D"..."
--with-ar=3D/path/ar

--enable-mini-agent
--enable-shared=3D"no"
--without-pic

Two simple examples of cross-compiling:

./configure --target=3Dppc-linux --with-cc=3Dppc_405-gcc --with-endianness=
=3Dbig

./configure --target=3Dpowerpc-snmc-linux-gnu --build=3Di386-redhat-linux \
--with-endianness=3Dbig

A more complex example involves setting environment variables for all
the flags for the tools needed for the cross compile:

export TOOLPATH=3D/opt/hardhat/devkit/ppc/405
export PATH=3D$TOOLPATH/bin:$PATH
export CFLAGS=3D' -g -fPIC -msoft-float -D_SOFT_FLOAT -Dlinux -mcpu=3D40=
3'
export CPPFLAGS=3D'-I$TOOLPATH/include -I$TOOLPATH/target/usr/include'
export ASFLAGS=3D'-g -gstabs'
export LDFLAGS=3D'-Wl,-soname,-Bdynamic -lc'=20
export LIB=3D'ar rcu'=20

./configure --build=3Di686-pc-linux-gnu --host=3Dpowerpc \
--target=3Dpowerpc-hardhat-linux-gnu --with-endianness=3Dbig

You are lost in a twisty maze of little standards, all different.=20


-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite! GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org

lew kenny

unread,
Jun 9, 2004, 10:31:38 PM6/9/04
to
hi! I configured the file with the host option as u'r email.

./configure --with-cc=/LinuxPPC/CDK/bin/powerpc-linux-gcc \
--with-ar=/LinuxPPC/CDK/bin/powerpc-linux-ar \
--build=i686-pc-linux-gnu --host=powerpc \
--target=ppc-linux --with-endianness=big \
--with-perl-modules \
--with-prefix=/netsnmp-for-ppc

With compiling the files again, the past parse error disappeared.

But I get a new error to substitute it:

/LinuxPPC/CDK/bin/powerpc-linux-gcc -g -O2 -Dlinux -o snmpd snmpd.o
./.libs/libnetsnmpagent.a ./.libs/libnetsnmpmibs.a
helpers/.libs/libnetsnmphelpers.a ../snmplib/.libs/libnetsnmp.a -ldl -lm
/LinuxPPC/CDK/powerpc-linux/bin/ld: snmp_version.o: compiled for a little
endian system and target is big endian
File in wrong format: failed to merge target specific data of file
../snmplib/.libs/libnetsnmp.a(snmp_version.o)
collect2: ld returned 1 exit status
make[1]: *** [snmpd] Error 1
make[1]: Leaving directory `/mnt/diskd/net-snmp-5.1.1/agent'


make: *** [subdirs] Error 1

I set the big endian in the step of configuration, and I don't the cause of
the error about endianess?
Would u give me some idea of this problem?
Thank u very much!


>From: Robert Story (Coders) <rst...@freesnmp.com>
>Reply-To: net-snm...@lists.sourceforge.net
>To: <zs...@hotmail.com>
>CC: net-snm...@lists.sourceforge.net
>Subject: Re: A question for the porting net-snmp to PowerPC.
>Date: Tue, 8 Jun 2004 13:07:18 -0400
>
> [ First - *please* don't mail me directly. Keep discussions on
> the list, where others can both learn and offer advice. Thanks.
]
>

>On Tue, 08 Jun 2004 13:52:55 +0800 wrote:
> > hello!
> > I can't open open the webpage u gave

> > me(http://www.net-snmp.org/faqs/rstory/#cross). Would u send me a copy
of

> > .txt or .html? Thank u very much!
>
> From the net-snmp INSTALL file:
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>Specifying the System Type

>==========================


>
> There may be some features `configure' can not figure out
>automatically, but needs to determine by the type of host the package
>will run on. Usually `configure' can figure that out, but if it prints
>a message saying it can not guess the host type, give it the

>`--host=TYPE' option. TYPE can either be a short name for the system


>type, such as `sun4', or a canonical name with three fields:
> CPU-COMPANY-SYSTEM
>
>See the file `config.sub' for the possible values of each field. If
>`config.sub' isn't included in this package, then this package doesn't
>need to know the host type.
>
> If you are building compiler tools for cross-compiling, you can also

>use the `--target=TYPE' option to select the type of system they will
>produce code for and the `--build=TYPE' option to select the type of


>system on which you are compiling the package.
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
>The most important configure options are:
>

> --with-cc=[cross-compiler]
> --with-ld=[cross-linker]
> --target=[target-environment]
> --with-endianness=[big|little]
>
>Other potentially useful options:
>
> --with-cflags="..."
> --with-ldlags="..."
> --with-ar=/path/ar
>
> --enable-mini-agent
> --enable-shared="no"


> --without-pic
>
>Two simple examples of cross-compiling:
>

>./configure --target=ppc-linux --with-cc=ppc_405-gcc --with-endianness=big
>
>./configure --target=powerpc-snmc-linux-gnu --build=i386-redhat-linux \
> --with-endianness=big


>
>A more complex example involves setting environment variables for all
>the flags for the tools needed for the cross compile:
>

> export TOOLPATH=/opt/hardhat/devkit/ppc/405
> export PATH=$TOOLPATH/bin:$PATH
> export CFLAGS=' -g -fPIC -msoft-float -D_SOFT_FLOAT -Dlinux -mcpu=403'
> export CPPFLAGS='-I$TOOLPATH/include -I$TOOLPATH/target/usr/include'
> export ASFLAGS='-g -gstabs'
> export LDFLAGS='-Wl,-soname,-Bdynamic -lc'
> export LIB='ar rcu'
>
> ./configure --build=i686-pc-linux-gnu --host=powerpc \
> --target=powerpc-hardhat-linux-gnu --with-endianness=big
>
>
>--


>Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
><irc://irc.freenode.net/#net-snmp>
>Archive:

<http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-coders>


>
>You are lost in a twisty maze of little standards, all different.

_________________________________________________________________


免费下载 MSN Explorer: http://explorer.msn.com/lccn/

-------------------------------------------------------

Robert Story (Coders)

unread,
Jun 10, 2004, 10:13:09 AM6/10/04
to
On Thu, 10 Jun 2004 10:28:21 +0800 lew wrote:
LK> ./configure --with-cc=/LinuxPPC/CDK/bin/powerpc-linux-gcc \
LK> --with-ar=/LinuxPPC/CDK/bin/powerpc-linux-ar \
LK> --build=i686-pc-linux-gnu --host=powerpc \
LK> --target=ppc-linux --with-endianness=big \
LK> --with-perl-modules \
LK> --with-prefix=/netsnmp-for-ppc
LK>
LK> With compiling the files again, the past parse error disappeared.
LK>
LK> But I get a new error to substitute it:
LK> /LinuxPPC/CDK/powerpc-linux/bin/ld: snmp_version.o: compiled for a little
LK> endian system and target is big endian
LK> File in wrong format: failed to merge target specific data of file
LK> ../snmplib/.libs/libnetsnmp.a(snmp_version.o)
LK>
LK> I set the big endian in the step of configuration, and I don't the cause of
LK> the error about endianess?
LK> Would u give me some idea of this problem?

Did you 'make distclean' before you re-ran configure? I'm guessing not.

Try 'make clean' and then another make. If that doesn't help, them 'make
distclean', re-run configure and make. If that still doesn't help, let us know
and we'll go from there.

You are lost in a twisty maze of little standards, all different.

Eirik Nordbrøden

unread,
Jun 10, 2004, 10:41:08 AM6/10/04
to
Hello

We have done something similar and have used:

./configure \
:
:
--host=3D"powerpc-linux" \
--with-endianness=3Dbig \
:
CC=3Dpowerpc-linux-gcc \
AR=3Dpowerpc-linux-ar \
RANLIB=3Dpowerpc-linux-ranlib \
STRIP=3Dpowerpc-linux-strip \
LD=3Dpowerpc-linux-ld

ie no --build, no --target

That works for us!

PS We didn't get everything to work without specifying the tools things =
this way. I do not recall exactely what failed and which of the tools =
that are used, but it was not CC or AR that failed.
=20


> -----Original Message-----
> From: net-snmp-c...@lists.sourceforge.net
> [mailto:net-snmp-c...@lists.sourceforge.net]On Behalf=20
> Of Robert
> Story (Coders)
> Sent: 10. juni 2004 16:13
> To: lew kenny
> Cc: net-snm...@lists.sourceforge.net
> Subject: Re: A question for the porting net-snmp to PowerPC.

>=20
>=20


> On Thu, 10 Jun 2004 10:28:21 +0800 lew wrote:

> LK> ./configure --with-cc=3D/LinuxPPC/CDK/bin/powerpc-linux-gcc \
> LK> --with-ar=3D/LinuxPPC/CDK/bin/powerpc-linux-ar \
> LK> --build=3Di686-pc-linux-gnu --host=3Dpowerpc \
> LK> --target=3Dppc-linux --with-endianness=3Dbig \
> LK> --with-perl-modules \
> LK> --with-prefix=3D/netsnmp-for-ppc =20
> LK>=20
> LK> With compiling the files again, the past parse error disappeared.=20
> LK>=20


> LK> But I get a new error to substitute it:

> LK> /LinuxPPC/CDK/powerpc-linux/bin/ld: snmp_version.o:=20
> compiled for a little=20


> LK> endian system and target is big endian

> LK> File in wrong format: failed to merge target specific=20
> data of file=20
> LK> ../snmplib/.libs/libnetsnmp.a(snmp_version.o)
> LK>=20
> LK> I set the big endian in the step of configuration, and I=20


> don't the cause of
> LK> the error about endianess?
> LK> Would u give me some idea of this problem?

>=20
> Did you 'make distclean' before you re-ran configure? I'm=20
> guessing not.
>=20
> Try 'make clean' and then another make. If that doesn't help,=20
> them 'make
> distclean', re-run configure and make. If that still doesn't=20


> help, let us know
> and we'll go from there.

>=20
> --=20


> Robert Story; NET-SNMP Junkie <http://www.net-snmp.org/>
> <irc://irc.freenode.net/#net-snmp>

> Archive:=20
<http://sourceforge.net/mailarchive/forum.php?forum=3Dnet-snmp-coders>

You are lost in a twisty maze of little standards, all different.=20

iyyappa erasa

unread,
May 30, 2023, 4:00:13 AM5/30/23
to
Hi all,

I am facing the below build issue after porting the netsnmp.

/vobs/projects/springboard/toolchains/ppc/gcc-4.3.74-eglibc-2.8.74-6/powerpc-linux-gnu/bin/../lib/gcc/powerpc-linux-gnu/4.3.2/../../../../powerpc-linux-gnu/bin/ld: cannot find -ltinfo
collect2: ld returned 1 exit status
configure:3724: $? = 1
configure:3762: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "Net-SNMP"
| #define PACKAGE_TARNAME "net-snmp"
| #define PACKAGE_VERSION "5.9.1"
| #define PACKAGE_STRING "Net-SNMP 5.9.1"
| #define PACKAGE_BUGREPORT "net-snm...@lists.sourceforge.net"
| #define PACKAGE_URL ""
0 new messages