ubuntu 16.04(x64)编译并烧录NodeMCU固件

最近在捣鼓NodeMCU,中间各种折腾,下面记录一下编译固件的过程。

首先参考 ubuntu 16.04(x64)构建NodeMCU编译工具链 来构建工具链,然后把工具链加入到环境变量。

然后就是下载固件代码并进行编译了

$ git clone https://github.com/nodemcu/nodemcu-firmware.git

$ cd nodemcu-firmware

$ export PATH=/opt/Espressif/esp-open-sdk/xtensa-lx106-elf/bin:$PATH

$ make

#根据自己的设备实际情况选择4M还是512k的版本
$ make flash4m

如果存在下载问题,可以本站下载一份代码拷贝。点击此处下载

只要NodeMCU开发板通电或重置,就会执行init.lua脚本。因此,我们把自己的代码写在这个脚本里面即可。然后用luatool更新到NodeMCU设备里面即可。

$ sudo pip2 install pyserial

$ sudo pip2 install esptool

$ git clone https://github.com/4refr0nt/luatool.git

$ cd luatool/luatool

$ python2 luatool.py --port /dev/ttyUSB0 --src init.lua --dest init.lua --verbose -b 115200

注意上面的代码中,--port参数需要根据实际情况进行修改,--src参数也是一样需要根据我们实际的文件名来调整,最后的-b指定波特率,上面固件编译后默认的波特率是115200,淘宝上卖的设备,很多是默认9600的,这个要注意。

如果上面的代码下载存在问题,可以本站下载一份拷贝 点击这里下载luatool
继续阅读ubuntu 16.04(x64)编译并烧录NodeMCU固件

ubuntu 16.04(x64)构建NodeMCU编译工具链

最近在捣鼓NodeMCU,中间各种折腾,下面记录一下编译工具链的过程。

官方推荐的操作过程如下:

$ sudo mkdir /opt/Espressif 

$ sudo chown `whoami` /opt/Espressif/ 

$ cd /opt/Espressif 

$ sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 python-serial libexpat-dev

$ sudo apt install help2man

$ sudo apt-get install libtool-bin

$ git clone --recursive https://github.com/pfalcon/esp-open-sdk.git

$ cd esp-open-sdk

$ make STANDALONE=y

$ export PATH=$PWD/xtensa-lx106-elf/bin:$PATH

上面操作中最慢的依旧是下载依赖的工具链的源代码部分,可以从本站下载一份已经下载完全部依赖项目的编译环境。点击此处下载

本站下载的文件,直接执行make命令即可,不要执行make clean,make clean会删除ESP8266_NONOS_SDK文件夹,导致编译不通过。这种情况,可以还原Makefile,再次去服务器上拉取文件即可。

编译完成后,注意以下几个路径

  • esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/usr/include/为头文件的所在目录
  • esp-open-sdk/xtensa-lx106-elf/bin为工具链所在目录
  • esp-open-sdk/xtensa-lx106-elf/xtensa-lx106-elf/sysroot/lib为链接库目录

上面的几个路径在编译源代码的时候会用到。

以下的操作过程可以通过,但是已经过时,在实际编译新项目的时候,可能会出现异常,已经不推荐了。

$ sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-amd64 python-serial libexpat-dev

$ sudo apt-get install libtool-bin

$ sudo mkdir /opt/Espressif

$ sudo chown `whoami` /opt/Espressif/

$ cd /opt/Espressif

$ git clone -b lx106 git://github.com/jcmvbkbc/crosstool-NG.git 

$ cd crosstool-NG

$ ./bootstrap && ./configure --prefix=`pwd` && make && make install

$ ./ct-ng xtensa-lx106-elf

$ ./ct-ng build

$ PATH=$PWD/builds/xtensa-lx106-elf/bin:$PATH

对于上面的命令执行过程中,往往卡住在ct-ng build这个位置,观察目录下的build.log会发现总是卡住在文件下载的位置,大量的链接无法正确下载,都是国情导致的。

如果出现下载问题,一般建议从本站下载一份已经下载好的文件,当然,也可以手工从其他镜像站点逐个手工下载依赖的源代码压缩包。

参考操作如下:

$ cd /opt/Espressif/crosstool-NG

