ts-7000
[Top] [All Lists]

[ts-7000] Re: Undefined references when using libvca

To:
Subject: [ts-7000] Re: Undefined references when using libvca
From: "sanjuan34" <>
Date: Wed, 10 Feb 2010 01:11:39 -0000
OMG. <bonk>. It was the order I had things in my Makefile. Why I had issues 
with libvca, and not any other library, I can't really say. I didn't get any 
undefined references for any pthreads functions. Anyway, thanks for the input 
on this folks!

Btw, here's the command line order that worked:

gcc -I/usr/include/ocera CANBus.c -o cantest -L/usr/lib/ocera -lvca -lulut

and in my Makefile it's now:

$(ARMPGM):      $(OBJS)
                $(CC) $(OBJS) $(CFLAGS) -o $(ARMPGM) $(LIB) 

Did I say <bonk> already? ;-)



--- In  "sanjuan34" <> wrote:
>
> Thanks Jim,
> 
> libvca.a is in /usr/lib/ocera
> 
> ts7000:/usr/lib/ocera# file libvca.a
> libvca.a: current ar archive
> 
> ts7000:/usr/lib/ocera# ar t libvca.a
> eds_utils.o
> vca_base.o
> vca_dinfomgr.o
> vca_fdpoll.o
> vca_net.o
> vca_od.o
> vca_pdo.o
> vca_pollfdnodecan.o
> vca_ulogdstub.o
> vca_utils.o
> vcasdo_fsm.o
> vcasdo_msg.o
> 
> 
> I've also listed the symbols in libvca.a to make sure vca_open_handle is in 
> there:
> 
> nm -s libvca.a |grep vca_open_handle
> vca_open_handle in vca_base.o
> 000000c0 T vca_open_handle
>          U vca_open_handle
> 
> 
> Today I compiled (on the TS, then later cross-compiled) 
> ocera-lincan-src.tar.gz from scratch and tried using libvca from those 
> builds, and still the same problem. I even created "libmyvca.a" from the 
> appropriate .o files, just...to see. No luck.
> 
> It would appear that gcc is seeing libvca.a (as a test I've removed it and I 
> get  /usr/bin/ld: cannot find -lvca), and of course nm shows 
> vca_open_handle (and others) as valid symbols. I've also tried a few 
> different functions, and I get undefined references to them. 
> 
> It appears the problem is in the linker stage, as gcc actually builds 
> CANBus.o, but then ld fails to "see" the symbols in libvca.a.
> 
> It's kind of crazy. I've never seen this problem before.
> 
> -Jesse 
> 
> 
> --- In  Jim Jackson <jj@> wrote:
> >
> > 
> > 
> > 
> > On Tue, 9 Feb 2010, sanjuan34 wrote:
> > 
> > > Lemme try this again...
> > >
> > > I'm using a TS-CAN1 on a TS-7350. When I attempt to use a function from 
> > > libvca, I'm receiving an error during linking stating that the function 
> > > I'm calling is an undefined reference. I'm getting this error both 
> > > compiling on the TS, and cross-compiling on a linux box (with 
> > > arm-linux-gcc).
> > >
> > > To try to figure this out I've simplified things as much as I can. Here's 
> > > the error I'm getting:
> > >
> > > gcc -I/usr/include/ocera -L/usr/lib/ocera   -lvca  CANBus.o  -o 
> > > arm_nodecontroller
> > 
> > from what you say below, gcc is obviously not seeing the lib.
> > Ok simple questions - which directory is the library file libvca.a in?
> > Is that directory in the gcc library search path?
> > Is it readable by the user running the gcc?
> > What is the output of
> > 
> >     cd directory_containing_libvca.a
> >     file libvca.a
> >     ar t libvca.a
> > 
> > 
> > 
> > >
> > > CANBus.o: In function `main':
> > > CANBus.c:(.text+0x38): undefined reference to `vca_open_handle'
> > > collect2: ld returned 1 exit status
> > >
> > > CANBus.c looks like this (like I said, I've stripped nearly everything 
> > > out):
> > >
> > > #include "can_vca.h"
> > >
> > > int main(void)
> > > {
> > >  vca_handle_t canhandle;
> > >  const char *candev = "/dev/can0";
> > >
> > >  vca_open_handle(&canhandle, candev, 0, 0);
> > >
> > > }
> > >
> > > As a test I've tried other functions from libvca and gotten the same 
> > > error. I'm really at a loss here, and I'm not sure where to proceed.
> > >
> > > Thanks
> > > -Jesse
> > >
> > >
> > >
> >
>




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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU