2015-09-05 162 views
39

試圖在OSX 10.11上使用Homebrew安裝gevent最新的公共測試版。當運行安裝,它輸出以下錯誤(對不起,我的大牆的代碼,不知道到底哪裏出錯)無法安裝gevent OSX 10.11

clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I /opt/local/include -L /opt/local/lib -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.11-x86_64-2.7/libev -Ilibev -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.11-x86_64-2.7/gevent/gevent.core.o 
    clang: warning: argument unused during compilation: '-L/opt/local/lib' 
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    libev/ev.c:483:48: warning: '/*' within block comment [-Wcomment] 
    /*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */ 
               ^
    libev/ev.c:1029:42: error: '_Noreturn' keyword must precede function declarator 
    ecb_inline void ecb_unreachable (void) ecb_noreturn; 
              ^~~~~~~~~~~~ 
    _Noreturn 
    libev/ev.c:832:26: note: expanded from macro 'ecb_noreturn' 
    #define ecb_noreturn _Noreturn 
         ^
    libev/ev.c:1625:31: warning: 'extern' variable has an initializer [-Wextern-initializer] 
    EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */ 
           ^
    libev/ev.c:1796:7: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:1807:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:1934:7: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    In file included from libev/ev.c:2484: 
    libev/ev_kqueue.c:50:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    In file included from libev/ev.c:2490: 
    libev/ev_poll.c:66:7: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:3648:34: warning: '&' within '|' [-Wbitwise-op-parentheses] 
    fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); 
         ~~~~~~~~~~^~~~~~~~~~~~~ ~ 
    libev/ev.c:3648:34: note: place parentheses around the '&' expression to silence this warning 
    fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); 
           ^
         (     ) 
    libev/ev.c:3687:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:4367:5: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:4407:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:4445:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:4592:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    libev/ev.c:4675:3: warning: unused variable 'ocur_' [-Wunused-variable] 
    array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
     int ecb_unused ocur_ = (cur);          \ 
        ^
    14 warnings and 1 error generated. 
    error: command 'clang' failed with exit status 1 

    ---------------------------------------- 
    Failed building wheel for gevent 
