sony / easyhttpcpp

A cross-platform HTTP client library with a focus on usability and speed
MIT License
163 stars 29 forks source link

Can not build app with easyhttp #5

Closed EZ-Phantom closed 5 years ago

EZ-Phantom commented 5 years ago

Hi, I can not set up my makefile, I've tired after all these undefined references to something in Poco::Whatever

g++ -std=c++14 -DIBPP_LINUX $(INCLUDES) $(SOURCES) -L/usr/local/lib/ -I/usr/local/include/ -o executable -libpp -L. -lonyx -lcurl -lpthread -lboost_system -lboost_filesystem -leasyhttp -lssl -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -lPocoJSON

/usr/local/lib//libeasyhttp.a(SqliteOpenHelper.cpp.o): In function `easyhttpcpp::db::SqliteOpenHelper::SqliteOpenHelper(Poco::Path const&, unsigned int)':
SqliteOpenHelper.cpp:(.text+0x152): undefined reference to `Poco::Data::SQLite::Connector::registerConnector()'

Am I wrong and doing something wrong? Or there are some tricks about it?

EZ-Phantom commented 5 years ago

Probably it will be usefull to add to your Wiki some piece of info about building project with your lib, thx

shekharhimanshu commented 5 years ago

Hi @EZ-Phantom

Thank you for your interest in EasyHttp.

The error seems to be due to missing Poco modules: Data & DataSQLite. Could you try adding -lPocoDataSQLite -lPocoData to your Makefile and let me know if that works?

Here is the entire Poco dependency

-lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -lPocoJSON -lPocoData -lPocoDataSQLite

Poco internally uses OpenSSL and SQLite3 libraries. So you may want to add those as well.

-lssl -lcrypto -lsqlite3
shekharhimanshu commented 5 years ago

Probably it will be usefull to add to your Wiki some piece of info about building project with your lib, thx

I agree. The samples projects (eg: SimpleHttpClient) show how to build with CMake but having a Makefile sample script would be helpful as well.

I have created an issue for the same. #6 Will add one soon. Thanks!

EZ-Phantom commented 5 years ago

I will try tomorrow. I left my sources in office. Thx for the answer

EZ-Phantom commented 5 years ago

Okay, so g++ -std=c++14 -DIBPP_LINUX $(INCLUDES) $(SOURCES) -L/usr/local/lib/ -I/usr/local/include/ -I/usr/lib/ssl/ -L/usr/lib/ssl/ -o stalker-collector -libpp -L. -lonyx -lcurl -lpthread -lboost_system -lboost_filesystem -lcrypto -lsqlite3 -leasyhttp -lssl -lPocoFoundation -lPocoNet -lPocoNetSSL -lPocoUtil -lPocoCrypto -lPocoJSON -lPocoData -lPocoDataSQLite

worked, but when I've got libssl-dev version 1.1.0 it wasnt able to build

libssl.so.1.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

That's why I have used this helpful comment https://github.com/Azure/azure-iot-sdk-c/issues/265#issuecomment-339794097

I have to do sudo apt-get purge libssl-dev then sudo apt-get install libssl1.0-dev

then I was forced to reinstall libcur4-nss-dev as well, I suppose it is so because my curl was build with ssl and after purge it was removed too.

I am not familiar with Linux and don't know much about it, but it seems like your lib can not work with ssl1.1 somehow. In such case I think that you need to provide some module-style includes, like it is done in boost library. Also I don't know should it solve a problem :D

Anyway good luck with this library! As a dev I can say that good docs/wiki pages and their enough amount will help your lib be more wide spreaded

shekharhimanshu commented 5 years ago

I am not familiar with Linux and don't know much about it, but it seems like your lib can not work with ssl1.1 somehow.

EasyHttp should build with OpenSSL 1.1 just fine. (Travis defaults to OpenSSL 1.0 yet, so tested it locally and was able to build)

libssl.so.1.1: error adding symbols: DSO missing from command line

This error could be due to other libraries you are linking, especially libcurl. EasyHttp has no dependency to libcurl.

The link you shared talks about dependencies between libcurl and OpenSSL version. So, if your application requires libcurl as well, then you may want to investigate errors due to libcurl separately.

I can help you diagnose the errors but will need more info to reproduce. Could you share more detailed build error log?

shekharhimanshu commented 5 years ago

Anyway good luck with this library! As a dev I can say that good docs/wiki pages and their enough amount will help your lib be more wide spreaded

Thanks! 👍 🍺

EZ-Phantom commented 5 years ago

At this point I am really sorry, but I have already changed my project many times. Deadline is near and a lot of work should be done by then.

Yeah, it seems like libcurl and EasyHttp may have conflicts and if dev wants to use them both he should be awared somehow, I think

shekharhimanshu commented 5 years ago

Good luck with your project. 👍

it seems like libcurl and EasyHttp may have conflicts

Just to be clear, libcurl and EasyHttp do not have any conflicts (dependencies might have depending upon your setup) as EasyHttp does not use it.

Anyways, feel free to close this issue if you do not have any other questions.