【问题标题】:Build fail with dlib使用 dlib 构建失败
【发布时间】:2018-03-11 20:07:48
【问题描述】:

我正在尝试将 dlib 导入文件以检测人脸。我按照 davisking 的 github repo 上的说明进行操作。

所以当我尝试运行python setup.py install --no USE_SSE4_INSTRUCTIONS时出现以下错误:

In file included from /Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/fonts.cpp:16:
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:313:21: error: use of undeclared identifier 'XAllocColor'
                    XAllocColor(d, cmap, &xcol);
                    ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:319:36: error: use of undeclared identifier 'XmbTextExtents'; did you mean 'XTextExtents'?
                            return XmbTextExtents(fs, str, len, ink, logical);
                                   ^~~~~~~~~~~~~~
                                   XTextExtents
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:318:43: note: 'XTextExtents' declared here
                        inline static int XTextExtents (XFontSet fs, char *str, int len, XRectangle *ink, XRectangle *logical){
                                          ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:322:36: error: use of undeclared identifier 'XwcTextExtents'; did you mean 'XTextExtents'?
                            return XwcTextExtents(fs, str, len, ink, logical);
                                   ^~~~~~~~~~~~~~
                                   XTextExtents
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:321:43: note: 'XTextExtents' declared here
                        inline static int XTextExtents (XFontSet fs, wchar_t *str, int len, XRectangle *ink, XRectangle *logical){
                                          ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:325:29: error: use of undeclared identifier 'XmbDrawString'; did you mean 'XDrawString'?
                            XmbDrawString(d, w, fs, gc, x, y, str, num_bytes);
                            ^~~~~~~~~~~~~
                            XDrawString
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:324:44: note: 'XDrawString' declared here
                        inline static void XDrawString(Display *d, Window w, XFontSet fs, GC gc, int x, int y, char *str, int num_bytes){
                                           ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:328:29: error: use of undeclared identifier 'XwcDrawString'; did you mean 'XDrawString'?
                            XwcDrawString(d, w, fs, gc, x, y, str, num_bytes);
                            ^~~~~~~~~~~~~
                            XDrawString
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:327:44: note: 'XDrawString' declared here
                        inline static void XDrawString(Display *d, Window w, XFontSet fs, GC gc, int x, int y, wchar_t *str, int num_bytes){
                                           ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:334:29: error: use of undeclared identifier 'XOpenDisplay'
                        d = XOpenDisplay(NULL);
                            ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:337:33: error: use of undeclared identifier 'XOpenDisplay'
                            d = XOpenDisplay(":0.0");
                                ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:369:29: error: use of undeclared identifier 'XFreeFontSet'
                            XFreeFontSet(d, fs);
                            ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:371:30: error: use of undeclared identifier 'XCreateFontSet'
                        fs = XCreateFontSet(d, fontset, &mlist, &mcount, &def_str);
                             ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:376:34: error: use of undeclared identifier 'XExtentsOfFontSet'
                        extent = XExtentsOfFontSet(fs);
                                 ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:379:25: error: use of undeclared identifier 'XFreeStringList'; did you mean 'XwcFreeStringList'?
                        XFreeStringList(mlist);
                        ^~~~~~~~~~~~~~~
                        XwcFreeStringList
/Users/karishmaasthana/anaconda2/include/X11/Xutil.h:777:13: note: 'XwcFreeStringList' declared here
extern void XwcFreeStringList(
            ^
In file included from /Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/fonts.cpp:16:
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:379:41: error: cannot initialize a parameter of type 'wchar_t **' with an lvalue of type 'char **'
                        XFreeStringList(mlist);
                                        ^~~~~
/Users/karishmaasthana/anaconda2/include/X11/Xutil.h:781:1: note: passing argument to parameter here
);
^
In file included from /Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/fonts.cpp:16:
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:388:29: error: use of undeclared identifier 'XFreeGC'
                            XFreeGC(d, gc);
                            ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:389:29: error: use of undeclared identifier 'XFreePixmap'
                            XFreePixmap(d, pix);
                            ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:393:103: error: use of undeclared identifier 'XDefaultDepth'
                        pix = XCreatePixmap(d, DefaultRootWindow(d), pix_width_prev, pix_height_prev, XDefaultDepth(d, DefaultScreen(d)));
                                                                                                      ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:394:30: error: use of undeclared identifier 'XCreateGC'
                        gc = XCreateGC(d, pix, 0, NULL);
                             ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:398:21: error: use of undeclared identifier 'XSetForeground'
                    XSetForeground(d, gc, backcolor);
                    ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:399:21: error: use of undeclared identifier 'XSetBackground'
                    XSetBackground(d, gc, backcolor);
                    ^
/Users/karishmaasthana/workspace/dlib/dlib/gui_widgets/nativefont.h:400:21: error: use of undeclared identifier 'XFillRectangle'
                    XFillRectangle(d, pix, gc, 0, 0, width, height);
                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [dlib_build/CMakeFiles/dlib.dir/gui_widgets/fonts.cpp.o] Error 1
make[1]: *** [dlib_build/CMakeFiles/dlib.dir/all] Error 2
make: *** [all] Error 2
error: cmake build failed!

我尝试打开和关闭USE_SSE4_INSTRUCTIONS。我也试过打开和关闭DUSE_AVX_INSTRUCTIONS

有人对我可以尝试什么有什么建议吗?

【问题讨论】:

  • 您似乎缺少 X.org 包含。
  • 如果你正在使用python3,那么你需要在brew uninstall boost-pythonbrew uninstall boostbrew install boost-python --with-python3 --without-python之前这样做。

标签: python cmake dlib


【解决方案1】:

XQuartz 丢失。从这里安装它https://www.xquartz.org/

【讨论】:

    猜你喜欢
    • 2017-08-04
    • 2017-04-26
    • 2021-12-02
    • 2020-04-17
    • 1970-01-01
    • 2018-06-22
    • 2019-06-26
    • 2020-01-16
    • 2020-08-21
    相关资源
    最近更新 更多