I'm trying to add a custom function to my bitcoin client that queries a mysql db. I followed this guide for the basic: https://technology.finra.org/code/compile-run-customize-your-own-bitcoin-client.html

I build the bitcoin node from the source code: https://github.com/bitcoin/bitcoin with help from: http://www.reynoldtech.com/building-bitcoin-core-0-16-3-from-source-on-ubuntu-18-04-1-desktop-amd64/

And I am getting this error:

Making all in src
make[1]: Entering directory '/home/ubuntu/bitcoin/src'
make[2]: Entering directory '/home/ubuntu/bitcoin/src'
make[3]: Entering directory '/home/ubuntu/bitcoin'
make[3]: Leaving directory '/home/ubuntu/bitcoin'
  CXXLD    bench/bench_bitcoin
libbitcoin_server.a(libbitcoin_server_a-blockchain.o): In function `testFunction(JSONRPCRequest const&)':
/home/ubuntu/bitcoin/src/rpc/blockchain.cpp:2391: undefined reference to `get_driver_instance'
collect2: error: ld returned 1 exit status
Makefile:7133: recipe for target 'bench/bench_bitcoin' failed
make[2]: *** [bench/bench_bitcoin] Error 1
make[2]: Leaving directory '/home/ubuntu/bitcoin/src'
Makefile:17537: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/bitcoin/src'
Makefile:785: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

I've added the following to /src/Makefile

CXXFLAGS = -g -O2 -fno-extended-identifiers -I /usr/include/cppconn

LDFLAGS = -L/usr/lib/x86_64-linux-gnu/libmysqlconn.so -lmysqlcppconn -lmysqlcppconn-static

When I run locally I can remove that error by running: g++ -o output testBlock.cpp L/usr/lib -lmysqlcppconn

How can I properly add the mysql connector library to src/rpc/blockchain.cpp?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.