Building nupic.core 1.0.2 on Windows 10


#1

Hi there. I’m trying to get NuPic running on Windows according to the instructions here.

I get a couple of errors when building. Here is an output during cmake configure and generate phase

C:\nupic.core\build\scripts>cmake C:\nupic.core -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../1.0.2 -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/src/nupic/bindings -DNUPIC_TOGGLE_INSTALL=ON
    -- The CXX compiler identification is GNU 4.9.2
    -- Check for working CXX compiler: C:/Python27/share/mingwpy/bin/g++.exe
    -- Check for working CXX compiler: C:/Python27/share/mingwpy/bin/g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- NUPIC_BUILD_PYEXT_MODULES = ON
    -- PY_EXTENSIONS_DIR         = $NUPIC_CORE/bindings/py/src/nupic/bindings
    -- CMAKE_CXX_COMPILER_ID = GNU
    -- CMAKE_C_COMPILER      =
    -- CMAKE_CXX_COMPILER    = C:/Python27/share/mingwpy/bin/g++.exe
    -- CMAKE_BUILD_TYPE      = Release
    -- CMAKE_INSTALL_PREFIX  = C:/nupic.core/build/1.0.2
    -- CMAKE BITNESS=32
    -- CMAKE MEMORY=9600
    -- Performing Test compiler_supports_machine_option
    -- Performing Test compiler_supports_machine_option - Success
    -- INTERNAL_CXX_FLAGS_OPTIMIZED=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden  -Werror -Wextra -Wreturn-type -Wunused -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -pipe  -O2 -mtune=generic
    -- INTERNAL_LINKER_FLAGS_OPTIMIZED=  -m32  -static-libgcc  -static-libstdc++ -Wl,--no-undefined -O2
    -- EXTERNAL_C_FLAGS_UNOPTIMIZED=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32  -Wno-unused-variable -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-deprecated-declarations
    -- EXTERNAL_C_FLAGS_OPTIMIZED=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32  -Wno-unused-variable -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-deprecated-declarations -pipe  -O2 -mtune=generic
    -- PYEXT_LINKER_FLAGS_OPTIMIZED=  -m32  -static-libgcc  -static-libstdc++ -O2
    -- EXTERNAL_CXX_FLAGS_UNOPTIMIZED=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32  -Wno-unused-variable -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-deprecated-declarations   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden
    -- EXTERNAL_CXX_FLAGS_OPTIMIZED=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32  -Wno-unused-variable -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-deprecated-declarations   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden -pipe  -O2 -mtune=generic
    -- EXTERNAL_LINKER_FLAGS_UNOPTIMIZED=  -m32  -static-libgcc  -static-libstdc++ -Wl,--no-undefined
    -- EXTERNAL_LINKER_FLAGS_OPTIMIZED=  -m32  -static-libgcc  -static-libstdc++ -Wl,--no-undefined -O2
    -- COMMON_COMPILER_DEFINITIONS=-DPSAPI_VERSION=1;-DWIN32;-D_WINDOWS;-D_MBCS;-D_CRT_SECURE_NO_WARNINGS;-DNDEBUG;-D_VARIADIC_MAX=10;-DNOMINMAX;-DHAVE_UNISTD_H
    -- COMMON_COMPILER_DEFINITIONS_STR= -DPSAPI_VERSION=1 -DWIN32 -D_WINDOWS -D_MBCS -D_CRT_SECURE_NO_WARNINGS -DNDEBUG -D_VARIADIC_MAX=10 -DNOMINMAX -DHAVE_UNISTD_H
    -- EXTERNAL_STATICLIB_CMAKE_DEFINITIONS_OPTIMIZED=
    -- EXTERNAL_STATICLIB_CONFIGURE_DEFINITIONS_OPTIMIZED=
    -- CapnProto CXX_FLAGS=  -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32  -Wno-unused-variable -Wno-unused-parameter -Wno-incompatible-pointer-types -Wno-deprecated-declarations   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden  -DPSAPI_VERSION=1 -DWIN32 -D_WINDOWS -D_MBCS -D_CRT_SECURE_NO_WARNINGS -DNDEBUG -D_VARIADIC_MAX=10 -DNOMINMAX -DHAVE_UNISTD_H
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=capnp-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Install/lib/libcapnp.a;C:/nupic.core/build/scripts/ThirdParty/Install/lib/libkj.a
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=apr-1-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Install/Apr1StaticLib/lib/libapr-1.a
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=aprutil-1-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Install/AprUtil1StaticLib/lib/libaprutil-1.a
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=yaml-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Build/YamlStaticLib/libyaml.a
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=yaml-cpp-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Install/YamlCppStaticLib/lib/libyaml-cpp.a
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=z-bundle, STATIC_LIBS = C:/nupic.core/build/scripts/ThirdParty/Install/ZStaticLib/lib/libzlibstatic.a
    -- Found PythonInterp: C:/Python27/python.exe (found suitable version "2.7.13", minimum required is "2.7")
    -- CMAKE Found python interpreter C:/Python27/python.exe version=2.7.13
    -- src_numpy_core   = C:/Python27/Lib/site-packages/numpy/core
    -- CMAKE_PREFIX_PATH   = C:/nupic.core/external/common/;C:/nupic.core/external/windows32-gcc/;C:/Python27/Lib/site-packages/numpy/core/
    -- Found PythonLibs: C:/Python27/libs/libpython27.dll.a (found version "2.7.13")
    -- PYTHON_EXECUTABLE   = C:/Python27/python.exe
    -- PYTHON_INCLUDE_DIRS = C:/Python27/include
    -- PYTHON_LIBRARIES    = C:/Python27/libs/libpython27.dll.a
    -- CAPNP_EXECUTABLE          = C:/nupic.core/build/scripts/ThirdParty/Install/bin/capnp.exe
    -- CAPNP_CMAKE_DEFINITIONS   = -DCAPNP_LITE=1;-DEXTERNAL_CAPNP=1;-DBUILD_TOOLS=OFF
    -- CAPNP_INCLUDE_DIRS        = C:/nupic.core/build/scripts/ThirdParty/Install/include
    -- CAPNP_STATIC_LIB_TARGET   = capnp-bundle
    -- SWIG_EXECUTABLE           = C:/nupic.core/external/windows32-gcc/bin/swig.exe
    -- SWIG_DIR                  = C:/nupic.core/external/common/share/swig/3.0.2
    -- src_common_os_libs        = psapi;ws2_32;wsock32;rpcrt4
    -- src_compile_flags =   -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden  -Werror -Wextra -Wreturn-type -Wunused -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -pipe  -O2 -mtune=generic -include cmath
    -- src_lib_static_nupiccore_compile_flags =   -fvisibility=hidden  -static-libgcc -fdiagnostics-show-option -m32   -static-libstdc++ -std=c++11 -fvisibility-inlines-hidden  -Werror -Wextra -Wreturn-type -Wunused -Wno-unused-variable -Wno-unused-parameter -Wno-missing-field-initializers -pipe  -O2 -mtune=generic -include cmath -IC:/Python27/Lib/site-packages/numpy/core/include
    -- MERGE_STATIC_LIBRARIES LIB_TARGET=nupic_core, STATIC_LIBS = nupic_core_solo;capnp-bundle;yaml-cpp-bundle;yaml-bundle;apr-1-bundle;aprutil-1-bundle;z-bundle
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib nupic_core_solo.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib capnp-bundle.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib yaml-cpp-bundle.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib yaml-bundle.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib apr-1-bundle.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib aprutil-1-bundle.
    -- MERGE_STATIC_LIBRARIES: Link interface not specified in source lib z-bundle.
    -- src_common_test_exe_libs = nupic_core;C:/Python27/libs/libpython27.dll.a;psapi;ws2_32;wsock32;rpcrt4
    -- src_swig_flags = -c++;-features;autodoc=0,directors=0;-noproxyimport;-keyword;-modern;-modernargs;-noproxydel;-fvirtual;-fastunpack;-nofastproxy;-fastquery;-outputtuple;-castmode;-nosafecstrings;-w402;-w503;-w511;-w302;-w362;-w312;-w389;-DSWIG_PYTHON_LEGACY_BOOL;-IC:/nupic.core/external/common/share/swig/3.0.2/python;-IC:/nupic.core/external/common/share/swig/3.0.2;-DPSAPI_VERSION=1;-DWIN32;-D_WINDOWS;-D_MBCS;-D_CRT_SECURE_NO_WARNINGS;-DNDEBUG;-D_VARIADIC_MAX=10;-DNOMINMAX;-DHAVE_UNISTD_H;-DCAPNP_LITE=1;-DNTA_OS_WINDOWS;-DNTA_ARCH_32;-DHAVE_CONFIG_H;-DNTA_INTERNAL;-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS;-DBOOST_NO_WREGEX;-DNUPIC2;-DAPR_DECLARE_STATIC;-DAPU_DECLARE_STATIC;-DNTA_ASM;-DNTA_COMPILER_GNU
    -- _SRC_SWIG_EXTRA_DEPS     = Swig
    -- _SRC_SWIG_LINK_LIBRARIES = nupic_core;psapi;ws2_32;wsock32;rpcrt4;C:/Python27/libs/libpython27.dll.a
    -- _SRC_SWIG_EXTENSION_LINK_FLAGS=   -m32  -static-libgcc  -static-libstdc++ -O2
    -- CMAKE_SWIG_FLAGS        = -c++;-features;autodoc=0,directors=0;-noproxyimport;-keyword;-modern;-modernargs;-noproxydel;-fvirtual;-fastunpack;-nofastproxy;-fastquery;-outputtuple;-castmode;-nosafecstrings;-w402;-w503;-w511;-w302;-w362;-w312;-w389;-DSWIG_PYTHON_LEGACY_BOOL;-IC:/nupic.core/external/common/share/swig/3.0.2/python;-IC:/nupic.core/external/common/share/swig/3.0.2;-DPSAPI_VERSION=1;-DWIN32;-D_WINDOWS;-D_MBCS;-D_CRT_SECURE_NO_WARNINGS;-DNDEBUG;-D_VARIADIC_MAX=10;-DNOMINMAX;-DHAVE_UNISTD_H;-DCAPNP_LITE=1;-DNTA_OS_WINDOWS;-DNTA_ARCH_32;-DHAVE_CONFIG_H;-DNTA_INTERNAL;-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS;-DBOOST_NO_WREGEX;-DNUPIC2;-DAPR_DECLARE_STATIC;-DAPU_DECLARE_STATIC;-DNTA_ASM;-DNTA_COMPILER_GNU
    CMake Deprecation Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/UseSWIG.cmake:226 (message):
      SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
    Call Stack (most recent call first):
      src/CMakeLists.txt:735 (swig_add_module)
      src/CMakeLists.txt:800 (build_extension)

    -- Writing export map file C:/nupic.core/build/scripts/src/_algorithms_generated.expmap ({global: init_algorithms; local: *;};).
    -- Created Swig target _algorithms for swig module algorithms. extra_deps=Swig;C:/nupic.core/build/scripts/src/_algorithms_generated.expmap, link_flags=  -m32  -static-libgcc  -static-libstdc++ -O2   -Wl,--version-script=C:/nupic.core/build/scripts/src/_algorithms_generated.expmap
    CMake Deprecation Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/UseSWIG.cmake:226 (message):
      SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
    Call Stack (most recent call first):
      src/CMakeLists.txt:735 (swig_add_module)
      src/CMakeLists.txt:803 (build_extension)


    -- Writing export map file C:/nupic.core/build/scripts/src/_engine_internal_generated.expmap ({global: init_engine_internal; local: *;};).
    -- Created Swig target _engine_internal for swig module engine_internal. extra_deps=Swig;C:/nupic.core/build/scripts/src/_engine_internal_generated.expmap, link_flags=  -m32  -static-libgcc  -static-libstdc++ -O2   -Wl,--version-script=C:/nupic.core/build/scripts/src/_engine_internal_generated.expmap
    CMake Deprecation Warning at C:/Program Files/CMake/share/cmake-3.9/Modules/UseSWIG.cmake:226 (message):
      SWIG_ADD_MODULE is deprecated.  Use SWIG_ADD_LIBRARY instead.
    Call Stack (most recent call first):
      src/CMakeLists.txt:735 (swig_add_module)
      src/CMakeLists.txt:806 (build_extension)


    -- Writing export map file C:/nupic.core/build/scripts/src/_math_generated.expmap ({global: init_math; local: *;};).
    -- Created Swig target _math for swig module math. extra_deps=Swig;C:/nupic.core/build/scripts/src/_math_generated.expmap, link_flags=  -m32  -static-libgcc  -static-libstdc++ -O2   -Wl,--version-script=C:/nupic.core/build/scripts/src/_math_generated.expmap
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/nupic.core/build/scripts

