coost icon indicating copy to clipboard operation
coost copied to clipboard

Failed to build on FreeBSD

Open Curculigo opened this issue 1 year ago • 1 comments

$ cmake -S . -B build
-- The C compiler identification is Clang 18.1.5
-- The CXX compiler identification is Clang 18.1.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /usr/bin/cc
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done (1.8s)
-- Generating done (0.0s)
-- Build files have been written to: /work/coost/build
$ gmake -C build
gmake: Entering directory '/work/coost/build'
[  2%] Building CXX object src/CMakeFiles/co.dir/benchmark.cc.o
In file included from /work/coost/src/benchmark.cc:1:
In file included from /work/coost/include/co/benchmark.h:4:
In file included from /work/coost/include/co/vector.h:3:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
/work/coost/include/co/vector.h:281:41: note: in instantiation of function template specialization 'god::is_trivially_copyable<bm::xx::Group>' requested here
  281 |     template<typename X, god::if_t<god::is_trivially_copyable<X>(), int> = 0>
      |                                         ^
/work/coost/include/co/vector.h:282:8: note: while substituting prior template arguments into non-type template parameter [with X = bm::xx::Group]
  282 |     X* _realloc(X* p, size_t o, size_t n) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         return (X*) co::realloc(p, o, n);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284 |     }
      |     ~
/work/coost/include/co/vector.h:277:24: note: while substituting deduced template arguments into function template '_realloc' [with X = bm::xx::Group, $1 = (no value)]
  277 |             _p = this->_realloc(_p, sizeof(T) * cap, sizeof(T) * _cap); assert(_p);
      |                        ^
/work/coost/include/co/vector.h:152:15: note: in instantiation of member function 'co::vector<bm::xx::Group>::_realloc_if_no_more_memory' requested here
  152 |         this->_realloc_if_no_more_memory();
      |               ^
/work/coost/include/co/vector.h:217:35: note: in instantiation of member function 'co::vector<bm::xx::Group>::append' requested here
  217 |     void push_back(T&& x) { this->append(std::move(x)); }
      |                                   ^
/work/coost/src/benchmark.cc:24:14: note: in instantiation of member function 'co::vector<bm::xx::Group>::push_back' requested here
   24 |     groups().push_back(Group(name, f));
      |              ^
2 warnings generated.
[  4%] Building CXX object src/CMakeFiles/co.dir/co/co.cc.o
In file included from /work/coost/src/co/co.cc:1:
In file included from /work/coost/src/co/sched.h:7:
In file included from /work/coost/include/co/co.h:4:
In file included from /work/coost/include/co/closure.h:4:
In file included from /work/coost/include/co/mem.h:4:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/src/co/co.cc:103:5: error: use of undeclared identifier 'pthread_threadid_np'
  103 |     pthread_threadid_np(0, &x);
      |     ^
In file included from /work/coost/src/co/co.cc:1:
In file included from /work/coost/src/co/sched.h:7:
In file included from /work/coost/include/co/co.h:4:
In file included from /work/coost/include/co/closure.h:4:
In file included from /work/coost/include/co/mem.h:4:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/include/co/vector.h:281:41: note: in instantiation of function template specialization 'god::is_trivially_copyable<co::xx::Coroutine *>' requested here
  281 |     template<typename X, god::if_t<god::is_trivially_copyable<X>(), int> = 0>
      |                                         ^
/work/coost/include/co/vector.h:282:8: note: while substituting prior template arguments into non-type template parameter [with X = co::xx::Coroutine *]
  282 |     X* _realloc(X* p, size_t o, size_t n) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         return (X*) co::realloc(p, o, n);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284 |     }
      |     ~
/work/coost/include/co/vector.h:119:24: note: while substituting deduced template arguments into function template '_realloc' [with X = co::xx::Coroutine *, $1 = (no value)]
  119 |             _p = this->_realloc(_p, sizeof(T) * _cap, sizeof(T) * n); assert(_p);
      |                        ^
/work/coost/include/co/vector.h:125:15: note: in instantiation of member function 'co::vector<co::xx::Coroutine *>::reserve' requested here
  125 |         this->reserve(n);
      |               ^
/work/coost/src/co/sched.h:144:12: note: in instantiation of member function 'co::vector<co::xx::Coroutine *>::resize' requested here
  144 |         _v.resize(M);
      |            ^
In file included from /work/coost/src/co/co.cc:1:
In file included from /work/coost/src/co/sched.h:7:
In file included from /work/coost/include/co/co.h:4:
In file included from /work/coost/include/co/closure.h:4:
In file included from /work/coost/include/co/mem.h:4:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/include/co/vector.h:281:41: note: in instantiation of function template specialization 'god::is_trivially_copyable<int>' requested here
  281 |     template<typename X, god::if_t<god::is_trivially_copyable<X>(), int> = 0>
      |                                         ^
/work/coost/include/co/vector.h:282:8: note: while substituting prior template arguments into non-type template parameter [with X = int]
  282 |     X* _realloc(X* p, size_t o, size_t n) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         return (X*) co::realloc(p, o, n);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284 |     }
      |     ~