$ mkdir .build

$ cd .build

$ wget http://www.mobibrw.com/wp-content/uploads/2018/08/tarballs.zip

$ unzip tarballs.zip

$ rm -rf tarballs.zip

然后重新执行ct-ng build命令即可。

如果上面的代码下载存在问题,可以从本站下载一份拷贝,点击下载crosstool-NG

已经编译好的工具链,可以从本站下载,点击这里下载 xtensa-lx106-elf

参考链接


esp8266/esp8266-wiki/Toolchain

ubuntu 16.04编译NodeMCU-pyFlasher

最近在捣鼓NodeMCU,中间各种折腾,下面记录一下编译固件烧录工具的过程。

首先安装依赖包:

$ sudo apt-get install python3-pip

$ sudo pip3 install --upgrade pip

$ sudo pip3 install wxpython

$ sudo apt-get install pyseria

安装wxpython的时候,如果遇到问题,参考 ubuntu 16.04在Python3上安装wxpython-4.0.3

下载代码

$ sudo apt-get install git

$ git clone https://github.com/marcelstoer/nodemcu-pyflasher.git

如果源代码下载存在问题,可以本站下载一份拷贝

点击这里下载

编译并运行

$ cd nodemcu-pyflasher

$ bash build.sh

$ python3 Main.py

ubuntu 16.04在Python3上安装wxpython-4.0.3

需要在ubuntu 16.04上安装Python3需要使用的wxpython-4.0.3,中间过程如下:

$ sudo apt-get install python3-pip

$ sudo apt-get install build-essential

$ sudo pip3 install --upgrade pip

$ sudo pip3 install wxpython

如果提示如下错误信息:

    checking for pkg-config... no
    checking for GTK+ - version >= 3.0.0... no
    *** A new enough version of pkg-config was not found.
    *** See http://pkgconfig.sourceforge.net
    configure: error:
    The development files for GTK+ were not found. For GTK+ 2, please
    ensure that pkg-config is in the path and that gtk+-2.0.pc is
    installed. For GTK+ 1.2 please check that gtk-config is in the path,
    and that the version is 1.2.3 or above. Also check that the
    libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
    --libs' are in the LD_LIBRARY_PATH or equivalent.
    
    Error running configure
    ERROR: failed building wxWidgets
    Traceback (most recent call last):
      File "build.py", line 1321, in cmd_build_wx
        wxbuild.main(wxDir(), build_options)
      File "/tmp/pip-build-i74kd49w/wxpython/buildtools/build_wxwidgets.py", line 375, in main
        "Error running configure")
      File "/tmp/pip-build-i74kd49w/wxpython/buildtools/build_wxwidgets.py", line 85, in exitIfError
        raise builder.BuildError(msg)
    buildtools.builder.BuildError: Error running configure
    Finished command: build_wx (0m2.471s)
    Finished command: build (0m2.471s)
    Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-i74kd49w/wxpython/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-kx0e4kl4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-i74kd49w/wxpython/

则执行如下命令:

$ sudo apt-get install build-essential libgtk-3-dev

如果出现如下错误信息:

    checking for GST... configure: WARNING: GStreamer 1.0 not available, falling back to 0.10
    checking for GST... configure: WARNING: GStreamer 0.10 not available, falling back to 0.8
    configure: error: GStreamer not available
    Error running configure
    ERROR: failed building wxWidgets
    Traceback (most recent call last):
      File "build.py", line 1321, in cmd_build_wx
        wxbuild.main(wxDir(), build_options)
      File "/tmp/pip-install-_6rbj1se/wxpython/buildtools/build_wxwidgets.py", line 375, in main
        "Error running configure")
      File "/tmp/pip-install-_6rbj1se/wxpython/buildtools/build_wxwidgets.py", line 85, in exitIfError
        raise builder.BuildError(msg)
    buildtools.builder.BuildError: Error running configure
    Finished command: build_wx (0m5.302s)
    Finished command: build (0m5.302s)
    Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-_6rbj1se/wxpython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-gkelw1g2/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-_6rbj1se/wxpython/

则执行如下命令:

$ sudo apt install libgstreamer-plugins-base1.0-dev

