diff --git a/boost/python/object/make_instance.hpp b/boost/python/object/make_instance.hpp
index 5f2630ad..a71cce78 100644
--- a/boost/python/object/make_instance.hpp
+++ b/boost/python/object/make_instance.hpp
@@ -46,7 +46,7 @@ struct make_instance_impl
               
             // Note the position of the internally-stored Holder,
             // for the sake of destruction
-            Py_SIZE(instance) = offsetof(instance_t, storage);
+            Py_SET_SIZE(instance, offsetof(instance_t, storage));
 
             // Release ownership of the python object
             protect.cancel();
diff --git a/build-boost.sh b/build-boost.sh
new file mode 100755
index 00000000..0c0a4d50
--- /dev/null
+++ b/build-boost.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+CXX_FLAGS=$( xargs <<ARGZ
+    -std=c++11
+    -fpermissive
+    -Wno-cpp
+    -Wno-deprecated-declarations
+    -Wno-format-overflow
+    -Wno-maybe-uninitialized
+    -Wno-nonnull
+    -Wno-parentheses
+    -Wno-sign-compare
+    -Wno-unused-local-typedefs
+    -Wno-unused-result
+    -Wno-uninitialized
+    -Wno-vexing-parse
+ARGZ
+)
+
+./b2 -q cxxflags="${CXX_FLAGS}" install variant=debug
+
diff --git a/libs/python/src/exec.cpp b/libs/python/src/exec.cpp
index fa2860e4..e2788af4 100644
--- a/libs/python/src/exec.cpp
+++ b/libs/python/src/exec.cpp
@@ -86,7 +86,7 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
   char *f = python::extract<char *>(filename);
   // Let python open the file to avoid potential binary incompatibilities.
 #if PY_VERSION_HEX >= 0x03040000
-  FILE *fs = _Py_fopen(f, "r");
+  FILE *fs = fopen(f, "r");
 #elif PY_VERSION_HEX >= 0x03000000
   PyObject *fo = Py_BuildValue("s", f);
   FILE *fs = _Py_fopen(fo, "r");
