sony / easyhttpcpp

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

Build instructions for EasyHttp Release 2.x.x? #13

Open serg06 opened 4 years ago

serg06 commented 4 years ago

Brief overview

I tried to build EasyHttp on Windows using the wiki guide. It worked for EasyHttp 1.0.0, but not for 2.0.0 or 2.1.0.

First I was getting this error:

CMake Error at C:/repo/poco/NetSSL_Win/cmake/PocoNetSSLWinConfig.cmake:5 (include):
  include could not find load file:

    C:/repo/poco/NetSSL_Win/cmake/PocoNetSSLWinTargets.cmake

I fixed it by changing my Poco CMake command to this:

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_NETSSL_WIN=ON ../

But now I have a new issue when I try to build:

C:\repo\easyhttpcpp\_build>cmake -DCMAKE_PREFIX_PATH="C:/repo/poco/_build" ..
-- Configuring done
CMake Warning:
  Value of CMAKE_CXX_FLAGS_DEBUG contained a newline; truncating

CMake Warning:
  Value of CMAKE_CXX_FLAGS_MINSIZEREL contained a newline; truncating

CMake Warning:
  Value of CMAKE_CXX_FLAGS_RELEASE contained a newline; truncating

CMake Warning:
  Value of CMAKE_CXX_FLAGS_RELWITHDEBINFO contained a newline; truncating

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::NetSSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::NetSSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::NetSSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::NetSSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::NetSSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "Poco::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::SSL" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

CMake Error at CMakeLists.txt:105 (add_library):
  Target "easyhttp" links to target "OpenSSL::Crypto" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

-- Generating done
CMake Generate step failed.  Build files cannot be regenerated correctly.

C:\repo\easyhttpcpp\_build>

What am I doing wrong?

Steps to reproduce

Specifications like the version of the project, operating system, or hardware etc.

EasyHttp Release 2.1.0.

Poco 1.7.9.

Windows 10 x64 on a Dell G3 laptop.

shekharhimanshu commented 4 years ago

Hi @serg06

I am sorry for not updating the Wiki after 2.x.x release.

For building EasyHttp 2.x.x on Windows, here are the steps (will update Wiki once this issue is fixed):

  1. Install Poco:

When installing Poco, please make sure to use the following settings (especially note this part -DENABLE_NET=ON -DENABLE_NETSSL=OFF -DENABLE_NETSSL_WIN=ON -DENABLE_CRYPTO=OFF)

Please change %PATH_TO_INSTALL_FOLDER%

C:\> cmake -G "Visual Studio %CMAKE_VS_VERSION%" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DPOCO_VERBOSE_MESSAGES=OFF -DPOCO_STATIC=ON -DPOCO_UNBUNDLED=OFF -DENABLE_XML=ON -DENABLE_JSON=ON -DENABLE_UTIL=ON -DENABLE_NET=ON -DENABLE_NETSSL=OFF -DENABLE_NETSSL_WIN=ON -DENABLE_CRYPTO=OFF -DENABLE_DATA=ON -DENABLE_DATA_SQLITE=ON -DENABLE_ZIP=OFF -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_ODBC=OFF -DENABLE_MONGODB=OFF -DENABLE_PDF=OFF -DENABLE_SEVENZIP=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=OFF -DENABLE_TESTS=OFF -DCMAKE_INSTALL_PREFIX="%PATH_TO_INSTALL_FOLDER%" ../
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" Poco.sln
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" INSTALL.vcxproj
  1. Use installed Poco when building EasyHttp: Please change %PATH_TO_INSTALL_FOLDER%
C:\> cmake -G "Visual Studio %CMAKE_VS_VERSION%" -DCMAKE_BUILD_TYPE=Release -DEASYHTTPCPP_VERBOSE_MESSAGES=ON -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_PREFIX_PATH="%PATH_TO_INSTALL_FOLDER%" -DENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX="%PATH_TO_INSTALL_FOLDER%" ../
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" easyhttpcpp.sln
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" INSTALL.vcxproj

Let me know if this works.

serg06 commented 4 years ago

Hi @shekharhimanshu, thanks for the reply.

I tried building Poco 1.7.9 and EasyHttpCpp 2.1.0 with those commands. All the Poco steps worked perfectly, but the EasyHttpCpp cmake step failed.

Here's the command, with %PATH_TO_INSTALL_FOLDER% replaced with the same value as I used in the Poco cmake command:

cmake -DCMAKE_BUILD_TYPE=Release -DEASYHTTPCPP_VERBOSE_MESSAGES=ON -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_PREFIX_PATH="C:/lib/easyhttpcpp" -DENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX="C:/lib/easyhttpcpp" ../

And the error:

-- Building static easyhttpcpp libraries
CMake Error at tests/CMakeLists.txt:7 (find_package):
  Could not find a package configuration file provided by "GMock" with any of
  the following names:

    GMockConfig.cmake
    gmock-config.cmake

  Add the installation prefix of "GMock" to CMAKE_PREFIX_PATH or set
  "GMock_DIR" to a directory containing one of the above files.  If "GMock"
  provides a separate development package or SDK, be sure it has been
  installed.

-- Configuring incomplete, errors occurred!
shekharhimanshu commented 4 years ago

My bad. Sorry about that.

We need googletest for testing purposes. In step 2, kindly turn off tests, -DENABLE_TESTS=ON -> -DENABLE_TESTS=OFF.

  1. Use installed Poco when building EasyHttp: Please change %PATH_TO_INSTALL_FOLDER%
C:\> cmake -G "Visual Studio %CMAKE_VS_VERSION%" -DCMAKE_BUILD_TYPE=Release -DEASYHTTPCPP_VERBOSE_MESSAGES=ON -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_PREFIX_PATH="%PATH_TO_INSTALL_FOLDER%" -DENABLE_TESTS=OFF -DCMAKE_INSTALL_PREFIX="%PATH_TO_INSTALL_FOLDER%" ../
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" easyhttpcpp.sln
C:\> "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe" INSTALL.vcxproj

If you wish to build EasyHttp tests as well, please install GoogleTest as well. Let me know if this works.