fbdtemme / torrenttools

Commandline tool for inspecting, creating and editing BitTorrent metafiles.
MIT License
200 stars 15 forks source link

Could not build on Debian Sid/testing #41

Open tkapias opened 2 years ago

tkapias commented 2 years ago

The current build fail at many steps.

  1. I assume that Bencode recently changed it's master branch to main. But the torrentools makefile still search for a master tag in external/bencode.cmake: GIT_TAG master

    • Solution: by changing it to "main".
  2. Then is fails because upstream errors with bencode compilation. I opened an issue about this upstream : Bencode: Build errors with deps and instructions

    • Current solution: by compiling and installing the deps manually.
  3. Then it fails because it does not find nlohmann/json.

    • Current solution: by compiling and installing manually.
      [ 81%] Building CXX object CMakeFiles/torrenttools.dir/src/common.cpp.o
      In file included from /home/tomasz/Builds/torrenttools/include/common.hpp:8,
               from /home/tomasz/Builds/torrenttools/src/common.cpp:4:
      /home/tomasz/Builds/torrenttools/include/tracker_database.hpp:11:10: fatal error: nlohmann/json.hpp: Aucun fichier ou dossier de ce type
      11 | #include <nlohmann/json.hpp>
      |          ^~~~~~~~~~~~~~~~~~~
      compilation terminated.
  4. Some compilation errors with a pattern in lines 50 & 65 of include/file_matcher.hpp :

    • Unresolved: I stopped here because I'm not good enough with C++
      
      [ 81%] Building CXX object CMakeFiles/torrenttools.dir/src/create.cpp.o                                                                                                                      
      In file included from /home/tomasz/Builds/torrenttools/src/create.cpp:22:                                                                                                                    
      /home/tomasz/Builds/torrenttools/include/file_matcher.hpp: In member function ‘void torrenttools::file_matcher::allow_extension(std::string_view)’:                                          
      /home/tomasz/Builds/torrenttools/include/file_matcher.hpp:50:31: error: unable to find string literal operator ‘operator""_format’ with ‘const char [7]’, ‘long unsigned int’ arguments      
      50 |         std::string pattern = ".*.{}$"_format(extension);                                                                                                                            
      |                               ^~~~~~~~~~~~~~~                                                                                                                                        
      /home/tomasz/Builds/torrenttools/include/file_matcher.hpp: In member function ‘void torrenttools::file_matcher::block_extension(std::string_view)’:                                          
      /home/tomasz/Builds/torrenttools/include/file_matcher.hpp:65:31: error: unable to find string literal operator ‘operator""_format’ with ‘const char [8]’, ‘long unsigned int’ arguments      
      65 |         std::string pattern = ".*\\.{}$"_format(extension);                                                                                                                          
      |                               ^~~~~~~~~~~~~~~~~


5. It's not an error but you should add this dependancy in the Readme : [termcontrol](https://github.com/fbdtemme/termcontrol) 
h1ght commented 11 months ago

did some1 solved this issue?

i added a backshla infront of " \"

Tr4il commented 10 months ago

