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

Need -pthread on some platforms if using an asio tcp_resolver #99

Open
mschout opened this issue Mar 30, 2017 · 0 comments
Open

Need -pthread on some platforms if using an asio tcp_resolver #99

mschout opened this issue Mar 30, 2017 · 0 comments

Comments

@mschout
Copy link

mschout commented Mar 30, 2017

I have found out the hard way that the following code:

boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver r(io_service);

will not link unless the -pthread flag is given on some platforms (at least FreeBSD and CentOS 7).

I am working around this with the following addition to boost.m4:

BOOST_ASIO_RESOLVER()

---------------------

tcp resolver requires the pthread flag for linking

BOOST_DEFUN([Asio_Resolver],
[AC_REQUIRE([_BOOST_PTHREAD_FLAG])
AC_SUBST([BOOST_ASIO_RESOLVER_LIBS], [$boost_cv_pthread_flag])
])

This allows me to set LDFLAGS (or libs) for programs that are using the resolver so they link correctly. Not sure if there is a better way to do this, but it solves the problem for me.

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

1 participant