:: Re: [Libbitcoin] linker errors with…
Góra strony
Delete this message
Reply to this message
Autor: William Swanson
Data:  
Dla: Amir Taaki
CC: libbitcoin@lists.dyne.org
Temat: Re: [Libbitcoin] linker errors with libbitcoin and pkg-config (linux)
The tools care about the order in which the libraries are specified.
Try putting -lpthread at the end of the command. The linker will skip
libraries it thinks are unused, so you generally need to put
dependencies *after* the things that depend on them.

-William

On Wed, Oct 1, 2014 at 8:05 AM, Amir Taaki <genjix@???> wrote:
> Still same issues with develop branch. Adding -pthread should fix it.
> I'm not sure why it doesn't work.
>
> $ g++ -pthread orgwork.cpp $(pkg-config --cflags --libs libbitcoin)
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_create'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_detach'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status
>
> $ g++ -lpthread orgwork.cpp $(pkg-config --cflags --libs libbitcoin)
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_create'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_detach'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status
>
> $ g++ orgwork.cpp $(pkg-config --cflags --libs libbitcoin) -pthread
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_create'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_detach'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status
>
> $ g++ orgwork.cpp $(pkg-config --cflags --libs libbitcoin) -lpthread
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_create'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_detach'
> /home/rescue/usr/lib/libbitcoin.so: undefined reference to `pthread_join'
> collect2: error: ld returned 1 exit status