pthread linking error

1,208 views
Skip to first unread message

Richard Deurwaarder

unread,
May 24, 2011, 10:45:06 AM5/24/11
to android-ndk
I've posted this in the android-dev group but was asked to post it
here instead.


I'm porting a native engine written in FreePascal.
I've got my crosscompiler up and running and it's compiles simple
hello world programs. However when i attempt to ccompile the engine
it
gives me linking errors

/usr/local/bin/arm-linux-ld: cannot find -ldl
/usr/local/bin/arm-linux-ld: cannot find -lpthread
/usr/local/bin/arm-linux-ld: cannot find -lc
hwLibrary.pas(33) Error: Error while linking
hwLibrary.pas(33) Fatal: There were 1 errors compiling module,
stopping
Fatal: Compilation aborted

Now i know that the pthread is implemented differently, being
implemented directly into bionic. However how do i link it correctly?
I've tried using these linker options: --whole-archive -lpthread but
it just gives me the same error. How can i fix this?
Also what about the -ldl and -lc? What kind of libraries are these?
and what should i link them to?

Thanks in advance for any help,

Richard


Ps.

I must add that i've figured out how to link against libld.so and
libc.so. But as i've said there's no libpthread.so. How should i go
about fixing that issue?

Olivier Guilyardi

unread,
May 24, 2011, 11:03:10 AM5/24/11
to andro...@googlegroups.com
You don't need to link explicitly with -lpthread. pthread support is linked in
by default. -lc is for the libc, same thing, remove this.

But -ldl shouldn't fail. What's this "crosscompiler"? Are you using a generic
arm cross compiler? That won't work.

Read ndk/docs/STANDALONE-TOOLCHAIN.html.

Olivier

Reply all
Reply to author
Forward
0 new messages