如果出现如下错误信息:

   ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp: In function ‘PyObject* meth_wxWebViewHistoryItem_GetUrl(PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:24:10: error: ‘::wxWebViewHistoryItem’ has not been declared
              ::wxWebViewHistoryItem *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:24:34: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewHistoryItem *sipCpp;
                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp: In function ‘PyObject* meth_wxWebViewHistoryItem_GetTitle(PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:58:10: error: ‘::wxWebViewHistoryItem’ has not been declared
              ::wxWebViewHistoryItem *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:58:34: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewHistoryItem *sipCpp;
                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp: In function ‘void release_wxWebViewHistoryItem(void*, int)’:
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:90:32: error: ‘wxWebViewHistoryItem’ in namespace ‘::’ does not name a type
         delete reinterpret_cast< ::wxWebViewHistoryItem *>(sipCppV);
                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:90:53: error: expected ‘>’ before ‘*’ token
         delete reinterpret_cast< ::wxWebViewHistoryItem *>(sipCppV);
                                                         ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:90:53: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:90:54: error: expected primary-expression before ‘>’ token
         delete reinterpret_cast< ::wxWebViewHistoryItem *>(sipCppV);
                                                          ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:90:64: error: expected ‘)’ before ‘;’ token
         delete reinterpret_cast< ::wxWebViewHistoryItem *>(sipCppV);
                                                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp: In function ‘void* init_type_wxWebViewHistoryItem(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:109:6: error: ‘::wxWebViewHistoryItem’ has not been declared
          ::wxWebViewHistoryItem *sipCpp = 0;
          ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:109:30: error: ‘sipCpp’ was not declared in this scope
          ::wxWebViewHistoryItem *sipCpp = 0;
                                  ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:127:27: error: expected type-specifier before ‘::’ token
                 sipCpp = new  ::wxWebViewHistoryItem(*url,*title);
                               ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:134:24: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
                     delete sipCpp;
                            ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:143:18: error: ‘wxWebViewHistoryItem’ in namespace ‘::’ does not name a type
             const  ::wxWebViewHistoryItem* a0;
                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:145:114: error: ‘a0’ was not declared in this scope
             if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, NULL, sipUnused, "J9", sipType_wxWebViewHistoryItem, &a0))
                                                                                                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHistoryItem.cpp:148:27: error: expected type-specifier before ‘::’ token
                 sipCpp = new  ::wxWebViewHistoryItem(*a0);
                               ^
    
    ../../../../sip/cpp/sip_html2wxWebView.cpp:50:45: error: ‘wxWebView’ was not declared in this scope
         PyObject* _wxWebView_GetBackwardHistory(wxWebView* self)
                                                 ^
    ../../../../sip/cpp/sip_html2wxWebView.cpp:50:56: error: ‘self’ was not declared in this scope
         PyObject* _wxWebView_GetBackwardHistory(wxWebView* self)
                                                            ^
    ../../../../sip/cpp/sip_html2wxWebView.cpp:51:5: error: expected ‘,’ or ‘;’ before ‘{’ token
         {
         ^
    
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:18:1: error: expected class-name before ‘{’ token
     {
     ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:21:34: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
         sipwxWebViewHandler(const  ::wxWebViewHandler&);
                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In constructor ‘sipwxWebViewHandler::sipwxWebViewHandler(const wxString&)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:42:89: error: expected class-name before ‘(’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxString& scheme):  ::wxWebViewHandler(scheme), sipPySelf(0)
                                                                                             ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:42:89: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:42:97: error: expected constructor, destructor, or type conversion before ‘,’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxString& scheme):  ::wxWebViewHandler(scheme), sipPySelf(0)
                                                                                                     ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:42:108: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxString& scheme):  ::wxWebViewHandler(scheme), sipPySelf(0)
                                                                                                                ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:47:51: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxWebViewHandler& a0):  ::wxWebViewHandler(a0), sipPySelf(0)
                                                       ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In constructor ‘sipwxWebViewHandler::sipwxWebViewHandler(const int&)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:47:93: error: expected class-name before ‘(’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxWebViewHandler& a0):  ::wxWebViewHandler(a0), sipPySelf(0)
                                                                                                 ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:47:93: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:47:97: error: expected constructor, destructor, or type conversion before ‘,’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxWebViewHandler& a0):  ::wxWebViewHandler(a0), sipPySelf(0)
                                                                                                     ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:47:108: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewHandler::sipwxWebViewHandler(const  ::wxWebViewHandler& a0):  ::wxWebViewHandler(a0), sipPySelf(0)
                                                                                                                ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In member function ‘wxString sipwxWebViewHandler::GetName() const’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:65:19: error: ‘::wxWebViewHandler’ has not been declared
             return  ::wxWebViewHandler::GetName();
                       ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In function ‘PyObject* meth_wxWebViewHandler_GetFile(PyObject*, PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:99:10: error: ‘::wxWebViewHandler’ has not been declared
              ::wxWebViewHandler *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:99:30: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewHandler *sipCpp;
                                  ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In function ‘PyObject* meth_wxWebViewHandler_GetName(PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:145:18: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
             const  ::wxWebViewHandler *sipCpp;
                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:147:91: error: ‘sipCpp’ was not declared in this scope
             if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_wxWebViewHandler, &sipCpp))
                                                                                               ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:154:66: error: ‘::wxWebViewHandler’ has not been declared
                 sipRes = new  ::wxString((sipSelfWasArg ? sipCpp-> ::wxWebViewHandler::GetName() : sipCpp->GetName()));
                                                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In function ‘void release_wxWebViewHandler(void*, int)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:180:36: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
             delete reinterpret_cast< ::wxWebViewHandler *>(sipCppV);
                                        ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:180:53: error: expected ‘>’ before ‘*’ token
             delete reinterpret_cast< ::wxWebViewHandler *>(sipCppV);
                                                         ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:180:53: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:180:54: error: expected primary-expression before ‘>’ token
             delete reinterpret_cast< ::wxWebViewHandler *>(sipCppV);
                                                          ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:180:64: error: expected ‘)’ before ‘;’ token
             delete reinterpret_cast< ::wxWebViewHandler *>(sipCppV);
                                                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp: In function ‘void* init_type_wxWebViewHandler(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:234:18: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
             const  ::wxWebViewHandler* a0;
                      ^
    ../../../../sip/cpp/sip_html2wxWebViewHandler.cpp:236:110: error: ‘a0’ was not declared in this scope
             if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, NULL, sipUnused, "J9", sipType_wxWebViewHandler, &a0))
                                                                                                                  ^
    
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:18:1: error: expected class-name before ‘{’ token
     {
     ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:21:36: error: ‘wxWebViewFSHandler’ in namespace ‘::’ does not name a type
         sipwxWebViewFSHandler(const  ::wxWebViewFSHandler&);
                                        ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In constructor ‘sipwxWebViewFSHandler::sipwxWebViewFSHandler(const wxString&)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:42:95: error: expected class-name before ‘(’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxString& scheme):  ::wxWebViewFSHandler(scheme), sipPySelf(0)
                                                                                                   ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:42:95: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:42:103: error: expected constructor, destructor, or type conversion before ‘,’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxString& scheme):  ::wxWebViewFSHandler(scheme), sipPySelf(0)
                                                                                                           ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:42:114: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxString& scheme):  ::wxWebViewFSHandler(scheme), sipPySelf(0)
                                                                                                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:47:55: error: ‘wxWebViewFSHandler’ in namespace ‘::’ does not name a type
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxWebViewFSHandler& a0):  ::wxWebViewFSHandler(a0), sipPySelf(0)
                                                           ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In constructor ‘sipwxWebViewFSHandler::sipwxWebViewFSHandler(const int&)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:47:101: error: expected class-name before ‘(’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxWebViewFSHandler& a0):  ::wxWebViewFSHandler(a0), sipPySelf(0)
                                                                                                         ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:47:101: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:47:105: error: expected constructor, destructor, or type conversion before ‘,’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxWebViewFSHandler& a0):  ::wxWebViewFSHandler(a0), sipPySelf(0)
                                                                                                             ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:47:116: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewFSHandler::sipwxWebViewFSHandler(const  ::wxWebViewFSHandler& a0):  ::wxWebViewFSHandler(a0), sipPySelf(0)
                                                                                                                        ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In member function ‘wxFSFile* sipwxWebViewFSHandler::GetFile(const wxString&)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:65:19: error: ‘::wxWebViewFSHandler’ has not been declared
             return  ::wxWebViewFSHandler::GetFile(uri);
                       ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In member function ‘wxString sipwxWebViewFSHandler::GetName() const’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:80:19: error: ‘::wxWebViewFSHandler’ has not been declared
             return  ::wxWebViewFSHandler::GetName();
                       ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In function ‘PyObject* meth_wxWebViewFSHandler_GetFile(PyObject*, PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:99:10: error: ‘::wxWebViewFSHandler’ has not been declared
              ::wxWebViewFSHandler *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:99:32: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewFSHandler *sipCpp;
                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:112:50: error: ‘::wxWebViewFSHandler’ has not been declared
                 sipRes = (sipSelfWasArg ? sipCpp-> ::wxWebViewFSHandler::GetFile(*uri) : sipCpp->GetFile(*uri));
                                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In function ‘void* cast_wxWebViewFSHandler(void*, const sipTypeDef*)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:6: error: ‘::wxWebViewFSHandler’ has not been declared
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
          ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:28: error: ‘sipCpp’ was not declared in this scope
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:57: error: ‘wxWebViewFSHandler’ in namespace ‘::’ does not name a type
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                             ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:76: error: expected ‘>’ before ‘*’ token
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                                                ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:76: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:77: error: expected primary-expression before ‘>’ token
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                                                 ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:134:87: error: expected ‘)’ before ‘;’ token
          ::wxWebViewFSHandler *sipCpp = reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                                                           ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:137:31: error: ‘wxWebViewHandler’ in namespace ‘::’ does not name a type
             return static_cast< ::wxWebViewHandler *>(sipCpp);
                                   ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:137:48: error: expected ‘>’ before ‘*’ token
             return static_cast< ::wxWebViewHandler *>(sipCpp);
                                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:137:48: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:137:49: error: expected primary-expression before ‘>’ token
             return static_cast< ::wxWebViewHandler *>(sipCpp);
                                                     ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:137:58: error: expected ‘)’ before ‘;’ token
             return static_cast< ::wxWebViewHandler *>(sipCpp);
                                                              ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In function ‘void release_wxWebViewFSHandler(void*, int)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:152:36: error: ‘wxWebViewFSHandler’ in namespace ‘::’ does not name a type
             delete reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                        ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:152:55: error: expected ‘>’ before ‘*’ token
             delete reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                           ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:152:55: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:152:56: error: expected primary-expression before ‘>’ token
             delete reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                            ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:152:66: error: expected ‘)’ before ‘;’ token
             delete reinterpret_cast< ::wxWebViewFSHandler *>(sipCppV);
                                                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp: In function ‘void* init_type_wxWebViewFSHandler(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:206:18: error: ‘wxWebViewFSHandler’ in namespace ‘::’ does not name a type
             const  ::wxWebViewFSHandler* a0;
                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFSHandler.cpp:208:112: error: ‘a0’ was not declared in this scope
             if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, NULL, sipUnused, "J9", sipType_wxWebViewFSHandler, &a0))
                                                                                                                    ^
    
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:24:1: error: expected class-name before ‘{’ token
     {
     ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:27:34: error: ‘wxWebViewFactory’ in namespace ‘::’ does not name a type
         sipwxWebViewFactory(const  ::wxWebViewFactory&);
                                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:35:8: error: ‘wxWebView’ in namespace ‘::’ does not name a type
          ::wxWebView* Create( ::wxWindow*, ::wxWindowID,const  ::wxString&,const  ::wxPoint&,const  ::wxSize&,long,const  ::wxString&);
            ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:36:8: error: ‘wxWebView’ in namespace ‘::’ does not name a type
          ::wxWebView* Create();
            ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In constructor ‘sipwxWebViewFactory::sipwxWebViewFactory()’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:48:64: error: expected class-name before ‘(’ token
     sipwxWebViewFactory::sipwxWebViewFactory():  ::wxWebViewFactory(), sipPySelf(0)
                                                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:48:64: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:48:65: error: expected unqualified-id before ‘)’ token
     sipwxWebViewFactory::sipwxWebViewFactory():  ::wxWebViewFactory(), sipPySelf(0)
                                                                     ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:48:77: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewFactory::sipwxWebViewFactory():  ::wxWebViewFactory(), sipPySelf(0)
                                                                                 ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:53:51: error: ‘wxWebViewFactory’ in namespace ‘::’ does not name a type
     sipwxWebViewFactory::sipwxWebViewFactory(const  ::wxWebViewFactory& a0):  ::wxWebViewFactory(a0), sipPySelf(0)
                                                       ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In constructor ‘sipwxWebViewFactory::sipwxWebViewFactory(const int&)’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:53:93: error: expected class-name before ‘(’ token
     sipwxWebViewFactory::sipwxWebViewFactory(const  ::wxWebViewFactory& a0):  ::wxWebViewFactory(a0), sipPySelf(0)
                                                                                                 ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:53:93: error: expected ‘{’ before ‘(’ token
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: At global scope:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:53:97: error: expected constructor, destructor, or type conversion before ‘,’ token
     sipwxWebViewFactory::sipwxWebViewFactory(const  ::wxWebViewFactory& a0):  ::wxWebViewFactory(a0), sipPySelf(0)
                                                                                                     ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:53:108: error: expected constructor, destructor, or type conversion before ‘(’ token
     sipwxWebViewFactory::sipwxWebViewFactory(const  ::wxWebViewFactory& a0):  ::wxWebViewFactory(a0), sipPySelf(0)
                                                                                                                ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:63:4: error: ‘wxWebView’ in namespace ‘::’ does not name a type
      ::wxWebView* sipwxWebViewFactory::Create( ::wxWindow*parent, ::wxWindowID id,const  ::wxString& url,const  ::wxPoint& pos,const  ::wxSize& size,long style,const  ::wxString& name)
        ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:78:4: error: ‘wxWebView’ in namespace ‘::’ does not name a type
      ::wxWebView* sipwxWebViewFactory::Create()
        ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In function ‘PyObject* meth_wxWebViewFactory_Create(PyObject*, PyObject*, PyObject*)’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:108:10: error: ‘::wxWebViewFactory’ has not been declared
              ::wxWebViewFactory *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:108:30: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewFactory *sipCpp;
                                  ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:112:14: error: ‘::wxWebView’ has not been declared
                  ::wxWebView*sipRes;
                  ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:112:26: error: ‘sipRes’ was not declared in this scope
                  ::wxWebView*sipRes;
                              ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:136:37: error: ‘wxWebViewDefaultURLStr’ was not declared in this scope
             const  ::wxString& urldef = wxWebViewDefaultURLStr;
                                         ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:146:38: error: ‘wxWebViewNameStr’ was not declared in this scope
             const  ::wxString& namedef = wxWebViewNameStr;
                                          ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:149:10: error: ‘::wxWebViewFactory’ has not been declared
              ::wxWebViewFactory *sipCpp;
              ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:149:30: error: ‘sipCpp’ was not declared in this scope
              ::wxWebViewFactory *sipCpp;
                                  ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:163:14: error: ‘::wxWebView’ has not been declared
                  ::wxWebView*sipRes;
                  ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:163:26: error: ‘sipRes’ was not declared in this scope
                  ::wxWebView*sipRes;
                              ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In function ‘void* cast_wxWebViewFactory(void*, const sipTypeDef*)’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:6: error: ‘::wxWebViewFactory’ has not been declared
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
          ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:26: error: ‘sipCpp’ was not declared in this scope
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                              ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:55: error: ‘wxWebViewFactory’ in namespace ‘::’ does not name a type
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                           ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:72: error: expected ‘>’ before ‘*’ token
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                                            ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:72: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:73: error: expected primary-expression before ‘>’ token
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                                             ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:199:83: error: expected ‘)’ before ‘;’ token
          ::wxWebViewFactory *sipCpp = reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                                                       ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In function ‘void release_wxWebViewFactory(void*, int)’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:217:36: error: ‘wxWebViewFactory’ in namespace ‘::’ does not name a type
             delete reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                        ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:217:53: error: expected ‘>’ before ‘*’ token
             delete reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                         ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:217:53: error: expected ‘(’ before ‘*’ token
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:217:54: error: expected primary-expression before ‘>’ token
             delete reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                          ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:217:64: error: expected ‘)’ before ‘;’ token
             delete reinterpret_cast< ::wxWebViewFactory *>(sipCppV);
                                                                    ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp: In function ‘void* init_type_wxWebViewFactory(sipSimpleWrapper*, PyObject*, PyObject*, PyObject**, PyObject**, PyObject**)’:
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:255:18: error: ‘wxWebViewFactory’ in namespace ‘::’ does not name a type
             const  ::wxWebViewFactory* a0;
                      ^
    ../../../../sip/cpp/sip_html2wxWebViewFactory.cpp:257:110: error: ‘a0’ was not declared in this scope
             if (sipParseKwdArgs(sipParseErr, sipArgs, sipKwds, NULL, sipUnused, "J9", sipType_wxWebViewFactory, &a0))
                                                                                                                  ^
    
    Waf: Leaving directory `/tmp/pip-install-uc7g8zv4/wxpython/build/waf/3.5/gtk3'
    Build failed
     -> task in '_html2' failed with exit status 1 (run with -v to display more information)
     -> task in '_html2' failed with exit status 1 (run with -v to display more information)
     -> task in '_html2' failed with exit status 1 (run with -v to display more information)
     -> task in '_html2' failed with exit status 1 (run with -v to display more information)
     -> task in '_html2' failed with exit status 1 (run with -v to display more information)
    Command '"/usr/bin/python3" /tmp/pip-install-uc7g8zv4/wxpython/bin/waf-2.0.7 --wx_config=/tmp/pip-install-uc7g8zv4/wxpython/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/bin/python3" --out=build/waf/3.5/gtk3 configure build ' failed with exit code 1.
    Finished command: build_py (4m1.752s)
    Finished command: build (6m9.232s)
    Command '"/usr/bin/python3" -u build.py build' failed with exit code 1.

则执行如下命令(显然是编译脚本忘记检查依赖项导致的):

$ sudo apt-get install libwebkitgtk-3.0-dev

参考链接


macOS High Sierra(10.13.6)解决"Error: Running Homebrew as root is extremely dangerous and no longer supported."

macOS High Sierra(10.13.6)版本上,使用Homebrew安装python2的时候出现如下问题:

$ brew install python2
Warning: python@2 2.7.15_1 is already installed, it's just not linked
You can use `brew link python@2` to link this version.

$ brew link python@2
Linking /usr/local/Cellar/python@2/2.7.15_1... Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

$ sudo brew link python@2
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

网上的解决方法是把整个/usr/local的所有者修改为当前用户,但是新版本的macOS High Sierra(10.13.6)已经不支持这样操作了,如下:

$ sudo chown -R `whoami` /usr/local
chown: /usr/local: Operation not permitted

那么解决方法如下:

$ sudo chown -R `whoami` /usr/local/Homebrew/

$ sudo chown -R $(whoami) $(brew --prefix)/*

$ sudo mkdir /usr/local/Frameworks

$ sudo chown -R `whoami` /usr/local/Frameworks/

完成上面的操作后,我们可以看到已经能成功操作了:

$ brew link python@2
Linking /usr/local/Cellar/python@2/2.7.15_1... 5 symlinks created

#如果曾经安装过pip可能导致pip被链接到系统的python版本,可是系统目录上各种无权限,因此我们移除已经安装的pip,重新链接pip到brew安装的python

$ sudo rm -rf /usr/local/bin/pip

$ brew reinstall python2

参考链接


NUCLEO-F401RE开发板调试X-NUCLEO-IKS01A2传感器扩展板(macOS High Sierra 10.13.6)

NUCLEO-F401RE开发板调试X-NUCLEO-IKS01A2传感器扩展板(macOS High Sierra 10.13.6)
继续阅读NUCLEO-F401RE开发板调试X-NUCLEO-IKS01A2传感器扩展板(macOS High Sierra 10.13.6)

Apache2.4中通过.htaccess配置解决Chrome 68之后的浏览器报告网站不安全的问题

2018724日发布的Chrome 68中,Google有一项重大举措就是宣布所有HTTP网站都会被标识为not secure,也就是不安全,并计划在Google搜索结果里降低HTTP网站的权重和排名。

实际的效果如下图:

继续阅读Apache2.4中通过.htaccess配置解决Chrome 68之后的浏览器报告网站不安全的问题