Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu boost error #384

Open
exru opened this issue Sep 8, 2020 · 6 comments
Open

Ubuntu boost error #384

exru opened this issue Sep 8, 2020 · 6 comments

Comments

@exru
Copy link

exru commented Sep 8, 2020

crow_all.h:3353: error: ‘boost::asio::ip::tcp::socket’ {aka ‘class boost::asio::basic_stream_socketboost::asio::ip::tcp’} 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_socketboost::asio::ip::tcp’} has no member named ‘get_io_service’
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).

#include "crow_all.h"

##
int main()
{
    crow::SimpleApp app;

    CROW_ROUTE(app, "/")([](){
        return "Hello world";
    });

    app.port(18080).multithreaded().run();
}
@mrozigor
Copy link

mrozigor commented Sep 8, 2020

#374 (comment)

@frsauvage
Copy link

frsauvage commented Nov 15, 2020

Hi,
Same on centos8 with latest crow_all.hpp (ninja error):

image

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

@The-EDev
Copy link

@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.

@frsauvage
Copy link

frsauvage commented Nov 16, 2020

Hi @The-EDev, thanks,
That's the point. I didn't notice that incompatibility before.
I should use a lower version,
Regards,

@asciphx
Copy link

asciphx commented Jun 22, 2021

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());
	}

GerHobbelt pushed a commit to GerHobbelt/crow that referenced this issue Apr 13, 2022
@mwycliff0001
Copy link

mwycliff0001 commented Nov 26, 2022

@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 [email protected]: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 CrowCpp/Crow#560 from okaestne/fix-memleaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants