rimmartin / pion-ng

Pion Network Library (Boost licensed open source)
Boost Software License 1.0
1 stars 2 forks source link

Compile error on Fedora 32 #12

Closed martind1111 closed 4 years ago

martind1111 commented 4 years ago

Fedora 32 uses boost version 1.69 and there is a compile issue with the use of the asio API in one of the include files. The following line 296 in file include/pion/tcp/coonection.hpp causes a compile error:

boost::asio::ip::tcp::resolver resolver(m_ssl_socket.lowest_layer().get_executor());

should be replaced with:

boost::asio::ip::tcp::resolver resolver(m_ssl_socket.lowest_layer().get_executor().context());
trueqbit commented 4 years ago

Hmm, how exactly do you encounter a compile error? Even boost 1.74.0's boost::asio::ip::basic_resolver is still accepting both an executor and an executor context...

martind1111 commented 4 years ago

Here is the error that I encounter on Fedora 32 (I am not sure why the formatter puts some indentation and overstriked text, it should all be raw text; the important part is outlined in bold however): user@localhost ~/git $ git clone https://github.com/rimmartin/pion-ng.git Cloning into 'pion-ng'... remote: Enumerating objects: 229, done. remote: Counting objects: 100% (229/229), done. remote: Compressing objects: 100% (175/175), done. remote: Total 7590 (delta 128), reused 115 (delta 54), pack-reused 7361 Receiving objects: 100% (7590/7590), 37.52 MiB | 7.79 MiB/s, done. Resolving deltas: 100% (3813/3813), done. user@localhost ~/git $ cd pion-ng user@localhost ~/git/pion-ng (develop)$ mkdir cmake-build-release user@localhost ~/git/pion-ng (develop)$ cd cmake-build-release user@localhost ~/git/pion-ng/cmake-build-release (develop)$ cmake .. -- The CXX compiler identification is GNU 10.2.1 -- The C compiler identification is GNU 10.2.1 -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ - 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/cc -- Check for working C compiler: /usr/bin/cc - works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done CMAKE_CXX_COMPILER_VERSION = 10.2.1

