matiasdelellis / facerecognition

Nextcloud app that implement a basic facial recognition system.
GNU Affero General Public License v3.0
515 stars 46 forks source link

make error: DLIB_NO_GUI_SUPPORT is defined so you can't use the GUI code #772

Open rcfa opened 2 months ago

rcfa commented 2 months ago

Following the build instructions for PDlib, I get an error. Been googling it, found some references to it in relation to building dlib, but for one, I have dlib installed from a distribution package (running Kali-rolling on arm64/Rasberry Pi 4), which is Debian based), and for two, the various solutions suggested aren’t applicable, as e.g. libx11-dev etc. are installed.

So if anyone has a clue what the problem is here...

# apt install libopenblas-dev liblapack-dev  libdlib-dev libx11-dev 
libopenblas-dev is already the newest version (0.3.27+ds-2).
liblapack-dev is already the newest version (3.12.0-3).
libdlib-dev is already the newest version (19.24.4+dfsg-2).
libx11-dev is already the newest version (2:1.8.7-1+b1).
Summary:
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0

# git clone https://github.com/goodspb/pdlib.git
Cloning into 'pdlib'...
remote: Enumerating objects: 269, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 269 (delta 6), reused 6 (delta 3), pack-reused 249
Receiving objects: 100% (269/269), 533.04 KiB | 3.23 MiB/s, done.
Resolving deltas: 100% (162/162), done.

# cd pdlib 
# phpize
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level

# ./configure                                                      
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking target system type... aarch64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20220829
checking for PHP installed headers prefix... /usr/include/php/20220829
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for pdlib support... yes, shared
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... checking for pkg-config... /usr/bin/pkg-config
found
checking for dlib-1... from pkgconfig: dlib version 19.24.4
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert aarch64-unknown-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert aarch64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status

Build configuration for PDlib v1.0.2 done correctly.

  dlib version: 19.24.4

  CXXFLAGS    : -g -O2
  LDFLAGS     : 
  LIBDIR:     : -ldlib /usr/lib/aarch64-linux-gnu/libblas.so /usr/lib/aarch64-linux-gnu/liblapack.so /usr/lib/aarch64-linux-gnu/libsqlite3.so 
  LIBADD:     :  -lstdc++ -ldlib

Please submit bug reports at:
  https://github.com/goodspb/pdlib/issues

config.status: creating config.h
config.status: executing libtool commands

# make
/bin/bash /root/Developer/pdlib/libtool --tag=CXX --mode=compile g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/pdlib.cc -o pdlib.lo  -MMD -MF pdlib.dep -MT pdlib.lo
libtool: compile:  g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/pdlib.cc -MMD -MF pdlib.dep -MT pdlib.lo  -fPIC -DPIC -o .libs/pdlib.o
In file included from /usr/include/sched.h:29,
                 from /usr/include/pthread.h:22,
                 from /usr/include/aarch64-linux-gnu/c++/13/bits/gthr-default.h:35,
                 from /usr/include/aarch64-linux-gnu/c++/13/bits/gthr.h:148,
                 from /usr/include/c++/13/ext/atomicity.h:35,
                 from /usr/include/c++/13/bits/ios_base.h:39,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/istream:40,
                 from /usr/include/c++/13/sstream:40,
                 from /usr/include/dlib/assert.h:7,
                 from /usr/include/dlib/algs.h:116,
                 from /usr/include/dlib/matrix/matrix_exp.h:6,
                 from /usr/include/dlib/matrix/matrix.h:6,
                 from /usr/include/dlib/matrix.h:6,
                 from /usr/include/dlib/cuda/tensor.h:8,
                 from /usr/include/dlib/dnn.h:12,
                 from /root/Developer/pdlib/src/face_recognition.h:8,
                 from /root/Developer/pdlib/pdlib.cc:33:
/root/Developer/pdlib/pdlib.cc: In function ‘void php_face_recognition_free(zend_object*)’:
/root/Developer/pdlib/pdlib.cc:139:79: warning: ‘offsetof’ within non-standard-layout type ‘face_recognition’ {aka ‘_face_recognition’} is conditionally-supported -Winvalid-offsetof]
  139 |         face_recognition *fr = (face_recognition*)((char*)object - XtOffsetOf(face_recognition, std));
/root/Developer/pdlib/pdlib.cc:139:68: note: in expansion of macro ‘XtOffsetOf’
  139 |         face_recognition *fr = (face_recognition*)((char*)object - XtOffsetOf(face_recognition, std));
      |                                                                    ^~~~~~~~~~
/root/Developer/pdlib/pdlib.cc: In function ‘zend_result zm_startup_pdlib(int, int)’:
/root/Developer/pdlib/pdlib.cc:173:59: warning: ‘offsetof’ within non-standard-layout type ‘face_recognition’ {aka ‘_face_recognition’} is conditionally-supported -Winvalid-offsetof]
  173 |         face_recognition_obj_handlers.offset = XtOffsetOf(face_recognition, std);
/root/Developer/pdlib/pdlib.cc:173:48: note: in expansion of macro ‘XtOffsetOf’
  173 |         face_recognition_obj_handlers.offset = XtOffsetOf(face_recognition, std);
      |                                                ^~~~~~~~~~
/bin/bash /root/Developer/pdlib/libtool --tag=CXX --mode=compile g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/src/chinese_whispers.cc -o src/chinese_whispers.lo  -MMD -MF src/chinese_whispers.dep -MT src/chinese_whispers.lo
libtool: compile:  g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/src/chinese_whispers.cc -MMD -MF src/chinese_whispers.dep -MT src/chinese_whispers.lo  -fPIC -DPIC -o src/.libs/chinese_whispers.o
/bin/bash /root/Developer/pdlib/libtool --tag=CXX --mode=compile g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/src/face_detection.cc -o src/face_detection.lo  -MMD -MF src/face_detection.dep -MT src/face_detection.lo
libtool: compile:  g++ -I. -I/root/Developer/pdlib -I/root/Developer/pdlib/include -I/root/Developer/pdlib/main -I/root/Developer/pdlib -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -std=c++14 -DZEND_COMPILE_DL_EXT=1 -c /root/Developer/pdlib/src/face_detection.cc -MMD -MF src/face_detection.dep -MT src/face_detection.lo  -fPIC -DPIC -o src/.libs/face_detection.o
In file included from /usr/include/dlib/gui_core/xlib.h:4,
                 from /usr/include/dlib/gui_core.h:14,
                 from /usr/include/dlib/gui_widgets/drawable.h:10,
                 from /usr/include/dlib/gui_widgets/widgets.h:16,
                 from /usr/include/dlib/gui_widgets.h:13,
                 from /root/Developer/pdlib/src/face_detection.cc:7:
/usr/include/dlib/gui_core/gui_core_kernel_2.h:11:2: error: #error "DLIB_NO_GUI_SUPPORT is defined so you can't use the GUI code.  Turn DLIB_NO_GUI_SUPPORT off if you want to use it."
   11 | #error "DLIB_NO_GUI_SUPPORT is defined so you can't use the GUI code.  Turn DLIB_NO_GUI_SUPPORT off if you want to use it."
      |  ^~~~~
/usr/include/dlib/gui_core/gui_core_kernel_2.h:12:2: error: #error "Also make sure you have libx11-dev installed on your system"
   12 | #error "Also make sure you have libx11-dev installed on your system"
      |  ^~~~~
make: *** [Makefile:216: src/face_detection.lo] Error 1
vwbusguy commented 2 months ago

This sounds like a p/dlib issue rather than an issue with this plugin?

matiasdelellis commented 2 months ago

Remove libx11-dev and try again..