On 03/07/2012 17:22, st...@nixia.no wrote:
Here is my error

     /bin/bash ../libtool --tag=CC   --mode=link gcc -std=gnu99  -g -O2
     -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra
     -Wno-unused-parameter -Wbad-function-cast -Wcast-align
     -Wredundant-decls   -o openocd main.o libopenocd.la
     ../jimtcl/libjim.a   -ldl
     libtool: link: gcc -std=gnu99 -g -O2 -Wall -Wstrict-prototypes
     -Wformat-security -Wshadow -Wextra -Wno-unused-parameter
     -Wbad-function-cast -Wcast-align -Wredundant-decls -o openocd
     main.o  ./.libs/libopenocd.a -lpthread -lrt ../jimtcl/libjim.a -ldl
     ./.libs/libopenocd.a(libhelper_la-options.o): In function `port_flag':
     /home/vivien/Desktop/openocdcopie/src/helper/options.c:130:
     undefined reference to `usbinit'
This is a linking problem. Compiled code references a symbol that is not
present when linking. (What would happen if you forget to link in an .o
file for instance.).

Automake, autoconf etc. can sometimes be a bit tricky.
Yes :(
But in general they
end up wrapping gcc.

What I would do.

Which .c file is "usbinit" defined in.
usbinit is a function in detection.c called on options.c

Is that .c file compiled to an .o file? (You can always try to add
#error Some dummy text
into the .c file. If compile fails, it what compiled before.
I have add this in makefile :

   libopenocd_la-detection.lo: detection.c
        $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS)
   --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
   $(libopenocd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT
   libopenocd_la-detection.lo -MD -MP -MF
   $(DEPDIR)/libopenocd_la-detection.Tpo -c -o
   libopenocd_la-detection.lo `test -f 'detection.c' || echo
   '$(srcdir)/'`detection.c
        $(am__mv) $(DEPDIR)/libopenocd_la-detection.Tpo
   $(DEPDIR)/libopenocd_la-detection.Plo
   #    source='detection.c' object='libopenocd_la-detection.lo'
   libtool=yes \
   #    DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
   #    $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS)
   --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
   $(libopenocd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o
   libopenocd_la-detection.lo `test -f 'detection.c' || echo
   '$(srcdir)/'`detection.c

and it's create libopenocd_la-detection.o

Is the .o file linked into the .a/.la file?
How can I know this ?
I have it in libopenocd.a (if this is want you wanna know)

Is the .a/.la file linked into the final target?
No because it fail before the end of compilation :)


Stian Skjelstad


Thanks a lot for your response :)
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to