views:

72

answers:

1

Hey, I'm a real gcc newbee so excuse me if this is a silly question.

I want to use opencv in android and therefore try to compile it into a static library that get's used in the android ndk build process to build a shared library that I intent to use for my android app. The build of the statc library works fine, but when building the shared library I get complaints about undefined references. Since the file seemed to be correctly compiled and included I checked with ar -tv and see the following:

---------       0/0         27304 Jun 16 18:15 2010 /  
---------       0/0            24 Jan  1 01:00 1970 //  
rw-r--r--     501/501       11192 Jun 16 18:13 2010 cxalloc.o/  
rw-r--r--     501/501      289760 Jun 16 18:13 2010 cxarithm.o/  
rw-r--r--     501/501      197368 Jun 16 18:13 2010 cxarray.o/  
rw-r--r--     501/501      335112 Jun 16 18:13 2010 cxcmp.o/  
rw-r--r--     501/501      422872 Jun 16 18:13 2010 cxconvert.o/  
rw-r--r--     501/501      127160 Jun 16 18:13 2010 cxcopy.o/  
rw-r--r--     501/501      191208 Jun 16 18:13 2010 cxdatastructs.o/  
rw-r--r--     501/501      141536 Jun 16 18:13 2010 cxdrawing.o/  
rw-r--r--     501/501      170936 Jun 16 18:13 2010 cxdxt.o/  
rw-r--r--     501/501       29008 Jun 16 18:13 2010 cxerror.o/  
rw-r--r--     501/501       48304 Jun 16 18:13 2010 cximage.o/  
rw-r--r--     501/501       23376 Jun 16 18:13 2010 /0  
rw-r--r--     501/501       61024 Jun 16 18:13 2010 cxlogic.o/  
rw-r--r--     501/501       39520 Jun 16 18:13 2010 cxlut.o/  
rw-r--r--     501/501      122064 Jun 16 18:14 2010 cxmathfuncs.o/  
rw-r--r--     501/501      600368 Jun 16 18:14 2010 cxmatmul.o/  
rw-r--r--     501/501      135824 Jun 16 18:14 2010 cxmatrix.o/  
rw-r--r--     501/501      140464 Jun 16 18:14 2010 cxmean.o/  
rw-r--r--     501/501      339224 Jun 16 18:14 2010 cxmeansdv.o/  
rw-r--r--     501/501      118208 Jun 16 18:14 2010 cxminmaxloc.o/  
rw-r--r--     501/501      497760 Jun 16 18:14 2010 cxnorm.o/  
rw-r--r--     501/501      119712 Jun 16 18:14 2010 cxouttext.o/  
rw-r--r--     501/501      346624 Jun 16 18:14 2010 cxpersistence.o/  
rw-r--r--     501/501        1688 Jun 16 18:14 2010 cxprecomp.o/  
rw-r--r--     501/501       86856 Jun 16 18:14 2010 cxrand.o/  
rw-r--r--     501/501      242768 Jun 16 18:15 2010 cxsumpixels.o/  
rw-r--r--     501/501       82320 Jun 16 18:15 2010 cxsvd.o/  
rw-r--r--     501/501      102024 Jun 16 18:15 2010 cxswitcher.o/  
rw-r--r--     501/501        5968 Jun 16 18:15 2010 cxtables.o/  
rw-r--r--     501/501       43720 Jun 16 18:15 2010 cxutils.o/  

There are two lines that I don't understand, the second one with the date 1970 and the one with \0 as filename. I also wondered because nm doesn't return anything. When I try a randlib I get:

ranlib: warning for library: libcxcore.a the table of contents is empty (no object file members in the library define global symbols)  

The file that should figure at the place of \0 is the one that defines one of the functions that can not be referenced.

I tried this under OS X 10.6 and Ubuntu 10.04.

Any insights on this or what else I could do to find the problem?

A: 

perhaps the command you use to create the static lib is wrong ? You should use "ar -rs". The "s" option create an index table. That might be your problem ?

neuro
turns out it works in ubuntu, no idea what's the problem in os x
berliner