goodspb / pdlib

PHP extension for Dlib.
MIT License
71 stars 19 forks source link

Building not working in Ubuntu 20.04 #50

Closed jacotec closed 1 year ago

jacotec commented 2 years ago

After PHP-Upgrade from 7.4 to 8.1 I need to rebuild the pblib for the Nextcloud Face Recognition.

Unfortunately, following exactly the install document, I'm getting a ton of errors trying to compile pdlib:

In file included from /usr/local/include/dlib/math.h:6,
                 from /usr/local/include/dlib/matrix/matrix_fft.h:10,
                 from /usr/local/include/dlib/matrix/matrix_conv.h:8,
                 from /usr/local/include/dlib/matrix.h:13,
                 from /usr/local/include/dlib/cuda/tensor.h:8,
                 from /usr/local/include/dlib/dnn.h:12,
                 from /root/pdlib/src/face_recognition.h:8,
                 from /root/pdlib/pdlib.cc:33:
/usr/local/include/dlib/math/bessel.h:11:5: error: ‘cyl_bessel_i’ function uses ‘auto’ type specifier without trailing return type
   11 |     auto cyl_bessel_i(R1 nu, R2 x)
      |     ^~~~
/usr/local/include/dlib/math/bessel.h:11:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/math/bessel.h: In function ‘auto dlib::cyl_bessel_i(R1, R2)’:
/usr/local/include/dlib/math/bessel.h:20:24: error: ‘common_type_t’ in namespace ‘std’ does not name a template type; did you mean ‘common_type’?
   20 |         using R = std::common_type_t<R1,R2>;
      |                        ^~~~~~~~~~~~~
      |                        common_type
/usr/local/include/dlib/math/bessel.h:21:38: error: ‘R’ was not declared in this scope
   21 |         return detail::cyl_bessel_i((R)nu, (R)x);
      |                                      ^
/usr/local/include/dlib/math/bessel.h:21:47: error: expected ‘)’ before ‘x’
   21 |         return detail::cyl_bessel_i((R)nu, (R)x);
      |                                    ~          ^
      |                                               )
/usr/local/include/dlib/math/bessel.h: At global scope:
/usr/local/include/dlib/math/bessel.h:25:5: error: ‘cyl_bessel_j’ function uses ‘auto’ type specifier without trailing return type
   25 |     auto cyl_bessel_j(R1 nu, R2 x)
      |     ^~~~
/usr/local/include/dlib/math/bessel.h:25:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/math/bessel.h: In function ‘auto dlib::cyl_bessel_j(R1, R2)’:
/usr/local/include/dlib/math/bessel.h:34:24: error: ‘common_type_t’ in namespace ‘std’ does not name a template type; did you mean ‘common_type’?
   34 |         using R = std::common_type_t<R1,R2>;
      |                        ^~~~~~~~~~~~~
      |                        common_type
/usr/local/include/dlib/math/bessel.h:35:38: error: ‘R’ was not declared in this scope
   35 |         return detail::cyl_bessel_j((R)nu, (R)x);
      |                                      ^
/usr/local/include/dlib/math/bessel.h:35:47: error: expected ‘)’ before ‘x’
   35 |         return detail::cyl_bessel_j((R)nu, (R)x);
      |                                    ~          ^
      |                                               )
In file included from /usr/local/include/dlib/math.h:7,
                 from /usr/local/include/dlib/matrix/matrix_fft.h:10,
                 from /usr/local/include/dlib/matrix/matrix_conv.h:8,
                 from /usr/local/include/dlib/matrix.h:13,
                 from /usr/local/include/dlib/cuda/tensor.h:8,
                 from /usr/local/include/dlib/dnn.h:12,
                 from /root/pdlib/src/face_recognition.h:8,
                 from /root/pdlib/pdlib.cc:33:
/usr/local/include/dlib/math/windows.h: In function ‘double dlib::kaiser(double, double, dlib::beta_t)’:
/usr/local/include/dlib/math/windows.h:77:48: error: void value not ignored as it ought to be
   77 |             const double a = dlib::cyl_bessel_i(0, beta.v*std::sqrt(1-r*r));
      |                              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/dlib/math/windows.h:78:48: error: void value not ignored as it ought to be
   78 |             const double b = dlib::cyl_bessel_i(0, beta.v);
      |                              ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
In file included from /usr/local/include/dlib/matrix/matrix_conv.h:8,
                 from /usr/local/include/dlib/matrix.h:13,
                 from /usr/local/include/dlib/cuda/tensor.h:8,
                 from /usr/local/include/dlib/dnn.h:12,
                 from /root/pdlib/src/face_recognition.h:8,
                 from /root/pdlib/pdlib.cc:33:
