Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install issue MacOS (High Sierra) #2

Closed
davidloiret opened this issue Jan 10, 2018 · 19 comments
Closed

Install issue MacOS (High Sierra) #2

davidloiret opened this issue Jan 10, 2018 · 19 comments

Comments

@davidloiret
Copy link

davidloiret commented Jan 10, 2018

Hello thanks for your work.
However I have some issue to install via the npm install face-recognition.
I am getting the following error:
CMake Error: Could not create named generator Visual Studio 15 2017 Win64

I believe it is due to the latest OS based code of justadudewhohacks/npm-dlib-build@b8c17de not published on npm.

OS: MacOS High Sierra
npm version: 5.6.0
node version: 8.9.4

Can't wait to test this lib, thanks!

@justadudewhohacks
Copy link
Owner

Oh damn you are right... I published it now. Thanks for reporting this!

@davidloiret
Copy link
Author

Thanks. And point to v0.0.3 in package.json of this repo please.

@justadudewhohacks
Copy link
Owner

justadudewhohacks commented Jan 10, 2018

Just noticed :D

Edit.: Currently fixing a compilation error on Linux, which you will probably run into as well. Just give me a sec.

@davidloiret
Copy link
Author

Yep I run on the following issue, I guess it's the same you're mentioning

> node-gyp rebuild

  CXX(target) Release/obj.target/facerec/cc/index.o
In file included from ../cc/index.cc:9:
../cc/Array.h:16:25: error: call to member function 'Set' is ambiguous
                info.GetReturnValue().Set(Converter::unwrap(info.This()).size());
                ~~~~~~~~~~~~~~~~~~~~~~^~~
../../nan/nan_callbacks_12_inl.h:46:15: note: candidate function
  inline void Set(bool value) {
              ^
../../nan/nan_callbacks_12_inl.h:51:15: note: candidate function
  inline void Set(double i) {
              ^
../../nan/nan_callbacks_12_inl.h:56:15: note: candidate function
  inline void Set(int32_t i) {
              ^
../../nan/nan_callbacks_12_inl.h:61:15: note: candidate function
  inline void Set(uint32_t i) {
              ^
../../nan/nan_callbacks_12_inl.h:27:37: note: candidate template ignored: could not match 'Local<type-parameter-0-0>'
      against 'long'
  template <typename S> inline void Set(const v8::Local<S> &handle) {
                                    ^
../../nan/nan_callbacks_12_inl.h:32:37: note: candidate template ignored: could not match 'Global<type-parameter-0-0>'
      against 'long'
  template <typename S> inline void Set(const Global<S> &handle) {
                                    ^
../../nan/nan_callbacks_12_inl.h:89:15: note: candidate template ignored: could not match 'S *' against 'long'
  inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
              ^
1 error generated.
make: *** [Release/obj.target/facerec/cc/index.o] Error 1

@davidloiret
Copy link
Author

davidloiret commented Jan 10, 2018

So I believe the correct way to handle that is:

			['OS=="mac"', {
				'xcode_settings': {
					'GCC_ENABLE_CPP_RTTI': 'YES'
				}
			}],
			[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"',
				{
					'cflags_cc!': ['-fno-rtti'],
					'cflags_cc+': ['-frtti'],
				}
			],

See nodejs/node-gyp#26
But now I have another error: clang: error: no such file or directory: '/Users/davidloiret/Downloads/face-recognition.js-master/node_modules/dlib-build/dlib/build/dlib/libdlib.so.19.8.0'

@justadudewhohacks
Copy link
Owner

justadudewhohacks commented Jan 10, 2018

Sorry for delay issues should be fixed now. I also exported the dynamic lib (.so, on mac it's .dylib actually) instead of .a. Should be resolved now.

Edit.: Could you please give me feedback if 'cflags_cc!': ['-fno-rtti'] is also sufficient for xcode, or if I explicitly have to set 'GCC_ENABLE_CPP_RTTI': 'YES'.

@davidloiret
Copy link
Author

No problem, no it's not sufficient I am getting
cannot use dynamic_cast with -fno-rtti
Works fine with 'GCC_ENABLE_CPP_RTTI': 'YES'

@justadudewhohacks
Copy link
Owner

Okay thanks. I will add this.

@davidloiret
Copy link
Author

Thanks

@justadudewhohacks
Copy link
Owner

So I finally got the examples running on linux. Turns out I also had to link libx11 for the dlib gui and libpng.

I have published the most recent version and updated the install instructions. On mac you will probably also have to brew install libx11 if its possible. On linux it's sudo apt-get install libx11-dev.

Sorry for all the inconvenience.

@davidloiret
Copy link
Author

Some progress but now failing with ld: library not found for -lX11
I have xQuartz installed

@justadudewhohacks
Copy link
Owner

justadudewhohacks commented Jan 10, 2018

Hmm, I have added -lX11 to the linker flags in face-recognition/lib/libs.js console.log('-lX11'). Maybe it works if you simply link xQuartz instead?

Or maybe it is sufficient to remove those flags altogether on mac.

@davidloiret
Copy link
Author

If it helps

dl$ locate libX11
/opt/X11/lib/libX11-xcb.1.dylib
/opt/X11/lib/libX11-xcb.dylib
/opt/X11/lib/libX11.6.dylib
/opt/X11/lib/libX11.dylib

@justadudewhohacks
Copy link
Owner

Maybe any of these:
-L/opt/X11
-L/opt/X11/lib/libX11

Also found the suggestion sudo ln -s /opt/X11 /usr/X11 here https://tex.stackexchange.com/questions/208001/cant-compile-image-after-upgrading-to-os-x-yosemite.

I will setup travis CI tomorrow, to know for sure whats going on with OSX. Currently I do not have a MAC VM to test it myself.

@davidloiret
Copy link
Author

davidloiret commented Jan 10, 2018

So I finally change to console.log('-lX11') console.log('-L/usr/X11/lib -lX11') and it works.
But the examples are not working:

             
Error: load_image failed to open file: std::exception
    at Object.<anonymous> (/Users/davidloiret/Downloads/face-recognition.js-master/examples/detectFaceLandmarks.js:10:16)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

EDIT: If I change the image to got.jpg it works, so I guess I have a issue with libpng

@justadudewhohacks
Copy link
Owner

Hmm maybe upgrading libpng to the latest version helps?

@davidloiret
Copy link
Author

davidloiret commented Jan 10, 2018

Nope, another issue I am facing in the faceRecognition example:

dyld: lazy symbol binding failed: Symbol not found: _cblas_sgemm
  Referenced from: face-recognition.js-master/build/Release/facerec.node
  Expected in: flat namespace
Abort trap: 6

@justadudewhohacks
Copy link
Owner

justadudewhohacks commented Jan 11, 2018

Newest version should run on OSX now. I made the mistake of linking dlib statically, thus probably the missing dependency of libblas.

@davidloiret
Copy link
Author

Works like a charm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants