tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.23k stars 1.47k forks source link

CMake Error include could not find load file TdTargets.cmake #504

Closed shpi0 closed 5 years ago

shpi0 commented 5 years ago

Hello! I'm trying to build TDLib on Debian 9. There are steps I'm doing:

  1. cd /usr/lib
  2. git clone https://github.com/tdlib/td.git
  3. cd td, mkdir jnibuild, cd jnibuild
  4. CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..

-- The CXX compiler identification is Clang 3.8.1 -- The C compiler identification is Clang 3.8.1 -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /usr/bin/clang -- Check for working C compiler: /usr/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Found ccache -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.0j") -- Found OpenSSL: /usr/include /usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so -- Performing Test HAVE_STD14 -- Performing Test HAVE_STD14 - Success -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE
-- Performing Test HAVE_CXX_FLAG_WALL -- Performing Test HAVE_CXX_FLAG_WALL - Success -- Performing Test HAVE_CXX_FLAG_WEXTRA -- Performing Test HAVE_CXX_FLAG_WEXTRA - Success -- Performing Test HAVE_CXX_FLAG_WIMPLICIT_FALLTHROUGH_2 -- Performing Test HAVE_CXX_FLAG_WIMPLICIT_FALLTHROUGH_2 - Failed -- Performing Test HAVE_CXX_FLAG_WPOINTER_ARITH -- Performing Test HAVE_CXX_FLAG_WPOINTER_ARITH - Success -- Performing Test HAVE_CXX_FLAG_WCAST_QUAL -- Performing Test HAVE_CXX_FLAG_WCAST_QUAL - Success -- Performing Test HAVE_CXX_FLAG_WSIGN_COMPARE -- Performing Test HAVE_CXX_FLAG_WSIGN_COMPARE - Success -- Performing Test HAVE_CXX_FLAG_WDUPLICATED_BRANCHES -- Performing Test HAVE_CXX_FLAG_WDUPLICATED_BRANCHES - Failed -- Performing Test HAVE_CXX_FLAG_WDUPLICATED_COND -- Performing Test HAVE_CXX_FLAG_WDUPLICATED_COND - Failed -- Performing Test HAVE_CXX_FLAG_WALLOC_ZERO -- Performing Test HAVE_CXX_FLAG_WALLOC_ZERO - Failed -- Performing Test HAVE_CXX_FLAG_WLOGICAL_OP -- Performing Test HAVE_CXX_FLAG_WLOGICAL_OP - Failed -- Performing Test HAVE_CXX_FLAG_WTAUTOLOGICAL_COMPARE -- Performing Test HAVE_CXX_FLAG_WTAUTOLOGICAL_COMPARE - Success -- Performing Test HAVE_CXX_FLAG_WVLA -- Performing Test HAVE_CXX_FLAG_WVLA - Success -- Performing Test HAVE_CXX_FLAG_WNON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_FLAG_WNON_VIRTUAL_DTOR - Success -- Performing Test HAVE_CXX_FLAG_WUNUSED_PARAMETER -- Performing Test HAVE_CXX_FLAG_WUNUSED_PARAMETER - Success -- Performing Test HAVE_CXX_FLAG_WCONVERSION -- Performing Test HAVE_CXX_FLAG_WCONVERSION - Success -- Performing Test HAVE_CXX_FLAG_WSIGN_CONVERSION -- Performing Test HAVE_CXX_FLAG_WSIGN_CONVERSION - Success -- Performing Test HAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC -- Performing Test HAVE_CXX_FLAG_WCXX14_COMPAT_PEDANTIC - Success -- Performing Test HAVE_CXX_FLAG_WDEPRECATED -- Performing Test HAVE_CXX_FLAG_WDEPRECATED - Success -- Performing Test HAVE_CXX_FLAG_QUNUSED_ARGUMENTS -- Performing Test HAVE_CXX_FLAG_QUNUSED_ARGUMENTS - Success -- Performing Test HAVE_CXX_FLAG_WODR -- Performing Test HAVE_CXX_FLAG_WODR - Success -- Performing Test HAVE_CXX_FLAG_FLTO_ODR_TYPE_MERGING -- Performing Test HAVE_CXX_FLAG_FLTO_ODR_TYPE_MERGING - Failed -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") -- Found ZLIB: /usr/include /usr/lib/x86_64-linux-gnu/libz.so -- Found JNI: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so
-- Found JNI: /usr/lib/jvm/java-8-oracle/include;/usr/lib/jvm/java-8-oracle/include/linux;/usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success -- Performing Test COMPILER_HAS_DEPRECATED_ATTR -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success -- Performing Test GNU_READLINE_FOUND -- Performing Test GNU_READLINE_FOUND - Success -- Found Readline: /usr/include
-- Found Readline: /usr/include /usr/lib/x86_64-linux-gnu/libreadline.so -- Configuring done -- Generating done -- Build files have been written to: /usr/lib/td/jnibuild

  1. cmake --build . --target install

