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

Boost 1.61 hides fcontext #4270

Closed
Habbie opened this issue Aug 2, 2016 · 13 comments
Closed

Boost 1.61 hides fcontext #4270

Habbie opened this issue Aug 2, 2016 · 13 comments

Comments

@Habbie
Copy link
Member

Habbie commented Aug 2, 2016

Which means Recursor cannot use Boost Context on 1.61 and up.

@Habbie Habbie added this to the rec-4.0.x milestone Aug 2, 2016
@Habbie Habbie mentioned this issue Aug 2, 2016
@phonedph1
Copy link
Contributor

phonedph1 commented Aug 8, 2016

We've worked around this in our build by doing the following hack:

07:41 < ph1> Hey HAbbie, this is all we do to make boost 1.61 work for us: cp ${RPM_BUILD_DIR}/%{name}-%{version}/boost_1_61_0/boost/context/detail/fcontext.hpp 
             ${RPM_BUILD_DIR}/%{name}-%{version}/boost_1_61_0/boost/context/fcontext.hpp
07:41 < ph1> ./configure --with-boost=${RPM_BUILD_DIR}/%{name}-%{version}/boost_1_61_0/ --prefix=/usr --sysconfdir=/etc/powerdns

@Habbie
Copy link
Member Author

Habbie commented Aug 11, 2016

ph1's hack does not work for me on osx with brew boost 1.61.0:

In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:8:7: error: no member named 'make_fcontext' in namespace 'boost::context'; did you mean 'boost::context::detail::make_fcontext'?
using boost::context::make_fcontext;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::make_fcontext
/usr/local/include/boost/context/fcontext.hpp:33:12: note: 'boost::context::detail::make_fcontext' declared here
fcontext_t make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) );
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:39:7: error: no member named 'fcontext_t' in namespace 'boost::context'; did you mean 'boost::context::detail::fcontext_t'?
using boost::context::fcontext_t;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::fcontext_t
/usr/local/include/boost/context/fcontext.hpp:23:15: note: 'boost::context::detail::fcontext_t' declared here
typedef void* fcontext_t;
              ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:40:7: error: no member named 'jump_fcontext' in namespace 'boost::context'; did you mean 'boost::context::detail::jump_fcontext'?
using boost::context::jump_fcontext;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      boost::context::detail::jump_fcontext
/usr/local/include/boost/context/fcontext.hpp:31:12: note: 'boost::context::detail::jump_fcontext' declared here
transfer_t jump_fcontext( fcontext_t const to, void * vp);
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:71:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/fcontext.hpp:31:12: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t jump_fcontext( fcontext_t const to, void * vp);
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:84:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/fcontext.hpp:31:12: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t jump_fcontext( fcontext_t const to, void * vp);
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:107:9: error: no matching function for call to 'jump_fcontext'
    if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
        ^~~~~~~~~~~~~
/usr/local/include/boost/context/fcontext.hpp:31:12: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t jump_fcontext( fcontext_t const to, void * vp);
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:119:23: error: no matching function for call to 'make_fcontext'
    ctx.uc_mcontext = make_fcontext (&ctx.uc_stack[ctx.uc_stack.size()],
                      ^~~~~~~~~~~~~
/usr/local/include/boost/context/fcontext.hpp:33:12: note: candidate function not viable: no known conversion from 'void (*)(const intptr_t)' to 'void (*)(boost::context::detail::transfer_t)' for 3rd argument
fcontext_t make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) );
           ^
In file included from mtasker_context.cc:6:
./mtasker_fcontext.cc:124:5: error: no matching function for call to 'jump_fcontext'
    jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
    ^~~~~~~~~~~~~
/usr/local/include/boost/context/fcontext.hpp:31:12: note: candidate function not viable: requires 2 arguments, but 3 were provided
transfer_t jump_fcontext( fcontext_t const to, void * vp);
           ^
