Install Pebble SDK on Mac OSX

今天在 Macbook 裝了 Pebble SDK,過程中有一點插曲,做個記錄。 針對 Mac 平台,Pebble SDK 的安裝步驟說明算是很詳細了,依照步驟來做基本上沒太大問題。

注意事項:

  • 目前 Pebble SDK 需要 Python 2.7,尚未支援 Python 3
  • 需要事先安裝好 Xcode Command Line Tools
  • Xcode 要先啟動過一次,做過 License agree 確認(就是第一次啟動 Xcode 要按下 Agree 按鈕)
  • 下載最新的 Pebble SDK,目前的版本是 3.4
  • 安裝過程會用到 Homebrew (以前安裝其他 package 需要 MacPort,而這裡需要 Homebrew,兩套又不相容,傷腦筋)

安裝步驟:

Step 1. 開啟 terminal 視窗,建立一個目錄存放 Pebble tools

mkdir ~/pebble-dev/

Step 2. 進入 pebble-dev 目錄並且解壓縮 Pebble SDK

cd ~/pebble-dev/

tar -zxf ~/Downloads/PebbleSDK-3.4.tar

現在 ~/pebble-dev/ 目錄下,應該會有一個 PebbleSDK-3.4 子目錄

Step 3. 修改 PATH 環境變數,並且重新載入 .bash_profile

echo 'export PATH=~/pebble-dev/PebbleSDK-3.4/bin:$PATH' >> ~/.bash_profile

. ~/.bash_profile

Step 4. 下載 Pebble ARM toolchain

Step 5. 把 toolchain 解壓縮到 ~/pebble-dev/PebbleSDK-3.4

cd ~/pebble-dev/PebbleSDK-3.4

tar -zxf ~/Downloads/arm-cs-tools-macos-universal-static.tar # "~/Downloads/arm-cs-tools-macos-universal-static.tar" 要換成你下載回來的 toolchain 所在位置

現在 ~/pebble-dev/PebbleSDK-3.4 目錄下,應該會有一個 arm-cs-tools 子目錄

Pebble SDK 依賴特定的 Python libraries 把字型和圖片從電腦端轉換為 Pebble 平台的資源。 先使用 Python 的 easy_install package manager 來安裝另一套 package manager: pip,後續會用 pip 來安裝其他(Pebble SDK 所需)的 Python libraries。

Step 6. 安裝 pip 和 virtualenv

sudo easy_install pip

sudo pip install virtualenv

Step 7. 安裝 Pebble SDK 所需的 Python 套件

cd ~/pebble-dev/PebbleSDK-3.4

virtualenv --no-site-packages .env

source .env/bin/activate

CFLAGS="" pip install -r requirements.txt # 錯誤!

我執行到這一行的時候遇到以下錯誤:

Requirement already satisfied (use --upgrade to upgrade): freetype-py==1.0 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): sh==1.09 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): libpebble2>=0.0.8 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): enum34==1.0.4 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): httplib2==0.9.1 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied (use --upgrade to upgrade): oauth2client==1.4.12 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 6))
Requirement already satisfied (use --upgrade to upgrade): progressbar2==2.7.3 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 7))
Requirement already satisfied (use --upgrade to upgrade): pyasn1==0.1.8 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 8))
Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules==0.0.6 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 9))
Requirement already satisfied (use --upgrade to upgrade): pypng==0.0.17 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 10))
Requirement already satisfied (use --upgrade to upgrade): pyqrcode==1.1 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 11))
Requirement already satisfied (use --upgrade to upgrade): requests==2.7.0 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 12))
Requirement already satisfied (use --upgrade to upgrade): rsa==3.1.4 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 13))
Requirement already satisfied (use --upgrade to upgrade): pyserial==2.7 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 14))
Requirement already satisfied (use --upgrade to upgrade): six==1.9.0 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 15))
Requirement already satisfied (use --upgrade to upgrade): websocket-client==0.32.0 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 16))
Requirement already satisfied (use --upgrade to upgrade): wheel==0.24.0 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 17))
Requirement already satisfied (use --upgrade to upgrade): colorama==0.3.3 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 18))
Requirement already satisfied (use --upgrade to upgrade): backports.ssl-match-hostname==3.4.0.2 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 19))
Collecting gevent==1.0.2 (from -r requirements.txt (line 20))
  Using cached gevent-1.0.2.tar.gz
Collecting gevent-websocket==0.9.3 (from -r requirements.txt (line 21))
  Using cached gevent_websocket-0.9.3-py27-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): greenlet==0.4.7 in ./.env/lib/python2.7/site-packages (from -r requirements.txt (line 22))
Collecting peewee==2.4.7 (from -r requirements.txt (line 23))
Collecting pygeoip==0.3.2 (from -r requirements.txt (line 24))
  Using cached pygeoip-0.3.2-py2.py3-none-any.whl
