On 09/19/09 02:17, Wei Feng wrote:
> I wrote a minimal working example as below:
> ================================
> // test_judy.cpp

<snip>

It looks like Judy is properly installed and working since you can
compile and run the simple JudyL1Check.

It looks like your program does not have a main() function and that
you are really trying to compile a library rather than a standalone
application. It also explains the "-shared" option. When you tried to
remove "-shared" you got the error:

> /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/crt1.o: In function 
> `_start':../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
> collect2: ld returned 1 exit status

Which pretty much backs up the point that you are trying to compile
the code as a library that will eventually be loaded into matlab.
I've never used matlab and don't know anything about it so this is
just a SWAG on my part. In any case it looks this is the real error:

> /usr/bin/ld: 
> /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/libJudy.a(Judy1Test.o): 
> relocation R_X86_64_32S against `a local symbol' can not be used when making 
> a shared object; recompile with -fPIC
> /usr/lib/gcc/x86_64-linux-gnu/4.0.3/../../../../lib64/libJudy.a: could not 
> read symbols: Bad value
> collect2: ld returned 1 exit status

This error message is telling you that libJudy.a was not compiled with
the -fPIC flag, which is true. The short answer is that you should be
linking with the shared library not the static library. 

I'm just not sure why the static library is getting picked up instead
of the shared library. What do you get when you do: 

ls /usr/lib/libJudy*

You might try copying /usr/lib/libJudy.so.1.0.3 to your local
directory and then and the following options:

On the "* flags" lines add -L. and on the "*LIBS lines" add
-Wl,-rpath,$(pwd) 

Troy

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to