8 errors generated.
make[2]: *** [mtasker_context.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

@phonedph1
Copy link
Contributor

Yeah - I double checked my config log here. It works enough to find boost using this (which I believe I was having troubles with before), but the actual context ends up linking to system v ucontexts instead because nothing actually works.

Looks like this part was fixed in #4052

@Habbie
Copy link
Member Author

Habbie commented Aug 11, 2016

Ah!

@pieterlexis
Copy link
Contributor

duplicate of #4053 ?

@AdamMajer
Copy link
Contributor

ok, if that is duplicate, then this needs to be reopened. It is more than simply namespace changes.
jump_fcontext has different API

@ahupowerdns ahupowerdns reopened this Sep 7, 2016
@pieterlexis
Copy link
Contributor

I've noticed 😿

@anthraxx
Copy link

anthraxx commented Sep 8, 2016

The root problem of the include hack mentioned by @phonedph1 is a wrong boost version check, I created a pull request (#4446) to fix the include (the fcontext incompatibility itself is still there)

@phonedph1
Copy link
Contributor

@anthraxx the boost version header also needs to be included before the check. Also my hack was because the configure script wasn't picking it up properly - this part is indeed fixed now.

@anthraxx
Copy link

anthraxx commented Sep 8, 2016

@phonedph1 good spot, for me it was already defined but technically you are correct: adjusted the pull request (#4446).
However for such patch related feedback please use the according pull-request next time 😋 I just left this message here to provide a "solution" to your hack and to reference the two issue/pull-request to each other 😸

@ncopa
Copy link

ncopa commented Oct 20, 2016

Build fails on Alpine Linux (musl libc) too with boost-1.62.0. Since musl does not implement ucontext we can not either fall back to ucontext.

the boost 1.61.0 release notes says that "fcontext_t: no longer part of public API" so fcontext_t can no longer be used.

I don't know what the way forward is.

  CXX      mtasker_context.o
In file included from mtasker_context.cc:27:0:
mtasker_fcontext.cc:33:23: error: 'boost::context::make_fcontext' has not been declared
 using boost::context::make_fcontext;
                       ^~~~~~~~~~~~~
mtasker_fcontext.cc:64:23: error: 'boost::context::fcontext_t' has not been declared
 using boost::context::fcontext_t;
                       ^~~~~~~~~~
mtasker_fcontext.cc:65:23: error: 'boost::context::jump_fcontext' has not been declared
 using boost::context::jump_fcontext;
                       ^~~~~~~~~~~~~
mtasker_fcontext.cc:67:32: error: 'fcontext_t' was not declared in this scope
 static_assert (std::is_pointer<fcontext_t>::value,
                                ^~~~~~~~~~
mtasker_fcontext.cc:67:32: note: suggested alternative:
In file included from mtasker_fcontext.cc:27:0,
                 from mtasker_context.cc:27:
/usr/include/boost/context/detail/fcontext.hpp:23:17: note:   'boost::context::detail::fcontext_t'
 typedef void*   fcontext_t;
                 ^~~~~~~~~~
In file included from mtasker_context.cc:27:0:
mtasker_fcontext.cc:67:42: error: template argument 1 is invalid
 static_assert (std::is_pointer<fcontext_t>::value,
                                          ^
mtasker_fcontext.cc:75:5: error: 'fcontext_t' does not name a type
     fcontext_t prev_ctx = nullptr;
     ^~~~~~~~~~
mtasker_fcontext.cc: In function 'void threadWrapper(intptr_t)':
mtasker_fcontext.cc:96:37: error: 'fcontext_t' does not name a type
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                     ^~~~~~~~~~
mtasker_fcontext.cc:96:47: error: expected '>' before '*' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                               ^
mtasker_fcontext.cc:96:47: error: expected '(' before '*' token
mtasker_fcontext.cc:96:48: error: expected primary-expression before '>' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                                ^
mtasker_fcontext.cc:97:32: error: 'fcontext_t' does not name a type
                    static_cast<fcontext_t>(args->prev_ctx), 0);
                                ^~~~~~~~~~
mtasker_fcontext.cc:97:50: error: 'struct args_t' has no member named 'prev_ctx'
                    static_cast<fcontext_t>(args->prev_ctx), 0);
                                                  ^~~~~~~~
mtasker_fcontext.cc:109:37: error: 'fcontext_t' does not name a type
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                     ^~~~~~~~~~
mtasker_fcontext.cc:109:47: error: expected '>' before '*' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                               ^
mtasker_fcontext.cc:109:47: error: expected '(' before '*' token
mtasker_fcontext.cc:109:48: error: expected primary-expression before '>' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&ctx->uc_mcontext),
                                                ^
mtasker_fcontext.cc:110:32: error: 'fcontext_t' does not name a type
                    static_cast<fcontext_t>(next_ctx),
                                ^~~~~~~~~~
mtasker_fcontext.cc: In function 'void pdns_swapcontext(pdns_ucontext_t&, const pdns_ucontext_t&)':
mtasker_fcontext.cc:132:41: error: 'fcontext_t' does not name a type
     if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
                                         ^~~~~~~~~~
mtasker_fcontext.cc:132:51: error: expected '>' before '*' token
     if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
                                                   ^
mtasker_fcontext.cc:132:51: error: expected '(' before '*' token
mtasker_fcontext.cc:132:52: error: expected primary-expression before '>' token
     if (jump_fcontext (reinterpret_cast<fcontext_t*>(&octx.uc_mcontext),
                                                    ^
mtasker_fcontext.cc:133:36: error: 'fcontext_t' does not name a type
                        static_cast<fcontext_t>(ctx.uc_mcontext), 0)) {
                                    ^~~~~~~~~~
mtasker_fcontext.cc:133:68: error: 'jump_fcontext' was not declared in this scope
                        static_cast<fcontext_t>(ctx.uc_mcontext), 0)) {
                                                                    ^
mtasker_fcontext.cc:133:68: note: suggested alternative:
In file included from mtasker_fcontext.cc:27:0,
                 from mtasker_context.cc:27:
/usr/include/boost/context/detail/fcontext.hpp:31:35: note:   'boost::context::detail::jump_fcontext'
 transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp);
                                   ^~~~~~~~~~~~~
In file included from mtasker_context.cc:27:0:
mtasker_fcontext.cc:133:70: error: expected ')' before '{' token
                        static_cast<fcontext_t>(ctx.uc_mcontext), 0)) {
                                                                      ^
mtasker_fcontext.cc:136:1: error: expected primary-expression before '}' token
 }
 ^
