alibaba / PhotonLibOS

Probably the fastest coroutine lib in the world!

Home Page:https://PhotonLibOS.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build error with C++17

autopear opened this issue · comments

commented

Since version 0.6, we encounter build error with C++17 enabled.

checking whether compiler supports -Wno-format-zero-length... In file included from /home/code/build/_deps/photon-src/include/photon/thread/thread11.h:24,
                 from /home/code/build/_deps/photon-src/include/photon/thread/std-compat.h:26,
                 from /home/code/port/port_posix.h:55,
                 from /home/code/port/port.h:18,
                 from /home/code/util/testharness.cc:14:
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:7: error: expected identifier before 'template'
 using template std::apply<F, Tuple>;
       ^~~~~~~~
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:27: error: 'F' was not declared in this scope
 using template std::apply<F, Tuple>;
                           ^
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:27: note: suggested alternative: 'FP'
 using template std::apply<F, Tuple>;
                           ^
                           FP
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:30: error: 'Tuple' was not declared in this scope
 using template std::apply<F, Tuple>;
                              ^~~~~
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:21: error: ISO C++ forbids declaration of 'apply' with no type [-fpermissive]
 using template std::apply<F, Tuple>;
                     ^~~~~~~~~~~~~~~
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:21: error: template-id 'apply<<expression error>, <expression error> >' used as a declarator
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:21: error: declaration of 'apply' not in a namespace surrounding 'std'
/home/code/build/_deps/photon-src/include/photon/common/tuple-assistance.h:95:21: error: 'std::apply(_Fn&&, _Tuple&&)' is not a variable template
In file included from /home/code/build/_deps/photon-src/include/photon/thread/std-compat.h:26,
                 from /home/code/port/port_posix.h:55,
                 from /home/code/port/port.h:18,
                 from /home/code/util/testharness.cc:14:
/home/code/build/_deps/photon-src/include/photon/thread/thread11.h: In function 'void* photon::__stub11(void*)':
/home/code/build/_deps/photon-src/include/photon/thread/thread11.h:31:27: error: 'apply' is not a member of 'tuple_assistance'
         tuple_assistance::apply(p->first, p->second);
                           ^~~~~
/home/code/build/_deps/photon-src/include/photon/thread/thread11.h:31:27: note: suggested alternative:
In file included from /home/code/third-party/gtest-1.8.1/fused-src/gtest/../gtest/gtest.h:957,
                 from /home/code/util/testharness.h:15,
                 from /home/code/util/testharness.cc:10:
/usr/include/c++/8/tuple:1684:5: note:   'std::apply'
     apply(_Fn&& __f, _Tuple&& __t)
     ^~~~~
-- Looking for sys/uio.h - found
-- Looking for unistd.h
yes
In file included from /home/code/build/_deps/photon-src/include/photon/thread/std-compat.h:27,
                 from /home/code/port/port_posix.h:55,
                 from /home/code/port/port.h:18,
                 from /home/code/util/testharness.cc:14:
/home/code/build/_deps/photon-src/include/photon/thread/thread-local.h: In member function 'T* photon::thread_local_ptr<T, ARGS>::get() const':
/home/code/build/_deps/photon-src/include/photon/thread/thread-local.h:63:38: error: 'apply' is not a member of 'tuple_assistance'
             data = tuple_assistance::apply(ctor(), m_args);
                                      ^~~~~
checking whether compiler supports -pipe... /home/code/build/_deps/photon-src/include/photon/thread/thread-local.h:63:38: note: suggested alternative:
In file included from /home/code/third-party/gtest-1.8.1/fused-src/gtest/../gtest/gtest.h:957,
                 from /home/code/util/testharness.h:15,
                 from /home/code/util/testharness.cc:10:
/usr/include/c++/8/tuple:1684:5: note:   'std::apply'
     apply(_Fn&& __f, _Tuple&& __t)
     ^~~~~

GCC

$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Please refer to this issue #159 . The fix is coming soon.

Because the github CI is running on Ubuntu, so it didn't run into this problem.

Next we can set up more test machines and run github CI flow on different platforms.

#159 (comment) is the fix. You can add it into your code temporarily.