Failed to build gevent 
Installing collected packages: gevent 
    Running setup.py install for gevent 
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-9VpZCX-record/install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_py 
    running build_ext 
    building 'gevent.core' extension 
    clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I /opt/local/include -L /opt/local/lib -U__llvm__ -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.11-x86_64-2.7/libev -Ilibev -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.11-x86_64-2.7/gevent/gevent.core.o 
    clang: warning: argument unused during compilation: '-L/opt/local/lib' 
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    libev/ev.c:483:48: warning: '/*' within block comment [-Wcomment] 
    /*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */ 
               ^
    libev/ev.c:1029:42: error: '_Noreturn' keyword must precede function declarator 
     ecb_inline void ecb_unreachable (void) ecb_noreturn; 
              ^~~~~~~~~~~~ 
     _Noreturn 
    libev/ev.c:832:26: note: expanded from macro 'ecb_noreturn' 
     #define ecb_noreturn _Noreturn 
          ^
    libev/ev.c:1625:31: warning: 'extern' variable has an initializer [-Wextern-initializer] 
     EV_API_DECL struct ev_loop *ev_default_loop_ptr = 0; /* needs to be initialised to make it a definition despite extern */ 
           ^
    libev/ev.c:1796:7: warning: unused variable 'ocur_' [-Wunused-variable] 
      array_needsize (ANPENDING, pendings [pri], pendingmax [pri], w_->pending, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:1807:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (W, rfeeds, rfeedmax, rfeedcnt + 1, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:1934:7: warning: unused variable 'ocur_' [-Wunused-variable] 
      array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    In file included from libev/ev.c:2484: 
    libev/ev_kqueue.c:50:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (struct kevent, kqueue_changes, kqueue_changemax, kqueue_changecnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    In file included from gevent/gevent.core.c:249: 
    In file included from gevent/libev.h:2: 
    In file included from libev/ev.c:2490: 
    libev/ev_poll.c:66:7: warning: unused variable 'ocur_' [-Wunused-variable] 
      array_needsize (struct pollfd, polls, pollmax, pollcnt, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:3648:34: warning: '&' within '|' [-Wbitwise-op-parentheses] 
     fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); 
          ~~~~~~~~~~^~~~~~~~~~~~~ ~ 
    libev/ev.c:3648:34: note: place parentheses around the '&' expression to silence this warning 
     fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY); 
            ^
          (     ) 
    libev/ev.c:3687:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ANHE, timers, timermax, ev_active (w) + 1, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:4367:5: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2); 
     ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:4407:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_prepare *, prepares, preparemax, preparecnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:4445:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_check *, checks, checkmax, checkcnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:4592:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    libev/ev.c:4675:3: warning: unused variable 'ocur_' [-Wunused-variable] 
     array_needsize (ev_async *, asyncs, asyncmax, asynccnt, EMPTY2); 
    ^
    libev/ev.c:1758:22: note: expanded from macro 'array_needsize' 
      int ecb_unused ocur_ = (cur);          \ 
         ^
    14 warnings and 1 error generated. 
    error: command 'clang' failed with exit status 1 

    ---------------------------------------- 
Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-9VpZCX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/q8/1c24n_wj6kzc6kgl7629pwyh0000gn/T/pip-build-3zCPVx/gevent 

回答

93

使用CFLAGS='-std=c99' pip install gevent來解決這個問題。

在OS X 10.11上,clang使用c11作爲默認值,因此只需將其重新設置爲c99即可。

+4

我有10.10.5,無法安裝gevent,並解決了我的問題。 – red

+1

好主人這使我在OSX 10.10.5上遇到了同樣的問題,並將CFLAGS設置爲root,並安裝'gevent'完成了這個訣竅 - 謝謝! – Wells

+0

這也適用於我。他們的設置腳本應該處理這個... – ysakamoto

12

我跑進我的OSX 10.10.5同樣的問題,試圖安裝flask-socketio,這GEVENT作爲依賴,但是:

sudo CFLAGS='-std=c99' pip install flask-socketio 

給我

Successfully installed flask-socketio-0.6.0 gevent-1.0.2 gevent-socketio-0.3.6 gevent-websocket-0.9.5 

所以,tonicbupt的答案也爲此工作。

+0

在10.11上,我不得不使用'sudo CFLAGS =' - std = c99'pip install flask-socketio --no-use-wheel'來啓動它。 –

5

我浪費了我的時間爲2天,下面的解決方案爲Mac用戶...

pip install gevent==1.1b5 

解決方案:gevent fails to install in a python virtual environment on OS X Capitan

+0

雖然此鏈接可以回答這個問題,最好是在這裏有答案的主要部件,並提供鏈接以供參考。如果鏈接頁面更改,則僅鏈接答案可能會失效。 - [來自評論](/ review/low-quality-posts/10647395) – fasteque

+1

感謝您的評論。只是'pip安裝gevent == 1.1b5'解決了我的問題。我不認爲這是一個「鏈接」的答案。 –

3

在Mac OS X埃爾卡皮坦,我不得不這樣做雙方的事情在前面的答案中提到過,設置CFLAGS變量並降級gevent,但我必須使用1.0版來清除編譯器錯誤。

CFLAGS='-std=c99' pip install gevent==1.0 
+1

1.0.2是OK的酋長,與CFLAGS如上,但C編譯器產生相當多的warings – tgdavies

1

正如其PyPI instruction描述,

pip install --pre gevent

應該安裝一個發佈候選版(1.1rc4爲2016年2月22日的),對於OS X 10.11作品。

0

此時,gevent 1.1.0 final以OS X的二進制輪形式發佈,並且pip將默認安裝它。適用於OS X的gevent 1.0.2的二進制輪也適用於那些無法升級到新版本的用戶。這兩個測試都已經過測試,可以在OS X 10.11上安裝,包括Apple發佈的Python 2.6和2.7,以及從python.org下載的2.7 Python。 (如果您在安裝二進制輪子時遇到問題,您可能需要更新您的點的版本。)

因此,除非您必須從源代碼編譯1.0.2,否則不需要再設置任何特殊的CFLAGS。 (1.1.0不會遇到這個問題)。

請注意,輪子是爲Python的「窄」unicode構建而發佈的,所以如果您使用「wide」構建,則需要編譯資源。在這種情況下,爲gevent 1.0.2(但不是1.1.0)需要設置CFLAGS =「 - std = c99」。