And this is the output in relation to build:

        C:\nupic.core\build\scripts>mingw32-make -f Makefile install
        Scanning dependencies of target Apr1StaticLib
        [  1%] Creating directories for 'Apr1StaticLib'
        [  1%] Performing download step (verify and extract) for 'Apr1StaticLib'
        CMake Warning at C:/nupic.core/build/scripts/ThirdParty/Stamp/Apr1StaticLib/verify-Apr1StaticLib.cmake:15 (message):
          File will not be verified since no URL_HASH specified


        -- extracting...
             src='C:/nupic.core/external/common/share/apr/unix/apr-1.5.2.tar.gz'
             dst='C:/nupic.core/build/scripts/ThirdParty/Source/Apr1StaticLib'
        -- extracting... [tar xfz]
        -- extracting... [analysis]
        -- extracting... [rename]
        -- extracting... [clean up]
        -- extracting... done
        [  1%] No update step for 'Apr1StaticLib'
        [  1%] Patching apr-1 sources in <SOURCE_DIR> via C:/nupic.core/external/common/share/apr/apr.patch
        'patch' is not recognized as an internal or external command,
        operable program or batch file.
        external\CMakeFiles\Apr1StaticLib.dir\build.make:126: recipe for target 'ThirdParty/Stamp/Apr1StaticLib/Apr1StaticLib-patch_sources' failed
        mingw32-make[2]: *** [ThirdParty/Stamp/Apr1StaticLib/Apr1StaticLib-patch_sources] Error 1
        CMakeFiles\Makefile2:146: recipe for target 'external/CMakeFiles/Apr1StaticLib.dir/all' failed
        mingw32-make[1]: *** [external/CMakeFiles/Apr1StaticLib.dir/all] Error 2
        Makefile:150: recipe for target 'all' failed
        mingw32-make: *** [all] Error 2

