[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: std c++ libraries



> Date: Thu, 6 Dec 2001 18:56:24 +0100
> From: Hans-Peter Nilsson <hp@xxxxxxx.com>
> CC: dev-etrax@xxxxxxx.com
> 
> > Date: Thu, 6 Dec 2001 10:00:43 +0100 (CET)
> 
>     I wrote:
> > > Just build and link with g++-cris; if you have
> > > an
> > > "install" rule like the one in apps/ipsetd
> > > (installing in
> > > $(INSTDIR) everything will be copied automatically.
> 
>   Peter wrote:
> > Not quite! I have an application that relies on
> > libstdc++. If I add an install rule to my Makefile and
> > add an entry to makespec, libstdc++ will be added
> > fine.
> > libstdc++ relies on libmath however, and libmath will
> > not be included. I have to add an entry manually.
> 
> Are you sure you *linked* with g++-cris?

If you link with g++-cris, there will be a proper dependence on
libm.so marked in the executable.  If not, there will only be a
dependence on libm.so marked in libstdc++.so, so I guess that's
why you say what's below.

> > The script find-needed-shlibs.pl should be updated
> > to find not only direct dependencies but also
> > indirect, i.e., that if an application relies on a
> > library that relies on a library the last library
> > should also be added to the list of required
> > libraries.

It may or may not be a working solution to recursively search
through the depended-upon shlibs, but using g++-cris to compile
*and link* is proper procedure so please do that, and I'll check
into the deeper semantic issues with DT_NEEDED.

You have to change Rules.elinux, removing "-xc++" from CXX, then
use that for linking, as in this example (apps/hello) which
should work with devboard_lx-R2_0_0:

--------------------------------------- apps/hello/Makefile
AXIS_USABLE_LIBS = UCLIBC GLIBC
include $(APPS)/Rules.elinux

PROGS     = hello

INSTDIR   = $(prefix)/bin/
INSTMODE  = 0755
INSTOWNER = root
INSTGROUP = root

OBJS = hello.o

all: $(PROGS)

$(PROGS): $(OBJS)
	$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@

install:	$(PROGS)
	$(INSTALL) -d $(INSTDIR)
	$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(INSTDIR)

clean:
	rm -f $(PROGS) *.o core
--------------------------------------- apps/hello/hello.cc
#include <iostream.h>
main ()
{
  cout << "Hello, world!" << endl;
}
---------------------------------------

brgds, H-P