httpserver: python3 support for json2code.py

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: add python3 support to test framework

Changes:
  - use python3 style print function.
  - use absolute imports which is enabled by default in python3.
  - add encode/decode between string and bytearray.
  - use python2 explicitly in 'scripts/trace.py', since it uses 'dpkt' library
    which is python2-only.

Tested with Python 3.4.1 and 2.7.8

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
scripts: add gcc 4.9 support to loader.py

Since the ABI of unordered_map changed in gcc 4.9.

Also removes tailing spaces.

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
build: use system gcc headers when build_env=host

Fixes the following error running 'tst-async.so' and 'tst-promise.so' due
to the ABI changes in gcc 4.9:

  Failed looking up symbol _ZTVNSt13__future_base11_State_baseE (vtable for std::__future_base::_State_base)

Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>