:: Re: [Libbitcoin] linker errors with…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Amir Taaki
Ημερομηνία:  
Προς: libbitcoin
Αντικείμενο: Re: [Libbitcoin] linker errors with libbitcoin and pkg-config (linux)
I found the problem commit at:

https://github.com/libbitcoin/libbitcoin/commit/8fb89485ae2247253ebb546fac639a3b750562bf

Here's my fix which I will push to the repo:

$ git show 8b2b3bd
commit 8b2b3bdb5d06508dbe42851bfc819c039b15ba7c
Author: Amir Taaki <genjix@???>
Date: Mon Oct 6 13:33:54 2014 +0200

    add missing libs back to Makefile


diff --git a/src/Makefile.am b/src/Makefile.am
index c81e8e2..aaab846 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,5 +53,6 @@ libbitcoin_la_SOURCES = \
     wallet/uri.cpp


 libbitcoin_la_LIBADD = \
-    ${secp256k1_LIBS}
+    ${secp256k1_LIBS} -lboost_thread -lboost_system -lboost_regex \
+    -lboost_filesystem -lpthread -lcrypto -ldl -lz




On 10/01/2014 05:05 PM, Amir Taaki 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
>
> 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
>>
>
>
>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>