Open exru opened 3 years ago
Hi, Same on centos8 with latest crow_all.hpp (ninja error):
source:
#include "include/crow_all.h"
int main()
{
crow::SimpleApp _app;
CROW_ROUTE(_app, "/")( []() {
return "Hello World";
});
_app.port(80).multithreaded().run();
}
meson.build:
project('crow_tuto', 'cpp')
cxx = meson.get_compiler('cpp')
boost = dependency('boost',version : '>=1.73.0', required : false)
if not boost.found()
boost_inc = include_directories('boost/', is_system:true)
boost = declare_dependency(include_directories : boost_inc)
endif
executable('hello_world', 'hello_world.cpp', dependencies : boost)
Regards, ..Francine
@frsauvage This version of crow is incompatible with boost 1.70 or later
, you'll need to use a lower version.
If you'd like a version compatible with 1.70 or later, take a look at this.
Note: regarding the meson.build
, the boost dependency is absolutely required, crow will not run without boost. I'm not sure how meson works but I thought I should point it out.
Hi @The-EDev, thanks, That's the point. I didn't notice that incompatibility before. I should use a lower version, Regards,
Hi @The-EDev, thanks, That's the point. I didn't notice that incompatibility before. I should use a lower version, Regards,
@frsauvage You can change socket_adaptors.hpp
#if BOOST_VERSION >= 107000
#define GET_IO_SERVICE(s) ((boost::asio::io_context&)(s).get_executor().context())
#else
#define GET_IO_SERVICE(s) ((s)->get_io_service())
#endif
and
boost::asio::io_service& get_io_service() {
return GET_IO_SERVICE(socket_);
}
......
boost::asio::io_service& get_io_service() {
return GET_IO_SERVICE(raw_socket());
}
@The-EDev It worked. Thank you very much! For clarification, here is what I did in order to get the helloworld example to build and run properly:
$ git clone git@github.com:CrowCpp/Crow.git $ cd Crow && mkdir build && cd build $ cmake .. $ make $ cd examples/ $ ./helloworld Open up a new browser window/tab. In the address bar type: http://0.0.0.0:18080 Hit ENTER
You should see a plain text html 'Hello World' in the browser window.
If you are running this on Ubuntu 20-or-higher ( I'm running on Ubuntu 20.04), make sure that you already have these dependencies before building/running: sudo apt-get install build-essential libboost-dev libboost-system-dev libasio-dev sudo apt install libboost-system1.71-dev # OR WHICHEVER one is the latest version
Just for reference, Igor Mróz was the most recent contributor when I wrote this comment. Igor Mróz
Nov 8, 2022 Merge pull request https://github.com/CrowCpp/Crow/pull/560 from okaestne/fix-memleaks
crow_all.h:3353: error: ‘boost::asio::ip::tcp::socket’ {aka ‘class boost::asio::basic_stream_socket’} has no member named ‘get_io_service’
main.cpp:1:
crow_all.h: In member function ‘boost::asio::io_service& crow::SocketAdaptor::get_io_service()’:
crow_all.h:3353:28: error: ‘boost::asio::ip::tcp::socket’ {aka ‘class boost::asio::basic_stream_socket’} has no member named ‘get_ioservice’
3353 | return socket.get_io_service();
Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)
cmake version 3.16.3 CMake suite maintained and supported by Kitware (kitware.com/cmake).