matiasdelellis / facerecognition

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

Installing on FreeNas/FreeBSD NextCloud #261

Open beachbob89 opened 4 years ago

beachbob89 commented 4 years ago

I am having trouble installing pdlib on my NextCloud system which is installed on my Freenas platform. Freenas uses the FreeBSD distro.

When I got to run "./configure --enable-debug", I get the error: "error:pkg-config not found"

I know with FreeBSD they are using "pkgconf" but I have run "pkg-config" and can confirm it is in /usr/local/bin/pkg-config. I even set the variable PKG_CONFIG to help it find it with no luck. Any help would be appreciated.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/91959662-installing-on-freenas-freebsd-nextcloud?utm_campaign=plugin&utm_content=tracker%2F74944432&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F74944432&utm_medium=issues&utm_source=github).
matiasdelellis commented 4 years ago

Hi @beachbob89

When I got to run "./configure --enable-debug", I get the error: "error:pkg-config not found"

I recently discovered that this message is wrong, and may also indicate that dlib is missing.

Check that you have all dlib headers or devel packges installed.

[matias@ideapad pdlib]$ pkg-config --libs dlib-1
-ldlib -lpthread /usr/lib64/libX11.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libjpeg.so /usr/lib64/libopenblas.so /usr/lib64/libsqlite3.so 

After that, I honestly don't have any FreeBSD experience to help you. :disappointed:

beachbob89 commented 4 years ago

So that ended up being it. In fact it was my .pc file was in the wrong location so pkg-config could not find it.

I ended up getting everything installed. But for some reason PHP cannot load the pdlib.so file. Here is my error. Any chance you know the issue here?: Error

matiasdelellis commented 4 years ago

So that ended up being it. In fact it was my .pc file was in the wrong location so pkg-config could not find it.

Great.

I ended up getting everything installed. But for some reason PHP cannot load the pdlib.so file. Here is my error. Any chance you know the issue here?:

It is a dependency that is not installed..

MM.. According to this, maybe libstdcxx

stalker314314 commented 4 years ago

In general, you want to match supported ABI from where you are running to where it is compiled. Check ABI of your compiled PHP (use objdump -p php | grep CXXABI or objdump -p php | grep GLIBCXX) and check same for produced .so. At least one version in pdlib.so should match PHP where pdlib.so is about to be loaded. If it is not matching, your build environment might be too new or too old for your "deployment" (where php is) env

matiasdelellis commented 4 years ago

Hi @beachbob89 I hope this can help you.. Use this branch that improves the configuration messages.

Build configuration for PDlib v1.0.3 done correctly.

  CFLAGS       : -g -O2
  LDFLAGS      : 
  LIBDIR:      : -ldlib -lpthread /usr/lib64/libX11.so /usr/lib64/libpng.so /usr/lib64/libz.so /usr/lib64/libjpeg.so /usr/lib64/libopenblas.so /usr/lib64/libsqlite3.so 
  LIBADD:      :  -lstdc++ -ldlib
  CFLAGS:      : 

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

With LIBDIR and LIBADD you can see the dependencies that were used when compiling, and those that you should comply with to use. :wink:

beachbob89 commented 4 years ago

Ok so I am about to give up and maybe try doing it on another system. What my goal was is to install the facial recognition app on my nextcloud instance. This sits on my freeNas system which has FreeBSD Jails.

When I installed the instance that Matias suggested, everything installed fine but now I got a segment error when PHP was starting. I did an "ld" of the pdlib.so and got back a bunch of errors below. What I believe is that with FreeBSD, it compiles with the libc library where linux uses the glibc library. Reading online is libc adds a "_" to the begining of some of the variables. Most notably _enviorn variable. It seems that the issue lies at the compiler. But im unsure how to work around this.

Screen Shot 2020-04-23 at 9 41 38 AM

So what is next. If you guys have any suggestions on making it work then please let me know. Otherwise I see about starting up a debian or ubuntu virtual to host my nextcloud instance. I really want to try out the facial recognition for my photos.

matiasdelellis commented 4 years ago

What I believe is that with FreeBSD, it compiles with the libc library where linux uses the glibc library

Ohh ... Now I understand your problem.. :disappointed: Beyond that freebsd has a good compatibility layer with linux, you should try to compile it directly in the freenas, or in a similar instance (and then copy the files.), and ultimately you can try setting up a cross compiler environment, but don't compile it directly in linux.

