NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: link as -lc -lpthread hangs



In article 
<515c64960909100612h29118e2ftf2af05f513aa103a%mail.gmail.com@localhost>,
Channa  <channa.kad%gmail.com@localhost> wrote:
>Hi,
>I am using NetBSD rtld implementation in my library.
>I am facing some issue when the application is built by linking
>with libc before libpthread. i.e  '-lc -lpthread' as shown below
>
>/usr/local/${ARCH}-linux/gcc app.c -o app -lc -lpthread
>
>When i run the 'app' it hangs.

This is not supposed to work. You need to link -lpthread before -lc
since pthread overrides some libc functions. In fact the only portable
way to compile threaded programs is using gcc -pthread app.c -o app

christos



Home | Main Index | Thread Index | Old Index