goodspb / pdlib

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

Unable to compile PDlib due to 'ld: error: unable to find library -lstdc++' and 'Error code 1' on FreeBSD #63

Open benbenik opened 10 months ago

benbenik commented 10 months ago

System: FreeBSD system 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64 Issue: Unable to compile PDlib due to 'ld: error: unable to find library -lstdc++' and 'Error code 1' Expected behaviour: PDlib compiles on FreeBSD

Context: Installing Dlib, following this procedure works: https://github.com/matiasdelellis/facerecognition/wiki/PDlib-Installation

Next step, installing PDlib is met with an error during the 'make' command, when following: https://github.com/matiasdelellis/facerecognition/wiki/PDlib-Installation

git clone https://github.com/goodspb/pdlib.git cd pdlib phpize ./configure make ==> issue arises here 'Error code 1' and 'ld: error: unable to find library -lstdc++', see below sudo make install

Possibly because FreeBSD uses clang, not gcc. I have tried multiple work arounds, even removing lstdc from the makefile, but unfortunately this results in crashes when trying to load the .so in PHP.

Maybe it is possible to include clang or allow for a more generic way of compiling?

>make /bin/sh /home/test/compile/dlib/dlib/build/pdlib/libtool --mode=link c++ -shared -I/home/test/compile/dlib/dlib/build/pdlib/include -I/home/test/compile/dlib/dlib/build/pdlib/main -I/home/test/compile/dlib/dlib/build/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 /home/test/compile/dlib/dlib/build/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 src/vector.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lstdc++ -ldlib c++ -shared -nostdlib /usr/lib/crti.o /usr/lib/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 src/.libs/vector.o -L/usr/local/lib -lstdc++ -ldlib -L/usr/lib -lc++ -lm -lc -lgcc -lgcc_s /usr/lib/crtendS.o /usr/lib/crtn.o -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,pdlib.so -o ./.libs/pdlib.so ld: error: unable to find library -lstdc++ c++: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1

Stop. make: stopped in /home/test/compile/dlib/dlib/build/pdlib

mastersteve1 commented 9 months ago

I have exactly the same exception. I wanted to compile pdlib to get facerecognition work.

System: TrueNAS-13.0-U6.1

`root@Cloud:/pdlib # make /bin/sh /pdlib/libtool --mode=link c++ -shared -I/pdlib/include -I/pdlib/main -I/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 /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 src/vector.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lstdc++ -ldlib -lpthread c++ -shared -nostdlib /usr/lib/crti.o /usr/lib/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 src/.libs/vector.o -L/usr/local/lib -lstdc++ -ldlib -lpthread -L/usr/lib -lc++ -lm -lc -lgcc -lgcc_s /usr/lib/crtendS.o /usr/lib/crtn.o -Wl,-rpath -Wl,/usr/local/lib -Wl,-soname -Wl,pdlib.so -o ./.libs/pdlib.so ld: error: unable to find library -lstdc++ c++: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1

Stop. make: stopped in /pdlib`