:: Re: [Libbitcoin] linker errors with…
Forside
Slet denne besked
Besvar denne besked
Skribent: Amir Taaki
Dato:  
Til: libbitcoin
Emne: Re: [Libbitcoin] linker errors with libbitcoin and pkg-config (linux)
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

On 09/30/2014 08:50 PM, Amir Taaki wrote:
> I already tried adding -pthread and -lpthread at different positions on
> the command line and it didn't work.
>
> On 09/30/2014 08:08 PM, Eric Voskuil wrote:
>> -lpthread is not declared as a dependency in the libbitcoin/develop package config
>>
>> In updating and versioning dependencies (gmp, ssl, curl) I found that the libbitcoin build didn't require pthread.
>>
>> This may have been because all of the query examples have been disabled in the develop branch due to the blockchain work.
>>
>> So either callers that use it need to reference it or it needs to be added to the pc.
>>
>> e
>>
>> -----Original Message-----
>> From: Libbitcoin [mailto:libbitcoin-bounces@lists.dyne.org] On Behalf Of Amir Taaki
>> Sent: Tuesday, September 30, 2014 11:50 AM
>> To: libbitcoin@???
>> Subject: [Libbitcoin] linker errors with libbitcoin and pkg-config (linux)
>>
>> I tried to track down in the git history but it's difficult and time
>> consuming. Any ideas why the pkg-config linking with libbitcoin no
>> longer works?
>>
>> $ cat orgwork.cpp
>> #include <bitcoin/bitcoin.hpp>
>>
>> bc::hash_number sum_difficulty()
>> {
>>     bc::hash_number total_work = 0;
>>     return total_work;
>> }

>>
>> int main()
>> {
>>     bc::hash_number orphan_work = 0;
>>     orphan_work += bc::block_work(486604799);
>>     bc::hash_number main_work = sum_difficulty();
>>     if (orphan_work <= main_work)
>>         bc::log_debug() << "Fail";
>>     else
>>         bc::log_debug() << "Pass";
>>     return 0;
>> }

>>
>> $ g++ 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
>>
>>
>>
>
>
>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>