Does any one has any suggestions how to solve these errors? Thank you!


#2
        'patch' is not recognized as an internal or external command,

This error suggests you need to install a command line program called patch.


#3

Thanks for a quick reply. There is one more error I’m getting when trying to link nupic.core to python

-- Created Swig target _math for swig module math. extra_deps=Swig, link_flags=  /NOLOGO /SAFESEH:NO /NODEFAULTLIB:LIBCMT /MACHINE:X86
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Martynas/AppData/Local/Temp/tmpal3ubv/scripts
Traceback (most recent call last):
  File "C:\nupic.core\setup.py", line 58, in <module>
    execfile(__file__)
  File "C:\nupic.core\bindings\py\setup.py", line 201, in <module>
    getExtensionFiles(platform)
  File "C:\nupic.core\bindings\py\setup.py", line 166, in getExtensionFiles
    generateExtensions()
  File "C:\nupic.core\bindings\py\setup.py", line 185, in generateExtensions
    subprocess.check_call(["make", "-j3"])
  File "C:\Python27\lib\subprocess.py", line 181, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

#4

The process running the linking may not have proper write permissions. That is the only thing I can think of.


#5

I have just tried to build the current nupic.core c++ only under win 10, vs2015, 64bits using cmake. without any success, much errors even by the 3rd libraries. More works are needed to bring nupic core to work with vs2015.


#6

Any other ideas how to fix the Python issue?