0

I want to build the following project: https://github.com/reo7sp/tgbot-cpp

I get these errors: https://imgur.com/S9kgWyv

Makefile part 1: https://imgur.com/O222bJR

Makefile part 2: https://imgur.com/i68QLdC

Now, I think that I need zlib, openssl and boost. Curl seems to be optional.

What is "threads"?

And what is the difference between ...LIBRARY_DEBUG and ...LIBRARY_RELEASE?

What doe LIB and SSL mean in the gui? These "libraries" are not mentioned in the makefile?

I am desperate for days now. Please, help me.

Error:

CMake Error at D:/Programme/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY) (found
  version "1.1.0j")
Call Stack (most recent call first):
  D:/Programme/CMake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  D:/Programme/CMake/share/cmake-3.13/Modules/FindOpenSSL.cmake:412 (find_package_handle_standard_args)
  CMakeLists.txt:47 (find_package)

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.4)
project(TgBot)

if (${CONAN_EXPORTED})
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
    conan_basic_setup()
endif()

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# options
option(ENABLE_TESTS "Set to ON to enable building of tests" OFF)
option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)

# sources
if(WIN32)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")  # Do not activate all warnings in VS (too much output for Appveyor)
else()
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
endif()

include_directories(include)
set(SRC_LIST
    src/Api.cpp
    src/EventHandler.cpp
    src/TgException.cpp
    src/TgTypeParser.cpp
    src/net/BoostHttpOnlySslClient.cpp
    src/net/CurlHttpClient.cpp
    src/net/HttpParser.cpp
    src/net/TgLongPoll.cpp
    src/net/Url.cpp
    src/tools/FileTools.cpp
    src/tools/StringTools.cpp
    src/types/InlineQueryResult.cpp
    src/types/InputFile.cpp
)

# libs
## threads
find_package(Threads REQUIRED)

# zlib
find_package(ZLIB REQUIRED)

## openssl
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

## curl
find_package(CURL)
if (CURL_FOUND)
    include_directories(${CURL_INCLUDE_DIRS})
    add_definitions(-DHAVE_CURL)
endif()

## boost
set(Boost_USE_MULTITHREADED ON)
if (ENABLE_TESTS)
    find_package(Boost 1.59.0 COMPONENTS system unit_test_framework REQUIRED)
else()
    find_package(Boost 1.59.0 COMPONENTS system REQUIRED)
endif()
include_directories(${Boost_INCLUDE_DIR})

set(LIB_LIST
    ${CMAKE_THREAD_LIBS_INIT}
    ${ZLIB_LIBRARIES}
    ${OPENSSL_LIBRARIES}
    ${Boost_LIBRARIES}
    ${CURL_LIBRARIES}
)

# building project
add_library(${PROJECT_NAME} ${SRC_LIST})
target_include_directories(${PROJECT_NAME} PUBLIC include)
target_link_libraries(${PROJECT_NAME} ${LIB_LIST})
install(TARGETS ${PROJECT_NAME}
        RUNTIME DESTINATION bin
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib)
install(DIRECTORY include/ DESTINATION include)

# tests
if (ENABLE_TESTS)
    message(STATUS "Building of tests is enabled")
    enable_testing()
    add_subdirectory(test)
endif()
Tsyvarev
  • 45,732
  • 15
  • 64
  • 98
Spixmaster
  • 113
  • 1
  • 2
  • 10
  • The error message indicates a problem with your openssl. Follow the advice of the error message. – drescherjm Jan 25 '19 at 18:56
  • ***And what is the difference between ...LIBRARY_DEBUG and ...LIBRARY_RELEASE?*** In Visual Studio the debug configuration is incompatible with the release configuration (well at least for c++) so in most cases you need separate binaries for the debug configuration and the release configuration. – drescherjm Jan 25 '19 at 18:59
  • I know. Is "G:\Programmieren (C++)\Bibliotheken\OpenSSL-Win64\include" even right? Where do I need to put this? In "Ungrouped Entries" > "OPENSSL_INCLUDE_DIR" or "SSL" > ... – Spixmaster Jan 25 '19 at 19:02
  • ***"G:\Programmieren (C++)\Bibliotheken\OpenSSL-Win64\include" even right?*** I have no access to your PC to verify.. – drescherjm Jan 25 '19 at 19:04
  • ***Where do I need to put this? In "Ungrouped Entries" > "OPENSSL_INCLUDE_DIR" or "SSL"*** Neither of those. – drescherjm Jan 25 '19 at 19:04
  • The error message says set the `OPENSSL_ROOT_DIR` system variable to the path. http://www.forbeslindesay.co.uk/post/42833119552/permanently-set-environment-variables-on-windows or https://stackoverflow.com/questions/32463212/how-to-set-environment-variables-from-windows – drescherjm Jan 25 '19 at 19:06
  • From your picture you are also missing boost – drescherjm Jan 25 '19 at 19:09
  • Like this: https://imgur.com/yu6xCd5 ??? – Spixmaster Jan 25 '19 at 19:14
  • Sorry, but I am completely new to this and do not find any instructions. Thank you very much drescherjim either way! – Spixmaster Jan 25 '19 at 19:15
  • If that is the correct path yes. You may need to logout for that to work. – drescherjm Jan 25 '19 at 19:15
  • I expect the software assumes you have experience with `CMake` and understand what the error messages are telling you. – drescherjm Jan 25 '19 at 19:16
  • Even after a restart the error remains the same. – Spixmaster Jan 25 '19 at 19:23
  • I assume you regenerated. I am not sure why it does will not detect the openssl you have installed on the g: drive given the path. – drescherjm Jan 25 '19 at 19:26
  • 1
    Welcome to Stack Overflow! Here we expect the code and the error message to be **in the question post** as **text**. Please, paste the code and the error message directly into the question post. After pasting, you may format them with `Ctrl+K` or `{}` button. – Tsyvarev Jan 25 '19 at 19:35
  • You may want to look at the instructions for the OpenSSL module. Type the following in a cmd.exe window: `cmake --help-module FindOpenSSL` if that does not help I would search for the FindOpenSSL.cmake flle in the installed `CMake` binaries to see exactly what it is looking for. – drescherjm Jan 25 '19 at 19:44
  • I think this means it found OpenSSL but it could not find the crypto library. – drescherjm Jan 25 '19 at 20:03

1 Answers1

0

It turned out that I needed to set some system variables for OpenSSL, ZLib, Boost, curl. For Zlib just do the same procedure. drescherjm was a huge help. So thanks!

Tutorial for this:

OpenSSL: https://www.youtube.com/watch?v=3I7eL2Mm6Ps&index=34&t=0s&list=PLcmZ3Jkh7taY1ensPUAJ4VfMEicDcihhg

and

curl: How do I install and use curl on Windows?

Setting up curl library path in cmake

Spixmaster
  • 113
  • 1
  • 2
  • 10
  • Nervertheless, Boost is making problems now: I opened a new question: https://stackoverflow.com/questions/54378962/could-not-find-the-following-boost-libraries-boost-system – Spixmaster Jan 26 '19 at 15:26