Building Pion version: 5.0.7 EXECUTABLE_OUTPUT_PATH = /home/user/git/pion-ng/cmake-build-release/Bin/ -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found Boost: /usr/include (found version "1.69.0") found components: thread system filesystem regex unit_test_framework chrono date_time atomic -- Looking for C++ include unordered_map -- Looking for C++ include unordered_map - found -- Looking for malloc_trim -- Looking for malloc_trim - found -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11") -- Could NOT find BZip2 (missing: BZIP2_LIBRARIES BZIP2_INCLUDE_DIR) -- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.1.1g")
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) BUILD_ALLOWNOTHINGSERVICE = ON BUILD_COOKIESERVICE = ON BUILD_ECHOSERVICE = ON BUILD_FILESERVICE = ON BUILD_HELLOSERVICE = ON BUILD_LOGSERVICE = ON BUILD_PIOND = ON BUILD_HELLOSERVER = ON -- Configuring done -- Generating done -- Build files have been written to: /home/user/git/pion-ng/cmake-build-release user@localhost ~/git/pion-ng/cmake-build-release (develop)$ make Scanning dependencies of target pion [ 2%] Building CXX object src/CMakeFiles/pion.dir/admin_rights.cpp.o [ 5%] Building CXX object src/CMakeFiles/pion.dir/algorithm.cpp.o /home/user/git/pion-ng/src/algorithm.cpp: In static member function ‘static std::string pion::algorithm::url_encode(const string&)’: /home/user/git/pion-ng/src/algorithm.cpp:210:13: warning: this statement may fall through [-Wimplicit-fallthrough=] 210 | if (str[pos] > 32 && str[pos] < 127) { | ^~ /home/user/git/pion-ng/src/algorithm.cpp:216:9: note: here 216 | case ' ': | ^~~~ [ 8%] Building CXX object src/CMakeFiles/pion.dir/http_auth.cpp.o In file included from /home/user/git/pion-ng/include/pion/http/auth.hpp:21, from /home/user/git/pion-ng/src/http_auth.cpp:11: /home/user/git/pion-ng/include/pion/tcp/connection.hpp: In member function ‘boost::system::error_code pion::tcp::connection::connect(const string&, unsigned int)’: /home/user/git/pion-ng/include/pion/tcp/connection.hpp:296:91: error: no matching function for call to ‘boost::asio::ip::basic_resolver::basic_resolver(boost::asio::basic_socket::executor_type)’ 296 | ip::tcp::resolver resolver(m_ssl_socket.lowest_layer().get_executor()); | ^

In file included from /usr/include/boost/asio.hpp:80, from /home/user/git/pion-ng/include/pion/tcp/connection.hpp:25, from /home/user/git/pion-ng/include/pion/http/auth.hpp:21, from /home/user/git/pion-ng/src/http_auth.cpp:11: /usr/include/boost/asio/ip/basic_resolver.hpp:116:3: note: candidate: ‘boost::asio::ip::basic_resolver::basic_resolver(boost::asio::ip::basic_resolver&&) [with InternetProtocol = boost::asio::ip::tcp]’ 116 | basic_resolver(basic_resolver&& other) | ^~~~~~ /usr/include/boost/asio/ip/basic_resolver.hpp:116:35: note: no known conversion for argument 1 from ‘boost::asio::basic_socket::executor_type’ {aka ‘boost::asio::io_context::executor_type’} to ‘boost::asio::ip::basic_resolver&&’ 116 | basic_resolver(basic_resolver&& other) | ~~~^~~ /usr/include/boost/asio/ip/basic_resolver.hpp:100:12: note: candidate: ‘boost::asio::ip::basic_resolver::basic_resolver(boost::asio::io_context&) [with InternetProtocol = boost::asio::ip::tcp]’ 100 | explicit basic_resolver(boost::asio::io_context& io_context) | ^~~~~~ /usr/include/boost/asio/ip/basic_resolver.hpp:100:52: note: no known conversion for argument 1 from ‘boost::asio::basic_socket::executor_type’ {aka ‘boost::asio::io_context::executor_type’} to ‘boost::asio::io_context&’ 100 | explicit basic_resolver(boost::asio::io_context& io_context) | ~~~~~^~~~~~ In file included from /home/user/git/pion-ng/include/pion/http/auth.hpp:21, from /home/user/git/pion-ng/src/http_auth.cpp:11: /home/user/git/pion-ng/include/pion/tcp/connection.hpp: In member function ‘bool pion::tcp::connection::reset_ssl_flag()’: /home/user/git/pion-ng/include/pion/tcp/connection.hpp:604:60: warning: no return statement in function returning non-void [-Wreturn-type] 604 | inline bool reset_ssl_flag(void) { m_ssl_flag = false; } | ^ In file included from /home/user/git/pion-ng/include/pion/http/server.hpp:23, from /home/user/git/pion-ng/src/http_auth.cpp:12: /home/user/git/pion-ng/include/pion/tcp/server.hpp: In member function ‘virtual void pion::tcp::server::handle_ssl_handshake_error(const connection_ptr&, const boost::system::error_code&)’: /home/user/git/pion-ng/include/pion/tcp/server.hpp:222:78: warning: unused parameter ‘handshake_error’ [-Wunused-parameter] 222 | const boost::system::error_code& handshake_error) | ~~~~~~~^~~~~

make[2]: [src/CMakeFiles/pion.dir/build.make:109: src/CMakeFiles/pion.dir/http_auth.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:168: src/CMakeFiles/pion.dir/all] Error 2 make: *** [Makefile:150: all] Error 2

trueqbit commented 4 years ago

Thanks for the error output. As far as I see the executor types might not match - I'll look into this. Interesting and funny I don't see this error with Visual C++ 16.7! Are you only compiling the library itself or some of your code?

[side note: I suggest you pull from latest develop, because I have recently fixed the other warnings you are seeing related to the ssl handshake error handler).]

martind1111 commented 4 years ago

I am currently only compiling the library itself. I am then installing and using it with my code.

Have you updated the develop branch just now? Because the output you see is from cloning the develop branch of the current repo as of an hour ago. I am surprised that the warnings would still show up if you say they have been addressed in the develop branch.

trueqbit commented 4 years ago

That's now fixed in commit 42326a772f84. The boost asio revision history explicitly mentions some change in interface from boost 1.69 to 1.70 in this regard.

In regard to warnings about reset_ssl_flag() and handle_ssl_handshake_error() I updated the develop branch after I saw your error output.

martind1111 commented 4 years ago

Thanks! All clean now.

martind1111 commented 4 years ago

I wonder what is the process to push changes from the develop branch to the master branch.

trueqbit commented 4 years ago

@rimmartin mentioned in a comment that he wanted to revive the master branch and make it equal to develop. This this is formally not yet clear for me, I am still using the develop branch for development.