I'm looking for information, but there is little documentation about compiling software on FreeNAS

beachbob89 commented 4 years ago

So I am compiling it right now directly on the FreeBSD environment within freenas. This is a result of that. I have not tried the copying from a linux environment yet.

beachbob89 commented 4 years ago

Wait are you guys compatible with PHP7.4? Or only with the 7.0?

matiasdelellis commented 4 years ago

So I am compiling it right now directly on the FreeBSD environment within freenas. This is a result of that. I have not tried the copying from a linux environment yet.

Oh.. Ok.

Wait are you guys compatible with PHP7.4? Or only with the 7.0?

It is compatible with any version greater than 7.0, although personally i dont test it beyond 7.3

EliranHayun commented 4 years ago

Hi all,

I hope I can help here with this issue: Yesteday I was able to complie pdlib on FreeNAS (FreeBSD) 11.3

for dlib validate you have

pkg install libopenblas
pkg install lapack

for pdlib validate you have

pkg install re2c
pkg install php73-bz2
pkg install gpp

Here is my make output

mkdir .libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/pdlib.cc  -fPIC -DPIC -o .libs/pdlib.o
/bin/sh /tmp/pdlib/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -std=c++11   -c /tmp/pdlib/src/chinese_whispers.cc -o src/chinese_whispers.lo
mkdir src/.libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/src/chinese_whispers.cc  -fPIC -DPIC -o src/.libs/chinese_whispers.o
/bin/sh /tmp/pdlib/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -std=c++11   -c /tmp/pdlib/src/face_detection.cc -o src/face_detection.lo
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/src/face_detection.cc  -fPIC -DPIC -o src/.libs/face_detection.o
/bin/sh /tmp/pdlib/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -std=c++11   -c /tmp/pdlib/src/face_landmark_detection.cc -o src/face_landmark_detection.lo
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/src/face_landmark_detection.cc  -fPIC -DPIC -o src/.libs/face_landmark_detection.o
/bin/sh /tmp/pdlib/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -std=c++11   -c /tmp/pdlib/src/face_recognition.cc -o src/face_recognition.lo
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/src/face_recognition.cc  -fPIC -DPIC -o src/.libs/face_recognition.o
/bin/sh /tmp/pdlib/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -std=c++11   -c /tmp/pdlib/src/cnn_face_detection.cc -o src/cnn_face_detection.lo
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pdlib -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -std=c++11 -c /tmp/pdlib/src/cnn_face_detection.cc  -fPIC -DPIC -o src/.libs/cnn_face_detection.o
/bin/sh /tmp/pdlib/libtool --mode=link g++ -DPHP_ATOM_INC -I/tmp/pdlib/include -I/tmp/pdlib/main -I/tmp/pdlib -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2    -o ./pdlib.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pdlib/modules  pdlib.lo src/chinese_whispers.lo src/face_detection.lo src/face_landmark_detection.lo src/face_recognition.lo src/cnn_face_detection.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lstdc++ -ldlib -pthread
g++ -shared -nostdlib /usr/lib/crti.o /usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0/crtbeginS.o  .libs/pdlib.o src/.libs/chinese_whispers.o src/.libs/face_detection.o src/.libs/face_landmark_detection.o src/.libs/face_recognition.o src/.libs/cnn_face_detection.o  -L/usr/local/lib -ldlib -L/usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0 -L/usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0/../../../../../x86_64-portbld-freebsd11.3/lib -L/usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0/../../.. -lstdc++ -lm -lc -lgcc_s /usr/local/lib/gcc9/gcc/x86_64-portbld-freebsd11.3/9.3.0/crtendS.o /usr/lib/crtn.o  -Wl,-rpath -Wl,/usr/local/lib -pthread -Wl,-soname -Wl,pdlib.so -o ./.libs/pdlib.so
creating ./pdlib.la
(cd ./.libs && rm -f pdlib.la && ln -s ../pdlib.la pdlib.la)
/bin/sh /tmp/pdlib/libtool --mode=install cp ./pdlib.la /tmp/pdlib/modules
cp ./.libs/pdlib.so /tmp/pdlib/modules/pdlib.so
cp ./.libs/pdlib.lai /tmp/pdlib/modules/pdlib.la
----------------------------------------------------------------------
Libraries have been installed in:
   /tmp/pdlib/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Please let me know if more help is needed