I spent the past 3 days struggling to have Lua with Torch installed on my new Windows 10 laptop. Reading many stack overflow posts on the subject I came to think my best option was to follow very closely Siavash Gorji 's instructions - see: https://libraries.io/github/SiavashGorji/LuaJIT-Luarocks-Torch7.
LuaJIT and LuaRocks installed fine, but "luarocks install torch" command fails (fails when building torch7 using either VS2013 x64 or VS2017 x64).
First of, even if both LuaJIT and LuaRocks successfully build and run, here is what the first cmake did output:
(no source code here, just compiler outputs)
D:\luainstall-64\build>cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LuaJIT-Luarocks-Torch7_ROOT%\install
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is MSVC
-- Found assembler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Looking for sin in m
-- Looking for sin in m - not found
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Performing Test LJ_TARGET_X64
-- Performing Test LJ_TARGET_X64 - Success
-- LuaJIT Target: x64
-- LuaJIT target x64
-- Performing Test LJ_ARCH_BITS_64
-- Performing Test LJ_ARCH_BITS_64 - Success
-- Performing Test LJ_HASJIT_1
-- Performing Test LJ_HASJIT_1 - Success
-- Performing Test LJ_HASFFI_1
-- Performing Test LJ_HASFFI_1 - Success
-- Performing Test LJ_DUALNUM_1
-- Performing Test LJ_DUALNUM_1 - Failed
-- Performing Test LJ_ARCH_HASFPU_1
-- Performing Test LJ_ARCH_HASFPU_1 - Success
-- Performing Test LJ_ABI_SOFTFP_1
-- Performing Test LJ_ABI_SOFTFP_1 - Failed
-- Looking for sin in m
-- Looking for sin in m - not found
-- Configuring done
-- Generating done
-- Build files have been written to: D:/luainstall-64/build
And last, when Torch7 build problem occurs, I have this (partial) output (focusing on things that may cause of the problem):
D:\luainstall-64\build>luarocks install torch
D:\luainstall-64\build>rem=rem --[[
Installing https://raw.githubusercontent.com/torch/rocks/master/torch-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/torch-scm-1.rockspec... switching to 'build' mode
Cloning into 'torch7'...
remote: Enumerating objects: 181, done.
remote: Counting objects: 100% (181/181), done.
remote: Compressing objects: 100% (174/174), done.
Receiving objects: 100% (181/181), 335.48 KiB | 1.00 MiB/s, done.ceiving objects: 98% (178/181)
Resolving deltas: 100% (8/8), done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DLUA=D:/luainstall-64/install/./luajit -DLUALIB=libluajit.lib -DLUA_BINDIR="D:/luainstall-64/install/." -DLUA_INCDIR="D:/luainstall-64/install/include" -DLUA_LIBDIR="D:/luainstall-64/install/." -DLUADIR="D:/luainstall-64/install/luarocks/torch/scm-1/lua" -DLIBDIR="D:/luainstall-64/install/luarocks/torch/scm-1/lib" -DCMAKE_INSTALL_PREFIX="D:/luainstall-64/install/luarocks/torch/scm-1" && nmake
D:\Users\docte\AppData\Local\Temp\luarocks_torch-scm-1-1820\torch7>if -E == -E (cmake.exe -E make_directory build ) else (cmake.exe -G "NMake Makefiles" -DWIN32=1 -E make_directory build )
D:\Users\docte\AppData\Local\Temp\luarocks_torch-scm-1-1820\torch7\build>if .. == -E (cmake.exe .. -DCMAKE_BUILD_TYPE=Release -DLUA=D:/luainstall-64/install/./luajit -DLUALIB=libluajit.lib -DLUA_BINDIR="D:/luainstall-64/install/." -DLUA_INCDIR="D:/luainstall-64/install/include" -DLUA_LIBDIR="D:/luainstall-64/install/." -DLUADIR="D:/luainstall-64/install/luarocks/torch/scm-1/lua" -DLIBDIR="D:/luainstall-64/install/luarocks/torch/scm-1/lib" -DCMAKE_INSTALL_PREFIX="D:/luainstall-64/install/luarocks/torch/scm-1" ) else (cmake.exe -G "NMake Makefiles" -DWIN32=1 .. -DCMAKE_BUILD_TYPE=Release -DLUA=D:/luainstall-64/install/./luajit -DLUALIB=libluajit.lib -DLUA_BINDIR="D:/luainstall-64/install/." -DLUA_INCDIR="D:/luainstall-64/install/include" -DLUA_LIBDIR="D:/luainstall-64/install/." -DLUADIR="D:/luainstall-64/install/luarocks/torch/scm-1/lua" -DLIBDIR="D:/luainstall-64/install/luarocks/torch/scm-1/lib" -DCMAKE_INSTALL_PREFIX="D:/luainstall-64/install/luarocks/torch/scm-1" )
-- The C compiler identification is MSVC 18.0.40629.0
-- The CXX compiler identification is MSVC 18.0.40629.0
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
-- Compiling with OpenMP support
CMake Deprecation Warning at lib/TH/CMakeLists.txt:5 (CMAKE_POLICY):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Compiling with OpenMP support
-- Could not find hardware support for NEON on this machine.
-- No OMAP3 processor on this machine.
-- No OMAP4 processor on this machine.
-- Looking for cpuid.h
-- Looking for cpuid.h - not found
-- Performing Test NO_GCC_EBX_FPIC_BUG
-- Performing Test NO_GCC_EBX_FPIC_BUG - Failed
-- Performing Test C_HAS_SSE1_1
-- Performing Test C_HAS_SSE1_1 - Success
-- Performing Test C_HAS_SSE2_1
-- Performing Test C_HAS_SSE2_1 - Success
-- Performing Test C_HAS_SSE3_1
-- Performing Test C_HAS_SSE3_1 - Success
-- Performing Test C_HAS_SSE4_1_1
-- Performing Test C_HAS_SSE4_1_1 - Success
-- Performing Test C_HAS_SSE4_2_1
-- Performing Test C_HAS_SSE4_2_1 - Success
-- Performing Test C_HAS_AVX_1
-- Performing Test C_HAS_AVX_1 - Success
-- Performing Test C_HAS_AVX2_1
-- Performing Test C_HAS_AVX2_1 - Success
-- Performing Test CXX_HAS_SSE1_1
-- Performing Test CXX_HAS_SSE1_1 - Success
-- Performing Test CXX_HAS_SSE2_1
-- Performing Test CXX_HAS_SSE2_1 - Success
-- Performing Test CXX_HAS_SSE3_1
-- Performing Test CXX_HAS_SSE3_1 - Success
-- Performing Test CXX_HAS_SSE4_1_1
-- Performing Test CXX_HAS_SSE4_1_1 - Success
-- Performing Test CXX_HAS_SSE4_2_1
-- Performing Test CXX_HAS_SSE4_2_1 - Success
-- Performing Test CXX_HAS_AVX_1
-- Performing Test CXX_HAS_AVX_1 - Success
-- Performing Test CXX_HAS_AVX2_1
-- Performing Test CXX_HAS_AVX2_1 - Success
-- SSE2 Found
-- SSE3 Found
-- AVX Found
-- AVX2 Found
-- Performing Test HAS_C11_ATOMICS
-- Performing Test HAS_C11_ATOMICS - Failed
-- Performing Test HAS_MSC_ATOMICS
-- Performing Test HAS_MSC_ATOMICS - Success
-- Performing Test HAS_GCC_ATOMICS
-- Performing Test HAS_GCC_ATOMICS - Failed
-- TH_SO_VERSION: 0
-- Atomics: using MSVC intrinsics
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl - guide - pthread - m]
-- Library mkl: not found
-- MKL library not found
-- Checking for [openblas]
-- Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [openblas - pthread]
-- Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [libopenblas]
-- Library libopenblas: BLAS_libopenblas_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran]
-- Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran - pthread]
-- Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [acml - gfortran]
-- Library acml: BLAS_acml_LIBRARY-NOTFOUND
-- Checking for [Accelerate]
-- Library Accelerate: BLAS_Accelerate_LIBRARY-NOTFOUND
-- Checking for [vecLib]
-- Library vecLib: BLAS_vecLib_LIBRARY-NOTFOUND
-- Checking for [ptf77blas - atlas - gfortran]
-- Library ptf77blas: BLAS_ptf77blas_LIBRARY-NOTFOUND
-- Checking for [blas]
-- Library blas: BLAS_blas_LIBRARY-NOTFOUND
-- Cannot find a library with BLAS API. Not using BLAS.
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_sequential - mkl_core]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_sequential - mkl_core]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - libiomp5md - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl_intel_lp64 - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel_lp64: not found
-- Checking for [mkl_intel - mkl_intel_thread - mkl_core - pthread]
-- Library mkl_intel: not found
-- Checking for [mkl - guide - pthread - m]
-- Library mkl: not found
-- MKL library not found
-- Checking for [openblas]
-- Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [openblas - pthread]
-- Library openblas: BLAS_openblas_LIBRARY-NOTFOUND
-- Checking for [libopenblas]
-- Library libopenblas: BLAS_libopenblas_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran]
-- Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [goto2 - gfortran - pthread]
-- Library goto2: BLAS_goto2_LIBRARY-NOTFOUND
-- Checking for [acml - gfortran]
-- Library acml: BLAS_acml_LIBRARY-NOTFOUND
-- Checking for [Accelerate]
-- Library Accelerate: BLAS_Accelerate_LIBRARY-NOTFOUND
-- Checking for [vecLib]
-- Library vecLib: BLAS_vecLib_LIBRARY-NOTFOUND
-- Checking for [ptf77blas - atlas - gfortran]
-- Library ptf77blas: BLAS_ptf77blas_LIBRARY-NOTFOUND
-- Checking for [blas]
-- Library blas: BLAS_blas_LIBRARY-NOTFOUND
-- Cannot find a library with BLAS API. Not using BLAS.
-- LAPACK requires BLAS
-- Cannot find a library with LAPACK API. Not using LAPACK.
-- Performing Test C_HAS_THREAD
-- Performing Test C_HAS_THREAD - Success
CMake Deprecation Warning at lib/luaT/CMakeLists.txt:3 (CMAKE_POLICY):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Users/docte/AppData/Local/Temp/luarocks_torch-scm-1-1820/torch7/build
Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
Scanning dependencies of target TH
[ 2%] Building C object lib/TH/CMakeFiles/TH.dir/THGeneral.c.obj
THGeneral.c
[ 5%] Building C object lib/TH/CMakeFiles/TH.dir/THHalf.c.obj
THHalf.c
[ 7%] Building C object lib/TH/CMakeFiles/TH.dir/THAllocator.c.obj
THAllocator.c
[ 10%] Building C object lib/TH/CMakeFiles/TH.dir/THSize.c.obj
THSize.c
[ 12%] Building C object lib/TH/CMakeFiles/TH.dir/THStorage.c.obj
THStorage.c
D:\Users\docte\AppData\Local\Temp\luarocks_torch-scm-1-1820\torch7\lib\TH\THStorage.c(18) : warning C4244: 'function' : conversion from 'const ptrdiff_t' to 'const long', possible loss of data
Now skipping some compiler warnings ...
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(100) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(101) : error C2085: 'cpuid' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(101) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(123) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(124) : error C2085: 'detectHostSIMDExtensions' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\generic/simd/simd.h(124) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(4) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(4) : error C2085: 'TH_sigmoid' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(4) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(8) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(8) : error C2085: 'TH_frac' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(8) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(12) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(12) : error C2085: 'TH_rsqrt' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(12) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(16) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(16) : error C2085: 'TH_lerp' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(16) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(20) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(20) : error C2085: 'TH_sigmoidf' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(20) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(24) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(24) : error C2085: 'TH_fracf' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(24) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(28) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(28) : error C2085: 'TH_rsqrtf' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(28) : error C2143: syntax error : missing ';' before '{'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(32) : error C2054: expected '(' to follow 'inline'
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(32) : error C2085: 'TH_lerpf' : not in formal parameter list
d:\users\docte\appdata\local\temp\luarocks_torch-scm-1-1820\torch7\lib\th\THMath.h(32) : error C2143: syntax error : missing ';' before '{'
skipping some warnings ...
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64\cl.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
Error: Build error: Failed building.
D:\luainstall-64\build>
I know Torch7 is not officially supported on Windows yet, but it would be a great help for the community if we had a successful solution. I am definitely available this full week to succeed, but I feel I need a kick or two with the help of some Torch7 dependencies expert that can help me focusing on what is mandatory I do at this stage.
If we make it work under Windows 10, either with MSVC or MinGW it will be a success for the Lua Windows Community!!!
OK Microsoft Windows 10 Users. I solved this amazing installation/configuration/re-compilation puzzle using VS2013 x64 (one could most likely succeed as well using VS2017 and maybe even VS2019). The solution is based on Siavash Gorji 's instructions - see: https://libraries.io/github/SiavashGorji/LuaJIT-Luarocks-Torch7 that I followed step by step while keeping an exact and detailed log of everything I had to do.
Today, I must keep going at installing the optional, but important for execution speed, Installing (recompiling) the NVIDIA CUDA software layers (cutorch, cunn, cunnx and cudnn Modules). And I will post in here, these additional steps later today.
-1) Today, I did installed the full Intel MKL Library for my VS2013 and VS2017 installs
0) Now, after a reboot, this is an attempt to successfully install LuaJIT-Luarocks-Torch7 using VS2013 x64 Native Tools Command Prompt
0.5) To have the Intel MKL Library detected this time around, set environment variables for this VS2013 x64 Native Tools Command Prompt
as specified by https://software.intel.com/en-us/mkl-windows-developer-guide-setting-environment-variables
and Intel MKL Library installation notes at https://software.intel.com/en-us/mkl/choose-download/windows
cd "D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\mkl\bin"
d:
mklvars.bat intel64
1) Then, we re-build LuaJIT-Luarocks (hoping this time it sees the Intel MKL Library):
cd D:\luainstall-64\build
d:
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LuaJIT-Luarocks-Torch7_ROOT%\install
nmake
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LuaJIT-Luarocks-Torch7_ROOT%\install -P cmake_install.cmake
2) the rocks cwrap and paths are installed, so keep attempting to install luarocks install torch
luarocks list
luarocks install torch
but, "luarocks install torch" returns error, starting with "inline" not being defined,
inline is a c99 keyword and c99 is not yet (fully) supported with MSVC (ref. http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx).
we can define:
-Dinline=__inline
to do so:
cd D:\luainstall-64\install\luarocks
d:
luarocks download torch
edit rockspec file D:\luainstall-64\install\luarocks\torch-scm-1.rockspec
add -Dinline=__inline (let's say after "cmake -E make_directory build && cd build && cmake .. " and before "-DCMAKE_BUILD_TYPE=Release -DLUA=$(LUA) -DLUALIB=$(LUALIB) -DLUA_BINDIR="$(LUA_BINDIR)" -DLUA_INCDIR="$(LUA_INCDIR)" -DLUA_LIBDIR="$(LUA_LIBDIR)" -DLUADIR="$(LUADIR)" -DLIBDIR="$(LIBDIR)" -DCMAKE_INSTALL_PREFIX="$(PREFIX)" && $(MAKE)")
luarocks unpack torch-scm-1.rockspec
cd torch-scm-1\torch7
edit CMakeLists.txt
so the section "Flags when using MSVC" looks like this:
# Flags
# When using MSVC
IF(MSVC)
# we want to respect the standard, and we are bored of those **** .
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1)
# spi, begin
# "luarocks install torch" returns error, starting with "inline" not being defined,
# inline is a c99 keyword and c99 is not yet (fully) supported with MSVC (ref. http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx).
ADD_DEFINITIONS(-Dinline=__inline)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /FORCE")
# spi, end
ENDIF(MSVC)
now, ready to build using:
luarocks make ..\..\torch-scm-1.rockspec
And "luarocks torch install" works, at last!!!
To test the torch installation, we can create and display a 2x3x4 randomly initialized tensor on a regular Command Prompt by:
luajit
require "torch"
print(torch.Tensor(2,3,4))
It works!!!
Finnaly, set Torch_DIR as an Environment Variable to the LuaJIT-Luarocks-Torch7_ROOT%\share\cmake\torch directory:
setx Torch_DIR %LuaJIT-Luarocks-Torch7_ROOT%\share\cmake\torch
(for me, I edit the system environment variables from the controlpanel, adding Torch_DIR D:\luainstall-64\share\cmake\torch)
So, I must therefore close the VS2013 x64 Native Tools Command Prompt
and re-open a new VS2013 x64 Native Tools Command Prompt again
cd "D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\mkl\bin"
d:
mklvars.bat intel64
Now, Installing Torch Modules:
When you install torch on Unix environments, it will automatically installs "lots of nice goodies". In the following section, we try to install them (i.e. most of them) one by one using luarocks installer. Try to install these in the same order presented here. To install some of the lua/torch modules that contain C code on Windows, we need to make some changes to them (since we are basically porting them from Linux). You can find all such editted modules inside the extra folder in "%LuaJIT-Luarocks-Torch7_ROOT%. To install these, we will use luarocks local installation capabality (i.e. using "luarocks make" instead of "luarocks install"). As you can see below, all we need to do is to cd the NTCP to the main directory of each module, and run "luarocks make path-to-module-rockspec-file".
luarocks install luafilesystem
luarocks install penlight
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\lua-cjson
(for me, cd D:\luainstall-64\extra\lua-cjson)
luarocks make lua-cjson-2.1devel-1.rockspec
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\luaffifb
(for me, cd D:\luainstall-64\extra\luaffifb)
luarocks make luaffi-scm-1.rockspec
luarocks install sundown
luarocks install dok
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\sys
(for me, cd D:\luainstall-64\extra\sys)
luarocks make sys-1.1-0.rockspec
luarocks install xlua
but "luarocks install nn" does not go through, need to luarocks download, luarocks unpack and luarocks make:
cd D:\luainstall-64\install\luarocks
d:
luarocks download nn
edit rockspec file D:\luainstall-64\install\luarocks\nn-scm-1.rockspec
add -Dinline=__inline
luarocks unpack nn-scm-1.rockspec
cd nn-scm-1\nn
edit CMakeLists.txt
so the section "Flags when using MSVC" looks like this:
# Flags
# When using MSVC
IF(MSVC)
# we want to respect the standard, and we are bored of those **** .
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1)
# spi, begin
# "luarocks install nn" returns error, starting with "inline" not being defined,
# inline is a c99 keyword and c99 is not yet (fully) supported with MSVC (ref. http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx).
ADD_DEFINITIONS(-Dinline=__inline)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /FORCE")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /FORCE")
# spi, end
ENDIF(MSVC)
now, ready to build using:
rename D:\luainstall-64\install\luarocks\nn nn-backup
luarocks make ..\..\nn-scm-1.rockspec
failing to build nn, because of
d:\luainstall-64\install\luarocks\nn-scm-1\nn\lib\thnn\generic/FeatureLPPooling.c(214) : error C2143: syntax error : missing ';' before 'type'
unsigned type not supported in openmp 2.0 (which is the version msvc 2013 supports),
so, for 2 blocks of code in FeatureLPPooling.c, I replaced the type size_t by long (within the 2 pragma omp parallel for blocks of code)
also, not declaring any counter variables within for statement (within the pragma omp parallel for here below,
moving counter variables declaration before each for loop
retrying to to build nn
cd D:\luainstall-64\install\luarocks\nn-scm-1\nn
d:
luarocks make ..\..\nn-scm-1.rockspec
and the build works!!!
luarocks install graph
luarocks install nngraph
but "luarocks install image" does not go through
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
so, see https://devblogs.microsoft.com/cppblog/vcpkg-a-tool-to-acquire-and-build-c-open-source-libraries-on-windows/
Clone from GitHub: git clone https://github.com/Microsoft/vcpkg
Run the bootstrap script in the vcpkg folder:
D:\vcpkg> .\bootstrap-vcpkg.bat
d:\vcpkg>vcpkg integrate install
Applied user-wide integration for this vcpkg root.
d:\vcpkg>vcpkg install openjpeg:x64-windows
d:\vcpkg>vcpkg install zlib:x64-windows
zlib install did not succeed
vcpkg update
retry zlib install
d:\vcpkg>vcpkg install zlib:x64-windows
zlib install succeeded
d:\vcpkg>vcpkg install libpng:x64-windows
libpng install did not succeed
retry
d:\vcpkg>vcpkg install libpng:x64-windows
libpng install succeeded
now, retry installing "luarocks install image"
luarocks install image
it does not go through
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
-- Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
set the 6 following environment variables:
JPEG_LIBRARY D:\vcpkg\packages\openjpeg_x64-windows\lib
JPEG_INCLUDE_DIR D:\vcpkg\packages\openjpeg_x64-windows\include
ZLIB_LIBRARY D:\vcpkg\packages\zlib_x64-windows\lib
ZLIB_INCLUDE_DIR D:\vcpkg\packages\zlib_x64-windows\include
PNG_LIBRARY D:\vcpkg\packages\libpng_x64-windows\lib
PNG_PNG_INCLUDE_DIR D:\vcpkg\packages\libpng_x64-windows\include
(for me, I edit the system environment variables from the controlpanel)
So, I must therefore close the VS2013 x64 Native Tools Command Prompt
and re-open a new VS2013 x64 Native Tools Command Prompt again
cd "D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\mkl\bin"
d:
mklvars.bat intel64
cd D:\luainstall-64\install\luarocks
d:
now, retry installing "luarocks install image"
luarocks install image
(2019july25, 12h56am) "luarocks install image" still not seeing jpeg, zlib and png libraries
so, "luarocks install image" does not go through, need to luarocks download, luarocks unpack and luarocks make:
cd D:\luainstall-64\install\luarocks
d:
luarocks download image
edit rockspec file D:\luainstall-64\install\luarocks\image-1.1.alpha-0.rockspec
add this define to cmake command:
"-DCMAKE_TOOLCHAIN_FILE=d:/vcpkg/scripts/buildsystems/vcpkg.cmake"
i.e. cmake -DCMAKE_TOOLCHAIN_FILE=d:/vcpkg/scripts/buildsystems/vcpkg.cmake
add also -Dinline=__inline to this cmake command
also add -DJPEG_LIBRARY=D:/vcpkg/packages/openjpeg_x64-windows/lib
along with -DJPEG_INCLUDE_DIR=D:/vcpkg/packages/openjpeg_x64-windows/include
luarocks unpack image-1.1.alpha-0.rockspec
cd image-1.1.alpha-0/image
edit CMakeLists.txt
at the top, after the FIND_PACKAGE statements, add this line
ADD_DEFINITIONS(-Dinline=__inline)
now, ready to build using:
rename D:\luainstall-64\install\luarocks\image image-backup
luarocks make ..\..\image-1.1.alpha-0.rockspec
this time, build success, but it still did not find the jpeg library
so, at the top, after the FIND_PACKAGE statements and the previous
ADD_DEFINITIONS(-Dinline=__inline) statement ...
add this line
ADD_DEFINITIONS(-DJPEG_LIBRARY="D:/vcpkg/packages/openjpeg_x64-windows/lib")
add this line
ADD_DEFINITIONS(-DJPEG_INCLUDE_DIR="D:/vcpkg/packages/openjpeg_x64-windows/include")
now, ready to build again using:
luarocks make ..\..\image-1.1.alpha-0.rockspec
ok, this time the code is looking for the header jpeglib.h which is not in openjpeg library
at the time of this document writing, microsoft vcpkg can't install libjpeg nor will it successfully install libjpeg-turbo
so, I directly download libjpeg-turbo from https://sourceforge.net/projects/libjpeg-turbo/files/2.0.0/libjpeg-turbo-2.0.0-vc64.exe/download
and install it and revise (edit again) my libjpeg related environment variables (using controlpanel environment variable editor)
JPEG_LIBRARY D:\libjpeg-turbo64\lib
JPEG_INCLUDE_DIR D:\libjpeg-turbo64\include
once again, let's edit rockspec file
edit D:\luainstall-64\install\luarocks\image-1.1.alpha-0.rockspec
and revise (change) the libjpeg related defines proving the new path to libjpeg-turbo's folders with forward slashes for safety
-DJPEG_LIBRARY=D:/libjpeg-turbo64/lib/jpeg.lib
-DJPEG_LIBRARY2=D:/libjpeg-turbo64/lib/turbojpeg.lib
-DJPEG_INCLUDE_DIR=D:/libjpeg-turbo64/include
now, let's do again
cd D:\luainstall-64\install\luarocks
d:
luarocks unpack image-1.1.alpha-0.rockspec
cd image-1.1.alpha-0/image
edit CMakeLists.txt
at the top, after the FIND_PACKAGE statements, add this line
ADD_DEFINITIONS(-Dinline=__inline)
add this line
ADD_DEFINITIONS(-DJPEG_LIBRARY="D:/libjpeg-turbo64/lib/jpeg.lib")
add this line
ADD_DEFINITIONS(-DJPEG_LIBRARY2="D:/libjpeg-turbo64/lib/turbojpeg.lib")
add this line
ADD_DEFINITIONS(-DJPEG_INCLUDE_DIR="D:/libjpeg-turbo64/include")
and in the "if (JPEG_FOUND)" block, replace the 2 lines here below
replace
SET(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARY}")
with
SET(CMAKE_REQUIRED_LIBRARIES "${JPEG_LIBRARY} ${JPEG_LIBRARY2}")
and replace
TARGET_LINK_LIBRARIES(jpeg luaT TH ${JPEG_LIBRARIES})
with
TARGET_LINK_LIBRARIES(jpeg luaT TH ${JPEG_LIBRARIES} ${JPEG_LIBRARY} ${JPEG_LIBRARY2})
now, ready to build again using:
luarocks make ..\..\image-1.1.alpha-0.rockspec
cd D:\luainstall-64\install\luarocks
d:
luarocks install optim
luarocks install gnuplot
luarocks install env
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\nnx
luarocks make nnx-0.1-1.rockspec
luarocks install graphicsmagick
luarocks install argcheck
luarocks install fftw3
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\torch-signal
luarocks make ./rocks/signal-scm-1.rockspec
luarocks install class
luarocks install rational
luarocks install cairo
cd %LuaJIT-Luarocks-Torch7_ROOT%\extra\luasocket
luarocks make ./rockspec/luasocket-3.0rc2-1.rockspec
OK, success so far
First part of the complete solution found!
If some of you want to reproduce this, see the reference section here below to see how I got to today's point.
Cheers,
Steph
for reference: (the day before, I started doing these steps)
1) Installation (windows 64 bit)
I choose to install in:
D:\luainstall-64
Set environment variables:
LuaJIT-Luarocks-Torch7_ROOT D:\luainstall-64
On Windows - use command prompt with appropritate environment (I used VS2013 x64 Native Tools Command Prompt)
cd %LuaJIT-Luarocks-Torch7_ROOT%\..
git clone https://github.com/SiavashGorji/LuaJIT-Luarocks-Torch7.git
cd %LuaJIT-Luarocks-Torch7_ROOT%
mkdir build
cd build
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LuaJIT-Luarocks-Torch7_ROOT%\install
nmake
cmake .. -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=%LuaJIT-Luarocks-Torch7_ROOT%\install -P cmake_install.cmake
setx path "%LuaJIT-Luarocks-Torch7_ROOT%\install;%path%"
D:\luainstall-64\install
setx LUA_PATH .\?.lua;C:\Programs\LuaJIT-Luarocks-Torch7\install\lua\?.lua;C:\Programs\LuaJIT-Luarocks-Torch7\install\lua\?\init.lua;
set LUA_PATH .\?.lua;D:\luainstall-64\install\lua\?.lua;D:\luainstall-64\install\lua\?\init.lua;
setx LUA_CPATH .\?.dll;C:\Programs\LuaJIT-Luarocks-Torch7\install\?.dll;C:\Programs\LuaJIT-Luarocks-Torch7\install\loadall.dll
set LUA_CPATH .\?.dll;D:\luainstall-64\install\?.dll;D:\luainstall-64\install\loadall.dll
setx LUA_DEV %LuaJIT-Luarocks-Torch7_ROOT%\install
IMPORTANT NOTE:
Note that in the installation directory, there is a cmake.cmd which automatically appends any cmake commands (which are called by luarocks) with the -G "NMake Makefiles" flag. In order for this to work, you should make sure that the installation directory precedes cmake installation directory.
So, I did put D:\luainstall-64\install first in the system path (way before the path for cmake).
2) Torch7 (windows 64 bit)
On Windows - use command prompt with appropriate environment (I used VS2013 x64 Native Tools Command Prompt)
luarocks install cwrap
luarocks install paths
luarocks install torch
but got an error at some point during luarocks install torch:
[ 61%] Generating TensorMath.c
NMAKE : fatal error U1077: 'D:\luainstall-64\install\luajit.EXE' : return code '0xc0000005'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
Error: Build error: Failed building.
I am following the instructions of the get started page of Pytorch site to build pytorch with CUDA support on mac OS 10.14 (Mojave) but I am getting an error:
[ 80%] Building CXX object
caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/alias_analysis.cpp.o
In file included from /Users/adriantineo/dev/python/pytorch/torch/csrc/jit/passes/alias_analysis.cpp:1:
In file included from /Users/adriantineo/dev/python/pytorch/torch/csrc/jit/passes/alias_analysis.h:3:
/Users/adriantineo/dev/python/pytorch/c10/util/flat_hash_map.h:1367:24: error: no
member named 'out_of_range' in namespace 'std'
throw std::out_of_range("Argument passed to at() was not in the map.");
~~~~~^
/Users/adriantineo/dev/python/pytorch/c10/util/flat_hash_map.h:1374:24: error: no
member named 'out_of_range' in namespace 'std'
throw std::out_of_range("Argument passed to at() was not in the map.");
~~~~~^
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/batch_mm.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/bailout_graph.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/canonicalize.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/constant_propagation.cpp.o
[ 80%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/constant_pooling.cpp.o
[ 81%] Building CXX object caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/common_subexpression_elimination.cpp.o
2 errors generated.
make[2]: *** [caffe2/CMakeFiles/torch.dir/__/torch/csrc/jit/passes/alias_analysis.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [caffe2/CMakeFiles/torch.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
File "setup.py", line 749, in <module>
build_deps()
File "setup.py", line 323, in build_deps
cmake=cmake)
File "/Users/adriantineo/dev/python/pytorch/tools/build_pytorch_libs.py", line 64, in build_caffe2
cmake.build(my_env)
File "/Users/adriantineo/dev/python/pytorch/tools/setup_helpers/cmake.py", line 340, in build
self.run(build_args, my_env)
File "/Users/adriantineo/dev/python/pytorch/tools/setup_helpers/cmake.py", line 93, in run
check_call(command, cwd=self.build_dir, env=env)
File "/Users/adriantineo/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '8']' returned non-zero exit status 2.
I have followed the steps for the prerequisites as stated in the documentation. I am using Anaconda 4.7.5, Python 3.7.3, and CUDA Toolkit 10.1.
On top of that, I am using Xcode command line tools for Xcode 8.2, since the ones for Xcode 10 were giving trouble with the error message fatal error: 'string.h' file not found. I found the tip to use an older version of Xcode command line tools here.
More info about the build:
-- ******** Summary ********
-- CMake version : 3.14.5
-- CMake command : /Users/adriantineo/anaconda3/bin/cmake
-- System : Darwin
-- C++ compiler : /Library/Developer/CommandLineTools/usr/bin/clang++
-- C++ compiler version : 8.0.0.8000042
-- CXX flags : -Wno-deprecated -fvisibility-inlines-hidden -Wno-deprecated-declarations -Wnon-virtual-dtor
-- Build type : Release
-- Compile definitions : TH_BLAS_MKL;ONNX_ML=1
-- CMAKE_PREFIX_PATH : /Users/adriantineo/anaconda3/lib/python3.7/site-packages
-- CMAKE_INSTALL_PREFIX : /Users/adriantineo/dev/python/pytorch/torch
-- CMAKE_MODULE_PATH : /Users/adriantineo/dev/python/pytorch/cmake/Modules;/Users/adriantineo/dev/python/pytorch/cmake/public/../Modules_CUDA_fix
--
-- ONNX version : 1.5.0
-- ONNX NAMESPACE : onnx_torch
-- ONNX_BUILD_TESTS : OFF
-- ONNX_BUILD_BENCHMARKS : OFF
-- ONNX_USE_LITE_PROTO : OFF
-- ONNXIFI_DUMMY_BACKEND : OFF
-- ONNXIFI_ENABLE_EXT : OFF
--
-- Protobuf compiler :
-- Protobuf includes :
-- Protobuf libraries :
-- BUILD_ONNX_PYTHON : OFF
--
[...]
-- USE_CUDA : True
-- CUDA static link : OFF
-- USE_CUDNN : OFF
-- CUDA version : 10.1
-- CUDA root directory : /usr/local/cuda
-- CUDA library : /usr/local/cuda/lib/libcuda.dylib
-- cudart library : /usr/local/cuda/lib/libcudart.dylib
-- cublas library : /usr/local/cuda/lib/libcublas.dylib
-- cufft library : /usr/local/cuda/lib/libcufft.dylib
-- curand library : /usr/local/cuda/lib/libcurand.dylib
-- nvrtc : /usr/local/cuda/lib/libnvrtc.dylib
-- CUDA include path : /usr/local/cuda/include
-- NVCC executable : /usr/local/cuda/bin/nvcc
-- CUDA host compiler : /Library/Developer/CommandLineTools/usr/bin/clang
Any tips to troubleshoot the build?
Cuda drivers don't workwith Mojave.
https://devtalk.nvidia.com/default/topic/1042279/cuda-setup-and-installation/cuda-10-and-macos-10-14/
I'm getting the error below when I run make to compile xpdf. It seems to do with papar sizes not been detected. I've not seen this kind of error before, usually its the math library that causes the compiler to complain. Is anyone experienced with this sort of error?
[ 71%] Linking CXX executable pdftohtml
CMakeFiles/xpdf_objs.dir/GlobalParams.cc.o: In function GlobalParams::GlobalParams(char const*)':
GlobalParams.cc:(.text+0xdbd): undefined reference to `paperinit'
GlobalParams.cc:(.text+0xdc2): undefined reference to `systempapername'
GlobalParams.cc:(.text+0xdde): undefined reference to `paperinfo'
GlobalParams.cc:(.text+0xdee): undefined reference to `paperpswidth'
GlobalParams.cc:(.text+0xe05): undefined reference to `paperpsheight'
GlobalParams.cc:(.text+0xe48): undefined reference to `paperdone'
collect2: error: ld returned 1 exit status
make[2]: *** [xpdf/CMakeFiles/pdftohtml.dir/build.make:219: xpdf/pdftohtml] Error 1
make[1]: *** [CMakeFiles/Makefile2:428: xpdf/CMakeFiles/pdftohtml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
The terminal output from the cmake command is:
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/usr/bin/g++ .
-- The C compiler identification is GNU 7.3.1
-- The CXX compiler identification is GNU 7.3.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for mkstemp
-- Looking for mkstemp - found
-- Looking for mkstemps
-- Looking for mkstemps - found
-- Looking for popen
-- Looking for popen - found
-- Performing Test HAVE_STD_SORT
-- Performing Test HAVE_STD_SORT - Success
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for fseek64
-- Looking for fseek64 - not found
-- Looking for _fseeki64
-- Looking for _fseeki64 - not found
-- Found FreeType (old-style includes): /usr/lib64/libfreetype.so
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib64/libpng.so (found version "1.6.31")
-- Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR)
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR)
-- lcms2 not found
-- Qt5 found
CMake Deprecation Warning at cmake-config.txt:263 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
CMakeLists.txt:15 (include)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Deprecation Warning at xpdf-qt/CMakeLists.txt:27 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/usr/build/xpdf-4.00
The package is broken. The current available source code does not properly handle the case when libpaper is present. For a full patch set that fixes the wrong behavior properly see this entry in Bugzilla.
I'm having trouble building Microsoft's P language compiler on Mac OS X El Capitan 10.11.6.
Relevant portions of the build log (cd Bld; ./build.sh):
~/workspace/P/Bld
-- The C compiler identification is AppleClang 8.0.0.8000038
-- The CXX compiler identification is AppleClang 8.0.0.8000038
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jlieberm/workspace/P/Bld/build
Scanning dependencies of target Prt
[ 12%] Building C object Prt/CMakeFiles/Prt.dir/API/PrtUser.c.o
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/PrtUser.c:1:
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/PrtUser.h:9:
In file included from /Users/jlieberm/workspace/P/Src/Prt/Core/PrtExecution.h:4:
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/Prt.h:9:
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/PrtProgram.h:14:
/Users/jlieberm/workspace/P/Src/Prt/API/PrtValues.h:255:8: error: unknown type
name 'PRT_FUN_PARAM_STATUS'
_In_ PRT_FUN_PARAM_STATUS status,
^
/Users/jlieberm/workspace/P/Src/Prt/API/PrtValues.h:326:8: error: unknown type
name 'PRT_FUN_PARAM_STATUS'
_In_ PRT_FUN_PARAM_STATUS status,
^
/Users/jlieberm/workspace/P/Src/Prt/API/PrtValues.h:436:8: error: unknown type
name 'PRT_FUN_PARAM_STATUS'
_In_ PRT_FUN_PARAM_STATUS status,
^
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/PrtUser.c:1:
In file included from /Users/jlieberm/workspace/P/Src/Prt/API/PrtUser.h:9:
/Users/jlieberm/workspace/P/Src/Prt/Core/PrtExecution.h:164:122: error: unknown
type name 'PRT_FUN_PARAM_STATUS'
...PRT_MACHINEINST_PRIV * context, _In_ PRT_UINT32 varIndex, _In_ PRT_FUN_P...
^
/Users/jlieberm/workspace/P/Src/Prt/Core/PrtExecution.h:184:8: error: unknown
type name 'PRT_FUN_PARAM_STATUS'
_In_ PRT_FUN_PARAM_STATUS status,
^
/Users/jlieberm/workspace/P/Src/Prt/Core/PrtExecution.h:500:8: error: unknown
type name 'PRT_FUN_PARAM_STATUS'
_In_ PRT_FUN_PARAM_STATUS payloadStatus,
^
/Users/jlieberm/workspace/P/Src/Prt/API/PrtUser.c:508:3: error: use of
undeclared identifier 'PRT_FUN_PARAM_STATUS'
PRT_FUN_PARAM_STATUS argStatus = va_arg(argp, PRT_FUN_PA...
^
7 errors generated.
make[2]: *** [Prt/CMakeFiles/Prt.dir/API/PrtUser.c.o] Error 1
make[1]: *** [Prt/CMakeFiles/Prt.dir/all] Error 2
make: *** [all] Error 2
I am using mono 4.6.0 stable and cmake 3.6.2, which meet the minimum requirements in the P build guide for OS X and Linux.
What am I doing wrong?
This was a bug with the source code. The P team failed to include the PRT_FUN_PARAM_STATUS enum declaration in PrtValues.h:
typedef enum PRT_FUN_PARAM_STATUS
{
PRT_FUN_PARAM_CLONE,
PRT_FUN_PARAM_SWAP,
PRT_FUN_PARAM_XFER
} PRT_FUN_PARAM_STATUS;
Fixed with 1fd291c.
I'm trying to build a project on my new macbook which was previously built normally on linux computers.
at first when i run cmake, i get a the following:
-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Performing Test HAVE_CLOCK_GETTIME
-- Performing Test HAVE_CLOCK_GETTIME - Failed
-- Boost version: 1.55.0
-- Found the following Boost libraries:
-- graph
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- -> doxygen not found -> api-doc will not be created
-- Configuring done
-- Generating done
-- Build files have been written to: /path/to/folder
and then when i run make, it works till around 30% and then it stop with this error:
/path/to/project/lib/helpers.cpp:555:2: error: use of undeclared identifier 'gettimeofday'
gettimeofday(&tv, NULL);
^
1 error generated.
make[2]: *** [lib/CMakeFiles/genom.dir/helpers.cpp.o] Error 1
make[1]: *** [lib/CMakeFiles/genom.dir/all] Error 2
make: *** [all] Error 2
I looked online, there was some suggestions for changing clock_gettime(CLOCK_REALTIME, &t); to clock_get_time(CLOCK_REALTIME, &t);
but they didnt work.
The error message you provided indicates that gettimeofday wasn't included. What clock_gettime has to do with it is not possible to say from the information you provided.
A quick search about this yields, that gettimeofday should be available (it's part of POSIX).
Do you have #include <sys/time.h>(Apple Docs) or #include <sys/types.h>(SO Answer)?