/work/coost/include/co/vector.h:119:24: note: while substituting deduced template arguments into function template '_realloc' [with X = int, $1 = (no value)]
  119 |             _p = this->_realloc(_p, sizeof(T) * _cap, sizeof(T) * n); assert(_p);
      |                        ^
/work/coost/src/co/sched.h:196:42: note: in instantiation of member function 'co::vector<int>::reserve' requested here
  196 |             if (_v0.capacity() == 0) _v0.reserve(N);
      |                                          ^
In file included from /work/coost/src/co/co.cc:1:
In file included from /work/coost/src/co/sched.h:7:
In file included from /work/coost/include/co/co.h:4:
In file included from /work/coost/include/co/closure.h:4:
In file included from /work/coost/include/co/mem.h:4:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/include/co/vector.h:281:41: note: in instantiation of function template specialization 'god::is_trivially_copyable<co::Closure *>' requested here
  281 |     template<typename X, god::if_t<god::is_trivially_copyable<X>(), int> = 0>
      |                                         ^
/work/coost/include/co/vector.h:282:8: note: while substituting prior template arguments into non-type template parameter [with X = co::Closure *]
  282 |     X* _realloc(X* p, size_t o, size_t n) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         return (X*) co::realloc(p, o, n);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284 |     }
      |     ~
/work/coost/include/co/vector.h:277:24: note: while substituting deduced template arguments into function template '_realloc' [with X = co::Closure *, $1 = (no value)]
  277 |             _p = this->_realloc(_p, sizeof(T) * cap, sizeof(T) * _cap); assert(_p);
      |                        ^
/work/coost/include/co/vector.h:147:15: note: in instantiation of member function 'co::vector<co::Closure *>::_realloc_if_no_more_memory' requested here
  147 |         this->_realloc_if_no_more_memory();
      |               ^
/work/coost/include/co/vector.h:216:40: note: in instantiation of member function 'co::vector<co::Closure *>::append' requested here
  216 |     void push_back(const T& x) { this->append(x); }
      |                                        ^
/work/coost/src/co/sched.h:248:20: note: in instantiation of member function 'co::vector<co::Closure *>::push_back' requested here
  248 |         _new_tasks.push_back(cb);
      |                    ^
In file included from /work/coost/src/co/co.cc:1:
In file included from /work/coost/src/co/sched.h:7:
In file included from /work/coost/include/co/co.h:4:
In file included from /work/coost/include/co/closure.h:4:
In file included from /work/coost/include/co/mem.h:4:
/work/coost/include/co/god.h:223:12: warning: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Wdeprecated-builtins]
  223 |     return __has_trivial_copy(T);
      |            ^
/work/coost/include/co/vector.h:281:41: note: in instantiation of function template specialization 'god::is_trivially_copyable<void *>' requested here
  281 |     template<typename X, god::if_t<god::is_trivially_copyable<X>(), int> = 0>
      |                                         ^
/work/coost/include/co/vector.h:282:8: note: while substituting prior template arguments into non-type template parameter [with X = void *]
  282 |     X* _realloc(X* p, size_t o, size_t n) {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283 |         return (X*) co::realloc(p, o, n);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  284 |     }
      |     ~
/work/coost/include/co/vector.h:277:24: note: while substituting deduced template arguments into function template '_realloc' [with X = void *, $1 = (no value)]
  277 |             _p = this->_realloc(_p, sizeof(T) * cap, sizeof(T) * _cap); assert(_p);
      |                        ^
/work/coost/include/co/vector.h:147:15: note: in instantiation of member function 'co::vector<void *>::_realloc_if_no_more_memory' requested here
  147 |         this->_realloc_if_no_more_memory();
      |               ^
/work/coost/include/co/vector.h:216:40: note: in instantiation of member function 'co::vector<void *>::append' requested here
  216 |     void push_back(const T& x) { this->append(x); }
      |                                        ^
/work/coost/src/co/sched.h:431:19: note: in instantiation of member function 'co::vector<void *>::push_back' requested here
  431 |             _bufs.push_back(co->pbuf);
      |                   ^
5 warnings and 1 error generated.
gmake[2]: *** [src/CMakeFiles/co.dir/build.make:90: src/CMakeFiles/co.dir/co/co.cc.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:98: src/CMakeFiles/co.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
gmake: Leaving directory '/work/coost/build'

Curculigo avatar Aug 09 '24 11:08 Curculigo

It's very strange as it's still failing with the same error when I modified co.cc to include pthread_np.h:

#ifndef _WIN32
#ifdef __linux__
#include <unistd.h>       // for syscall()
#include <sys/syscall.h>  // for SYS_xxx definitions
#include <time.h>         // for clock_gettime
#else
#include <sys/time.h>     // for gettimeofday
#include <pthread_np.h>   // for pthread_threadid_np
#endif
#endif

Curculigo avatar Aug 18 '24 09:08 Curculigo