Collecting python-dateutil==2.4.1 (from -r requirements.txt (line 25))
  Using cached python_dateutil-2.4.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): wsgiref==0.1.2 in /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 (from -r requirements.txt (line 26))
Building wheels for collected packages: gevent
  Running setup.py bdist_wheel for gevent
  Complete output from command /Users/USERNAME/pebble-dev/PebbleSDK-3.4/.env/bin/python -c "import setuptools;__file__='/private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/tmpr24hsipip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.10-intel-2.7
  creating build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/__init__.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/_ssl2.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/_sslgte279.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/_threading.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/backdoor.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/baseserver.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/coros.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/event.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/fileobject.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/greenlet.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/hub.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/local.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/lock.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/monkey.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/os.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/pool.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/pywsgi.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/queue.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/resolver_ares.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/resolver_thread.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/select.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/server.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/socket.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/ssl.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/subprocess.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/thread.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/threading.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/threadpool.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/timeout.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/util.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/win32util.py -> build/lib.macosx-10.10-intel-2.7/gevent
  copying gevent/wsgi.py -> build/lib.macosx-10.10-intel-2.7/gevent
  running build_ext
  Running '/bin/sh /private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent/libev/configure > configure-output.txt' in /private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent/build/temp.macosx-10.10-intel-2.7/libev
  building 'gevent.core' extension
  creating build/temp.macosx-10.10-intel-2.7/gevent
  cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -U__llvm__ -arch x86_64 -arch i386 -pipe -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.10-intel-2.7/libev -Ilibev -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.10-intel-2.7/gevent/gevent.core.o
  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 'cc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for gevent
Failed to build gevent
Installing collected packages: gevent, gevent-websocket, peewee, pygeoip, python-dateutil
  Running setup.py install for gevent
    Complete output from command /Users/USERNAME/pebble-dev/PebbleSDK-3.4/.env/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-jPs3ot-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/USERNAME/pebble-dev/PebbleSDK-3.4/.env/include/site/python2.7/gevent:
    running install
    running build
    running build_py
    running build_ext
    building 'gevent.core' extension
    cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -U__llvm__ -arch x86_64 -arch i386 -pipe -DLIBEV_EMBED=1 -DEV_COMMON= -DEV_CLEANUP_ENABLE=0 -DEV_EMBED_ENABLE=0 -DEV_PERIODIC_ENABLE=0 -Ibuild/temp.macosx-10.10-intel-2.7/libev -Ilibev -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c gevent/gevent.core.c -o build/temp.macosx-10.10-intel-2.7/gevent/gevent.core.o
    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 'cc' failed with exit status 1

    ----------------------------------------
Command "/Users/USERNAME/pebble-dev/PebbleSDK-3.4/.env/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-jPs3ot-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/USERNAME/pebble-dev/PebbleSDK-3.4/.env/include/site/python2.7/gevent" failed with error code 1 in /private/var/folders/j5/m4c8w3492k9gj8ygb6f7b4fm0000gn/T/pip-build-T3_Mru/gevent

TroubleShooting:

這一大段 log 乍看很複雜,加上我不熟 Python,仔細看了一下感覺像是 compile error,從 log 抓了幾個關鍵字: osx python gevent fail _Noreturn 去問孤狗大神,果然在 StackOverflow 有人問過類似的問題

原來是 C compiler 版本的問題,用以下指令,換一個 C compiler 來 build 就 OK 了!

CFLAGS='-std=c99' pip install gevent

執行結果:

Collecting gevent
  Using cached gevent-1.0.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.4.7 in ./.env/lib/python2.7/site-packages (from gevent)
Building wheels for collected packages: gevent
  Running setup.py bdist_wheel for gevent
  Stored in directory: /Users/USERNAME/Library/Caches/pip/wheels/b4/c5/69/cb36960ac7193f6441df14dd58bf639bf944d37dd68c6edf32
Successfully built gevent
Installing collected packages: gevent
Successfully installed gevent-1.0.2

再執行一次 CFLAGS="" pip install -r requirements.txt

執行結果:

...... (以上省略)
Installing collected packages: gevent-websocket, peewee, pygeoip, python-dateutil
Successfully installed gevent-websocket-0.9.3 peewee-2.4.7 pygeoip-0.3.2 python-dateutil-2.4.1

最後,執行 deactivate

Step 8. 安裝 Pebble SDK 處理字型所需的 freetype library

brew install freetype

執行結果:

Warning: freetype-2.6_1 already installed

Step 9. 安裝 Pebble 模擬器所需的 library

brew update

brew install boost-python

執行結果:

Warning: boost-python-1.58.0 already installed

brew install glib

執行結果:

Warning: glib-2.44.1 already installed

brew install pixman

執行結果:

Warning: pixman-0.32.6 already installed

以上,Pebble SDK on Mac OSX 就安裝完成了。

Reference:

Comments

Comments powered by Disqus