mtasker_fcontext.cc: In function 'void pdns_makecontext(pdns_ucontext_t&, boost::function<void()>&)':
mtasker_fcontext.cc:145:73: error: 'make_fcontext' was not declared in this scope
                                      ctx.uc_stack.size(), &threadWrapper);
                                                                         ^
mtasker_fcontext.cc:145:73: note: suggested alternative:
In file included from mtasker_fcontext.cc:27:0,
                 from mtasker_context.cc:27:
/usr/include/boost/context/detail/fcontext.hpp:33:35: note:   'boost::context::detail::make_fcontext'
 fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) );
                                   ^~~~~~~~~~~~~
In file included from mtasker_context.cc:27:0:
mtasker_fcontext.cc:149:37: error: 'fcontext_t' does not name a type
     jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
                                     ^~~~~~~~~~
mtasker_fcontext.cc:149:47: error: expected '>' before '*' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
                                               ^
mtasker_fcontext.cc:149:47: error: expected '(' before '*' token
mtasker_fcontext.cc:149:48: error: expected primary-expression before '>' token
     jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
                                                ^
mtasker_fcontext.cc:149:56: error: 'struct args_t' has no member named 'prev_ctx'
     jump_fcontext (reinterpret_cast<fcontext_t*>(&args.prev_ctx),
                                                        ^~~~~~~~
mtasker_fcontext.cc:150:32: error: 'fcontext_t' does not name a type
                    static_cast<fcontext_t>(ctx.uc_mcontext),
                                ^~~~~~~~~~
make[2]: *** [Makefile:936: mtasker_context.o] Error 1
make[2]: Leaving directory '/home/ncopa/aports/community/pdns-recursor/src/pdns-recursor-4.0.3'
make[1]: *** [Makefile:1060: all-recursive] Error 1
make[1]: Leaving directory '/home/ncopa/aports/community/pdns-recursor/src/pdns-recursor-4.0.3'
make: *** [Makefile:702: all] Error 2

@pieterlexis
Copy link
Contributor

Fixes for this issues are merged in master (#4499) and in the re/rec-4.0.x branch (#4511). The upcoming 4.0.4 release will contains these fixes. @ncopa please try the master branch or the current pre-release tarball: https://downloads.powerdns.com/autobuilt/recursor/dist/pdns-recursor-4.0.3-8-g9e7120f.tar.bz2

@ncopa
Copy link

ncopa commented Oct 20, 2016

indeed. I manually applied the changes to mtasker_fcontext.cc and now it builds. Thanks!

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

No branches or pull requests

7 participants