diff --git a/libs/python/src/object/class.cpp b/libs/python/src/object/class.cpp
index aeef688e..4423ad34 100644
--- a/libs/python/src/object/class.cpp
+++ b/libs/python/src/object/class.cpp
@@ -208,7 +208,7 @@ namespace objects
   {
       if (static_data_object.tp_dict == 0)
       {
-          Py_TYPE(&static_data_object) = &PyType_Type;
+          Py_SET_TYPE(&static_data_object, &PyType_Type);
           static_data_object.tp_base = &PyProperty_Type;
           if (PyType_Ready(&static_data_object))
               return 0;
@@ -316,7 +316,7 @@ namespace objects
   {
       if (class_metatype_object.tp_dict == 0)
       {
-          Py_TYPE(&class_metatype_object) = &PyType_Type;
+          Py_SET_TYPE(&class_metatype_object, &PyType_Type);
           class_metatype_object.tp_base = &PyType_Type;
           if (PyType_Ready(&class_metatype_object))
               return type_handle();
@@ -375,11 +375,11 @@ namespace objects
               // there. A negative number indicates that the extra
               // instance memory is not yet allocated to any holders.
 #if PY_VERSION_HEX >= 0x02060000
-              Py_SIZE(result) =
+              Py_SET_SIZE(result, -(static_cast<int>(offsetof(instance<>,storage) + instance_size)) );
 #else
               result->ob_size =
-#endif
                   -(static_cast<int>(offsetof(instance<>,storage) + instance_size));
+#endif
           }
           return (PyObject*)result;
       }
@@ -470,7 +470,7 @@ namespace objects
   {
       if (class_type_object.tp_dict == 0)
       {
-          Py_TYPE(&class_type_object) = incref(class_metatype().get());
+          Py_SET_TYPE(&class_type_object, incref(class_metatype().get()) );
           class_type_object.tp_base = &PyBaseObject_Type;
           if (PyType_Ready(&class_type_object))
               return type_handle();
@@ -739,7 +739,7 @@ void* instance_holder::allocate(PyObject* self_, std::size_t holder_offset, std:
         assert(holder_offset >= offsetof(objects::instance<>,storage));
 
         // Record the fact that the storage is occupied, noting where it starts
-        Py_SIZE(self) = holder_offset;
+        Py_SET_SIZE(self, holder_offset);
         return (char*)self + holder_offset;
     }
     else
diff --git a/libs/python/src/object/enum.cpp b/libs/python/src/object/enum.cpp
index 3063320c..80f0e265 100644
--- a/libs/python/src/object/enum.cpp
+++ b/libs/python/src/object/enum.cpp
@@ -147,7 +147,7 @@ namespace
   {
       if (enum_type_object.tp_dict == 0)
       {
-          Py_TYPE(&enum_type_object) = incref(&PyType_Type);
+          Py_SET_TYPE(&enum_type_object, incref(&PyType_Type));
 #if PY_VERSION_HEX >= 0x03000000
           enum_type_object.tp_base = &PyLong_Type;
 #else
diff --git a/libs/python/src/object/function.cpp b/libs/python/src/object/function.cpp
index 5c59cc77..3702e99e 100644
--- a/libs/python/src/object/function.cpp
+++ b/libs/python/src/object/function.cpp
@@ -107,7 +107,7 @@ function::function(
     PyObject* p = this;
     if (Py_TYPE(&function_type) == 0)
     {
-        Py_TYPE(&function_type) = &PyType_Type;
+        Py_SET_TYPE(&function_type, &PyType_Type);
         ::PyType_Ready(&function_type);
     }
     
diff --git a/libs/python/src/object/life_support.cpp b/libs/python/src/object/life_support.cpp
index b7e9aa86..281c3bff 100644
--- a/libs/python/src/object/life_support.cpp
+++ b/libs/python/src/object/life_support.cpp
@@ -93,7 +93,7 @@ PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient)
     
     if (Py_TYPE(&life_support_type) == 0)
     {
-        Py_TYPE(&life_support_type) = &PyType_Type;
+        Py_SET_TYPE(&life_support_type, &PyType_Type);
         PyType_Ready(&life_support_type);
     }
     
diff --git a/tools/build/src/engine/build.sh b/tools/build/src/engine/build.sh
index bf3c695d..fa53d8a7 100755
--- a/tools/build/src/engine/build.sh
+++ b/tools/build/src/engine/build.sh
@@ -138,7 +138,7 @@ case $BOOST_JAM_TOOLSET in
     ;;
 
     gcc)
-    BOOST_JAM_CC=gcc
+    BOOST_JAM_CC="gcc -std=c11 -Wno-implicit-function-declaration -Wno-int-conversion"
     ;;
 
     darwin)
diff --git a/tools/build/src/engine/execcmd.h b/tools/build/src/engine/execcmd.h
index ab145aa1..b565da6d 100644
--- a/tools/build/src/engine/execcmd.h
+++ b/tools/build/src/engine/execcmd.h
@@ -18,6 +18,7 @@
 #include "lists.h"
 #include "strings.h"
 #include "timestamp.h"
+#include "output.h"
 
 
 typedef struct timing_info
diff --git a/tools/build/src/engine/execunix.c b/tools/build/src/engine/execunix.c
index 8ee4d9db..e12d1e5f 100644
--- a/tools/build/src/engine/execunix.c
+++ b/tools/build/src/engine/execunix.c
@@ -5,6 +5,9 @@
  * This file is part of Jam - see jam.c for Copyright information.
  */
 
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
+
 #include "jam.h"
 #include "execcmd.h"
 
@@ -18,6 +21,7 @@
 #include <time.h>
 #include <unistd.h>  /* vfork(), _exit(), STDOUT_FILENO and such */
 #include <sys/resource.h>
+#include <sys/select.h>
 #include <sys/times.h>
 #include <sys/wait.h>
 
@@ -221,7 +225,7 @@ void exec_cmd
     if (sigprocmask(SIG_BLOCK, &chldmask, &savemask) < 0)
         return;
 
-    if ( ( cmdtab[ slot ].pid = vfork() ) == -1 )
+    if ( ( cmdtab[ slot ].pid = fork() ) == -1 )
     {
         perror( "vfork" );
         exit( EXITBAD );
diff --git a/tools/build/src/engine/filesys.c b/tools/build/src/engine/filesys.c
index 1975dd99..f5e3d9a2 100644
--- a/tools/build/src/engine/filesys.c
+++ b/tools/build/src/engine/filesys.c
@@ -26,6 +26,9 @@
  *  file_dirscan_impl()  - no-profiling worker for file_dirscan()
  */
 
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 700
+
 
 #include "jam.h"
 #include "filesys.h"
diff --git a/tools/build/src/engine/make.c b/tools/build/src/engine/make.c
index 56a67450..d87c4592 100644
--- a/tools/build/src/engine/make.c
+++ b/tools/build/src/engine/make.c
@@ -44,6 +44,7 @@
 #include "search.h"
 #include "timestamp.h"
 #include "variable.h"
+#include "output.h"
 
 #include <assert.h>
 
diff --git a/tools/build/src/engine/modules/path.c b/tools/build/src/engine/modules/path.c
index f8dedacc..38c1e563 100644
--- a/tools/build/src/engine/modules/path.c
+++ b/tools/build/src/engine/modules/path.c
@@ -9,6 +9,7 @@
 #include "../lists.h"
 #include "../native.h"
 #include "../timestamp.h"
+#include "../filesys.h"
 
 
 LIST * path_exists( FRAME * frame, int flags )