I tried building torrenttools and ran into the same issues as OP (currently it doesn't build anywhere, not on Debian, not on anything), but I tried fixing issue number 4 in file_matcher.hpp This part errors out because fmt deprecated the _format function several versions ago. I did some digging and tried to fix it having absolutely 0 experience in c++, and ended up with this So, std::string pattern = ".*.{}$"_format(extension); becomes std::string pattern = fmt::format(".*.{}$", extension);

Only now, I'm running into a new issue, with:

In file included from /usr/include/fmt/format.h:49,
                 from /home/tr4il/torrenttools/src/info.cpp:3:
/usr/include/fmt/core.h: In instantiation of ‘constexpr decltype (ctx.begin()) fmt::v10::detail::parse_format_specs(ParseContext&) [with T = dottorrent::announce_url; ParseContext = compile_parse_context<char>; decltype (ctx.begin()) = const char*]’:
/usr/include/fmt/core.h:2639:51:   required from here
/home/tr4il/torrenttools/src/info.cpp:289:28:   in ‘constexpr’ expansion of ‘fmt::v10::basic_format_string<char, long unsigned int, const dottorrent::announce_url&>(tracker_tier_entry)’
/usr/include/fmt/core.h:2740:40:   in ‘constexpr’ expansion of ‘fmt::v10::detail::parse_format_string<true, char, format_string_checker<char, long unsigned int, dottorrent::announce_url> >(((fmt::v10::basic_format_string<char, long unsigned int, const dottorrent::announce_url&>*)this)->fmt::v10::basic_format_string<char, long unsigned int, const dottorrent::announce_url&>::str_, fmt::v10::detail::format_string_checker<char, long unsigned int, dottorrent::announce_url>(fmt::v10::basic_string_view<char>((* & s))))’
/usr/include/fmt/core.h:2489:44:   in ‘constexpr’ expansion of ‘fmt::v10::detail::parse_replacement_field<char, format_string_checker<char, long unsigned int, dottorrent::announce_url>&>((p + -1), end, (* & handler))’
/usr/include/fmt/core.h:2457:33:   in ‘constexpr’ expansion of ‘(& handler)->fmt::v10::detail::format_string_checker<char, long unsigned int, dottorrent::announce_url>::on_replacement_field((& handler)->fmt::v10::detail::format_string_checker<char, long unsigned int, dottorrent::announce_url>::on_arg_id(), begin)’
/usr/include/fmt/core.h:2632:20:   in ‘constexpr’ expansion of ‘((fmt::v10::detail::format_string_checker<char, long unsigned int, dottorrent::announce_url>*)this)->fmt::v10::detail::format_string_checker<char, long unsigned int, dottorrent::announce_url>::on_format_specs(id, begin, begin)’
/usr/include/fmt/core.h:2548:45: error: ‘fmt::v10::detail::type_is_unformattable_for<dottorrent::announce_url, char> _’ has incomplete type
 2548 |     type_is_unformattable_for<T, char_type> _;
      |                                             ^
/usr/include/fmt/core.h: In instantiation of ‘constexpr fmt::v10::detail::value<Context> fmt::v10::detail::make_arg(T&)[with bool PACKED = true; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; T = const dottorrent::announce_url; typename std::enable_if<PACKED, int>::type <anonymous> = 0]’:
/usr/include/fmt/core.h:1808:51:   required from ‘constexpr fmt::v10::format_arg_store<Context, Args>::format_arg_store(T& ...) [with T = {long unsigned int, const dottorrent::announce_url}; Context = fmt::v10::basic_format_context<fmt::v10::appender, char>; Args = {long unsigned int, dottorrent::announce_url}]’
/usr/include/fmt/core.h:1826:18:   required from ‘constexpr fmt::v10::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<T>::type>::type ...> fmt::v10::make_format_args(T& ...) [with Context = basic_format_context<appender, char>; T = {long unsigned int, const dottorrent::announce_url}]’
/usr/include/fmt/core.h:2788:44:   required from ‘std::string fmt::v10::format(format_string<T ...>, T&& ...) [with T = {long unsigned int, const dottorrent::announce_url&}; std::string = std::__cxx11::basic_string<char>; format_string<T ...> = basic_format_string<char, long unsigned int, const dottorrent::announce_url&>]’
/home/tr4il/torrenttools/src/info.cpp:289:28:   required from here
/usr/include/fmt/core.h:1576:63: error: ‘fmt::v10::detail::type_is_unformattable_for<const dottorrent::announce_url, char> _’ has incomplete type
 1576 |     type_is_unformattable_for<T, typename Context::char_type> _;
      |                                                               ^
/usr/include/fmt/core.h:1580:7: error: static assertion failed: Cannot format an argument. To make type T formattable provide a formatter<T> specialization: https://fmt.dev/latest/api.html#udt
 1580 |       formattable,
      |       ^~~~~~~~~~~
/usr/include/fmt/core.h:1580:7: note: ‘formattable’ evaluates to false
make[3]: *** [CMakeFiles/torrenttools.dir/build.make:216: CMakeFiles/torrenttools.dir/src/info.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1092: CMakeFiles/torrenttools.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1099: CMakeFiles/torrenttools.dir/rule] Error 2
make: *** [Makefile:564: torrenttools] Error 2

Which, as far as I can find, is another fmt related error. But I can't figure this one out.

Tr4il commented 8 months ago

Apologies for the double post, but I did some more digging into this now seemingly dead project and there is also a develop branch. Using vcpkg, that builds just fine! So, for whoever is still interested, here's the steps, tested on Debian Bookworm and Ubuntu 22.04.

  1. Install deps:

    sudo apt install git cmake libstdc++-12-dev g++ libssl-dev autoconf automake libtool nasm libtbb-dev pkg-config autoconf libtool ninja-build
  2. Clone vcpkg repo:

    git clone https://github.com/Microsoft/vcpkg.git

    Remember to insert the path to this folder later on

  3. Run bootstrap script:

    ./vcpkg/bootstrap-vcpkg.sh
  4. Clone torrenttools repo and checkout develop branch

    git clone https://github.com/fbdtemme/torrenttools
    cd torrenttools
    git checkout develop
  5. Prepare the build, don't forget the vcpkg path:

    cmake -S . -B cmake-build-debug --preset linux-isal -DCMAKE_TOOLCHAIN_FILE=[VCPKG-PATH]/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DTORRENTTOOLS_BUILD_TESTS=OFF
  6. Build it.

    cmake --build cmake-build-debug
  7. Congratulations, your build should be in cmake-build-debug/Debug!

    
    ./torrenttools --version
    torrenttools v0.7.0

Cryptographic backends: isa-l_crypto : 2.24.0 openssl : OpenSSL 3.0.11 19 Sep 2023