Scanning dependencies of target generate_mime_types_gperf [ 0%] Building CXX object tdutils/generate/CMakeFiles/generate_mime_types_gperf.dir/generate_mime_types_gperf.cpp.o [ 0%] Linking CXX executable generate_mime_types_gperf [ 0%] Built target generate_mime_types_gperf Scanning dependencies of target tdmime_auto [ 1%] Generating ../../../tdutils/generate/auto/mime_type_to_extension.gperf, ../../../tdutils/generate/auto/extension_to_mime_type.gperf Extension "wmz" matches more than one type Extension "sub" matches more than one type [ 1%] Generating ../../../tdutils/generate/auto/mime_type_to_extension.cpp [ 1%] Generating ../../../tdutils/generate/auto/extension_to_mime_type.cpp [ 1%] Built target tdmime_auto Scanning dependencies of target tdutils [ 1%] Building CXX object tdutils/CMakeFiles/tdutils.dir/td/utils/port/Clocks.cpp.o ........ [100%] Building CXX object benchmark/CMakeFiles/bench_queue.dir/bench_queue.cpp.o [100%] Linking CXX executable bench_queue [100%] Built target bench_queue Install the project... -- Install configuration: "Release" -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdjson.so -- Set runtime path of "../example/java/td/lib/libtdjson.so" to "" -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdjson_static.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdjson_private.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdclient.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdcore.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/cmake/Td/TdTargets.cmake -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/cmake/Td/TdTargets-release.cmake -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/td_json_client.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/td_log.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/tdjson_export.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/Client.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/Log.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/tl/TlObject.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/td_api.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/telegram/td_api.hpp -- Installing: /usr/lib/td/jnibuild/../example/java/td/include/td/tl/tl_jni_object.h -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/cmake/Td/TdConfig.cmake -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/cmake/Td/TdConfigVersion.cmake -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdutils.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/bin/td_generate_java_api -- Installing: /usr/lib/td/jnibuild/../example/java/td/bin/td/generate/JavadocTlDocumentationGenerator.php -- Installing: /usr/lib/td/jnibuild/../example/java/td/bin/td/generate/TlDocumentationGenerator.php -- Installing: /usr/lib/td/jnibuild/../example/java/td/bin/td/generate/scheme/td_api.tlo -- Installing: /usr/lib/td/jnibuild/../example/java/td/bin/td/generate/scheme/td_api.tl -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdactor.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdnet.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtdsqlite.a -- Installing: /usr/lib/td/jnibuild/../example/java/td/lib/libtddb.a

This complete without any errors. And after that I'm trying do that:

  1. cd /usr/lib/td/example/java
  2. mkdir build
  3. cd build
  4. CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=Release -Dtd_DIR=/usr/lib/td/example/java/td/lib/cmake/Td -DCMAKE_INSTALL_PREFIX:PATH=.. ..

and I got this error:

-- The CXX compiler identification is Clang 3.8.1 -- Check for working CXX compiler: /usr/bin/clang++ -- Check for working CXX compiler: /usr/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at /usr/lib/td/TdConfig.cmake:3 (include): include could not find load file:

/usr/lib/td/TdTargets.cmake

Call Stack (most recent call first): CMakeLists.txt:5 (find_package)

-- Found JNI: /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so
-- Found JNI: /usr/lib/jvm/java-8-oracle/include;/usr/lib/jvm/java-8-oracle/include/linux;/usr/lib/jvm/java-8-oracle/include /usr/lib/jvm/java-8-oracle/jre/lib/amd64/libjawt.so;/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libjvm.so -- Found Java: /usr/lib/jvm/java-8-oracle/bin/java (found suitable version "1.8.0.201", minimum required is "1.6") -- Found Java: /usr/lib/jvm/java-8-oracle/bin/javac /usr/lib/jvm/java-8-oracle/bin/javadoc -- Configuring incomplete, errors occurred! See also "/usr/lib/td/example/java/build/CMakeFiles/CMakeOutput.log".

I found a file /usr/lib/td/TdConfig.cmake, it consist:

include(CMakeFindDependencyMacro)

TODO: write all external dependencies

include("${CMAKE_CURRENT_LIST_DIR}/TdTargets.cmake")

I've tried to comment 3rd line, but after that I got another errors on step 9. What am I doing wrong? Thanks!

levlam commented 5 years ago

There is a misprint in line 9: "-Dtd_DIR" instead of "-DTd_DIR".

shpi0 commented 5 years ago

Thank you so much!