/usr/local/include/dlib/matrix/matrix_fft.h: At global scope:
/usr/local/include/dlib/matrix/matrix_fft.h:274:13: error: ‘operator()’ function uses ‘auto’ type specifier without trailing return type
  274 |             auto operator()(const MAT& mat) const { return dlib::fft(mat); }
      |             ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:274:13: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:277:13: error: ‘operator()’ function uses ‘auto’ type specifier without trailing return type
  277 |             auto operator()(const MAT& mat) const { return dlib::fft(dlib::complex_matrix(mat)); }
      |             ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:277:13: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:285:13: error: ‘operator()’ function uses ‘auto’ type specifier without trailing return type
  285 |             auto operator()(const MAT& mat) const { return dlib::fftr(mat); }
      |             ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:285:13: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:293:13: error: ‘operator()’ function uses ‘auto’ type specifier without trailing return type
  293 |             auto operator()(const MAT& mat) const { return dlib::ifft(mat); }
      |             ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:293:13: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:299:13: error: ‘operator()’ function uses ‘auto’ type specifier without trailing return type
  299 |             auto operator()(const MAT& mat) const { return dlib::ifftr(mat); }
      |             ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:299:13: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:307:9: error: ‘stft_impl’ function uses ‘auto’ type specifier without trailing return type
  307 |         auto stft_impl (
      |         ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:307:9: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:359:9: error: ‘istft_impl’ function uses ‘auto’ type specifier without trailing return type
  359 |         auto istft_impl (
      |         ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:359:9: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:401:12: error: ‘make_hann’ function uses ‘auto’ type specifier without trailing return type
  401 |     inline auto make_hann()
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:401:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:406:12: error: ‘make_blackman’ function uses ‘auto’ type specifier without trailing return type
  406 |     inline auto make_blackman()
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:406:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:411:12: error: ‘make_blackman_nuttall’ function uses ‘auto’ type specifier without trailing return type
  411 |     inline auto make_blackman_nuttall()
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:411:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:416:12: error: ‘make_blackman_harris’ function uses ‘auto’ type specifier without trailing return type
  416 |     inline auto make_blackman_harris()
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:416:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:421:12: error: ‘make_blackman_harris7’ function uses ‘auto’ type specifier without trailing return type
  421 |     inline auto make_blackman_harris7()
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:421:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:426:12: error: ‘make_kaiser’ function uses ‘auto’ type specifier without trailing return type
  426 |     inline auto make_kaiser(beta_t beta)
      |            ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:426:12: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:434:5: error: ‘stft’ function uses ‘auto’ type specifier without trailing return type
  434 |     auto stft (
      |     ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:434:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:448:5: error: ‘stft’ function uses ‘auto’ type specifier without trailing return type
  448 |     auto stft (
      |     ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:448:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:462:5: error: ‘istft’ function uses ‘auto’ type specifier without trailing return type
  462 |     auto istft (
      |     ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:462:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:476:5: error: ‘stftr’ function uses ‘auto’ type specifier without trailing return type
  476 |     auto stftr (
      |     ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:476:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:490:5: error: ‘stftr’ function uses ‘auto’ type specifier without trailing return type
  490 |     auto stftr (
      |     ^~~~
/usr/local/include/dlib/matrix/matrix_fft.h:490:5: note: deduced return type only available with ‘-std=c++14’ or ‘-std=gnu++14’
/usr/local/include/dlib/matrix/matrix_fft.h:504:5: error: ‘istftr’ function uses ‘auto’ type specifier without trailing return type
  504 |     auto istftr (
      |     ^~~~

Any idea how to solve this?

Snakesms commented 2 years ago

Would be curious to see the proper answer, but I've faced the same issue today and just bumped c++ version as suggested in the warning:"deduced return type only available with ‘-std=c++14’"

So I just modified configure: cat configure | sed 's/std=c++11/std=c++14/g' > configure_new and run it: PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig ./configure_new

jacotec commented 2 years ago

@Snakesms Awesome, thanks! That did it. I'll leave that open, because it should be fixed in the project.

BSoDium commented 2 years ago

@Snakesms Thank you, that did the trick 🥳

martadinata666 commented 2 years ago

Thanks for the idea, my tweak is replace c++11 to c++14 before configure, sed -i 's/c++11/c++14/g' /usr/src/php/ext/pdlib/config.m4

abctaylor commented 1 year ago

@matiasdelellis Google does not take people to this page when searching for the c++14 error message above when compiling. Could you add a mention of this hack/workaround to https://github.com/matiasdelellis/facerecognition/wiki/PDlib-Installation to save people a few hours trying their won workarounds? Thanks.

HyCore commented 1 year ago

thanks for this page to exist ! it worked :D but i was also wondering why there is no "apt install pdlib" yet ?

carlchen2007 commented 1 year ago

I always get the response: -bash: ./configure_new: Permission denied any idea how to fix?

PeteLawler commented 1 year ago

I always get the response: -bash: ./configure_new: Permission denied any idea how to fix?

chmod +x ./configure_new

goodspb commented 1 year ago

please use: https://github.com/goodspb/pdlib/releases/tag/v1.1.0