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

RE: Shared libraries



> -----Original Message-----
> From: owner-dev-etrax@xxxxxxx.com 
> [mailto:owner-dev-etrax@xxxxxxx.com] On Behalf Of Frank Brown
> Sent: Friday, August 06, 2004 07:33
> To: dev-etrax
> Cc: OGurkan@xxxxxxx.com
> Subject: Shared libraries
> 
> I'm pursuing the same problem I asked about last time,
> but have identified that it is different than I thought.
> I have the following program:
> 
> #include <stdio.h>
> 
> int
> main(int argc, char *argv[]) {
>   printf("Hello World\n\r");
>   return 0;
> }
> 
> I used the following makefile:
> 
> AXIS_USABLE_LIBS = GLIBC
> include $(AXIS_TOP_DIR)/tools/build/Rules.axis
> 
> PROGS     = foo_uei
> 
> INSTDIR   = $(prefix)/bin
> INSTMODE  = 0755
> INSTOWNER = root
> INSTGROUP = root
> 
> OBJS  = FOO_ALL.o
> 
> LDLIBS += -lstdc++
> 
> all:  $(PROGS)
> 
> $(PROGS): $(OBJS)
>       $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $(PROGS)
> 
> install: $(PROGS)
>       $(INSTALL) -d $(INSTDIR)
>       $(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP)
$(PROGS) $(INSTDIR)
> 
> clean:
>       rm *.o
> 
> #
> 
> After installing it is in /cris-axis-linux-gnu/bin.

I do assume you did 'make files && make images' here too?

During make images you should get a list of all libraries 
that will be included in the image. libm.so.6 should be in
this list for things to work.

> I used boot_linux -f to get it into the Axis-82.
> I used the ls -l to assure it was the latest.
> When I execute it, this is what I get:
> 
> #/bin/foo_uei
> foo_uei: error while loading shared libraries: libm.so.6: cannot load
> shared object file: no such file or directory
> 
> I had thought it was a problem with the shared libraries
> not getting transfered, but readelf-cris tells me that
> libm.so.6 is not a needed lib for this.

This is because your program in itself does not need it.
Rather a dependency of it does (in this case libstdc++). 

Does it make any difference if you add -lm to the 
LDLIBS += line above (i.e., adding a direct dependency 
on libm)?

> Any idea where I blew it??
> 
> Frank Brown
> Phoenix Consulting
> for Emerson Climate Technology
> fcb3@xxxxxxx.net

//Peter