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 
Channa  <> wrote:
>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


Home | Main Index | Thread Index | Old Index