Build error in TensorMath.lua: "attempt to call method 'registerDefaultArgument' (a nil value)" #106

Closed
alimuldal opened this Issue Jan 28, 2015 · 9 comments

Comments

Projects
None yet
4 participants
@alimuldal

Hi there,

I'm currently struggling to build cutorch on Ubuntu 14.04 (CUDA 6.5, GCC-4.8.2). I'm hitting a build error in TensorMath.lua:

/home/alistair/torch/install/bin/luajit: /tmp/luarocks_cutorch-scm-1-9849/cutorch/TensorMath.lua:184: attempt to call method 'registerDefaultArgument' (a nil value)
stack traceback:
        /tmp/luarocks_cutorch-scm-1-9849/cutorch/TensorMath.lua:184: in main chunk
        [C]: at 0x00406170
make[2]: *** [TensorMath.c] Error 1
make[1]: *** [CMakeFiles/cutorch.dir/all] Error 2
make: *** [all] Error 2

Error: Build error: Failed building.

The full build log is below. Any thoughts on what might cause this?

Cheers,
Alistair

~$ luarocks install cutorch                                                                                                                          
Installing https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/cutorch-scm-1.rockspec... switching to 'build' mode
Cloning into 'cutorch'...
remote: Counting objects: 52, done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 52 (delta 4), reused 25 (delta 4)
Receiving objects: 100% (52/52), 62.89 KiB | 0 bytes/s, done.
Resolving deltas: 100% (4/4), done.
Checking connectivity... done.
cmake -E make_directory build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/alistair/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/alistair/torch/install/lib/luarocks/rocks/cutorch/scm-1" && make

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- 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
-- Found Torch7 in /home/alistair/torch/install
-- Found CUDA: /usr/local/cuda (found suitable version "6.5", minimum required is "5.5") 
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_cutorch-scm-1-9849/cutorch/build
[  7%] Building NVCC (Device) object lib/THC/CMakeFiles/THC.dir//./THC_generated_THC.cu.o
CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THStorage.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THStorageCopy.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensor.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensorCopy.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensorRandom.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensorMath.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensorConv.h


CMake Warning at /usr/share/cmake-2.8/Modules/FindCUDA/make2cmake.cmake:66 (message):
   Removing non-existent dependency file: generic/THTensorLapack.h


Scanning dependencies of target THC
[ 15%] Building C object lib/THC/CMakeFiles/THC.dir/THCGeneral.c.o
[ 23%] Building C object lib/THC/CMakeFiles/THC.dir/THCStorage.c.o
[ 30%] Building C object lib/THC/CMakeFiles/THC.dir/THCStorageCopy.c.o
[ 38%] Building C object lib/THC/CMakeFiles/THC.dir/THCTensor.c.o
[ 46%] Building C object lib/THC/CMakeFiles/THC.dir/THCTensorCopy.c.o
Linking CXX shared library libTHC.so
[ 46%] Built target THC
[ 53%] Generating TensorMath.c
/home/alistair/torch/install/bin/luajit: /tmp/luarocks_cutorch-scm-1-9849/cutorch/TensorMath.lua:184: attempt to call method 'registerDefaultArgument' (a nil value)
stack traceback:
        /tmp/luarocks_cutorch-scm-1-9849/cutorch/TensorMath.lua:184: in main chunk
        [C]: at 0x00406170
make[2]: *** [TensorMath.c] Error 1
make[1]: *** [CMakeFiles/cutorch.dir/all] Error 2
make: *** [all] Error 2

Error: Build error: Failed building.
@szagoruyko

This comment has been minimized.

Show comment
Hide comment
@szagoruyko

szagoruyko Jan 28, 2015

Member

The easiest way to fix this is to run install.sh script from distro again

Member

szagoruyko commented Jan 28, 2015

The easiest way to fix this is to run install.sh script from distro again

@alimuldal

This comment has been minimized.

Show comment
Hide comment
@alimuldal

alimuldal Jan 28, 2015

OK, I just tried that and I'm getting the same build error in the output of the install script. What do you think is the root cause of this?

OK, I just tried that and I'm getting the same build error in the output of the install script. What do you think is the root cause of this?

@szagoruyko

This comment has been minimized.

Show comment
Hide comment
@szagoruyko

szagoruyko Jan 28, 2015

Member

ah, distro doesn't update packages any more, you have to update the distro folder with git pull origin master and then ./install.sh

Member

szagoruyko commented Jan 28, 2015

ah, distro doesn't update packages any more, you have to update the distro folder with git pull origin master and then ./install.sh

@alimuldal

This comment has been minimized.

Show comment
Hide comment
@alimuldal

alimuldal Jan 28, 2015

Still no joy - I hit the same build error in cutorch when running install.sh even after a git pull origin master && git reset --hard HEAD

Still no joy - I hit the same build error in cutorch when running install.sh even after a git pull origin master && git reset --hard HEAD

@soumith

This comment has been minimized.

Show comment
Hide comment
@soumith

soumith Jan 28, 2015

Member

the issue here is an outdated cwrap package.
registerDefaultArgument was introduced by @dominikgrewe in this commit: torch/cwrap@48bbfee

However, you seem to have an outdated cwrap. If you installed fresh from distro, cwrap will install fresh and updated.

Member

soumith commented Jan 28, 2015

the issue here is an outdated cwrap package.
registerDefaultArgument was introduced by @dominikgrewe in this commit: torch/cwrap@48bbfee

However, you seem to have an outdated cwrap. If you installed fresh from distro, cwrap will install fresh and updated.

@alimuldal

This comment has been minimized.

Show comment
Hide comment
@alimuldal

alimuldal Jan 28, 2015

I just removed ~/torch and reinstalled torch and its dependencies from scratch, following the instructions here. I see the same build error in the output of install.sh, and when I subsequently try to install cutorch using luarocks install cutorch.

I've also tried manually pulling the latest version of cwrap from the Github repository (torch/cwrap@6b7bb2a), then calling luarocks install rocks/cwrap-scm-1.rockspec. This seems to work fine, but when I subsequently try building cutorch it still fails with the same build error (I've also tried manually pulling the latest cutorch source and manually installing it in the same way, and I get the same error).

I'm very new to Lua, so perhaps I'm missing something obvious about how Lua package management works?

I just removed ~/torch and reinstalled torch and its dependencies from scratch, following the instructions here. I see the same build error in the output of install.sh, and when I subsequently try to install cutorch using luarocks install cutorch.

I've also tried manually pulling the latest version of cwrap from the Github repository (torch/cwrap@6b7bb2a), then calling luarocks install rocks/cwrap-scm-1.rockspec. This seems to work fine, but when I subsequently try building cutorch it still fails with the same build error (I've also tried manually pulling the latest cutorch source and manually installing it in the same way, and I get the same error).

I'm very new to Lua, so perhaps I'm missing something obvious about how Lua package management works?

@dominikgrewe

This comment has been minimized.

Show comment
Hide comment
@dominikgrewe

dominikgrewe Jan 28, 2015

Member

Do you maybe have two versions of cwrap installed (one local and one global)?
You can list all installed packages by calling "luarocks list". If you see cwrap twice, try removing both installation and then installing it again.

Member

dominikgrewe commented Jan 28, 2015

Do you maybe have two versions of cwrap installed (one local and one global)?
You can list all installed packages by calling "luarocks list". If you see cwrap twice, try removing both installation and then installing it again.

@alimuldal

This comment has been minimized.

Show comment
Hide comment
@alimuldal

alimuldal Jan 28, 2015

@dominikgrewe That doesn't seem to be the case:

~$ luarocks list


Installed rocks:
----------------

argcheck
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

audio
   0.1-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

cwrap
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

dok
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

env
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

fftw3
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

gnuplot
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

graphicsmagick
   1.scm-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

image
   1.1.alpha-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

itorch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lbase64
   20120820-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lua-cjson
   2.1.0-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

luafilesystem
   1.6.3-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lzmq
   0.4.2-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

nn
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

nnx
   0.1-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

optim
   1.0.5-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

paths
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

penlight
   1.3.1-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

qtlua
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

qttorch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sdl2
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

signal
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sundown
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sys
   1.1-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

threads
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

torch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

trepl
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

uuid
   0.2-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

xlua
   1.0-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

@dominikgrewe That doesn't seem to be the case:

~$ luarocks list


Installed rocks:
----------------

argcheck
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

audio
   0.1-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

cwrap
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

dok
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

env
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

fftw3
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

gnuplot
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

graphicsmagick
   1.scm-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

image
   1.1.alpha-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

itorch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lbase64
   20120820-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lua-cjson
   2.1.0-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

luafilesystem
   1.6.3-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

lzmq
   0.4.2-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

nn
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

nnx
   0.1-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

optim
   1.0.5-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

paths
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

penlight
   1.3.1-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

qtlua
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

qttorch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sdl2
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

signal
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sundown
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

sys
   1.1-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

threads
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

torch
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

trepl
   scm-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

uuid
   0.2-1 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

xlua
   1.0-0 (installed) - /home/alistair/torch/install/lib/luarocks/rocks

@alimuldal

This comment has been minimized.

Show comment
Hide comment
@alimuldal

alimuldal Jan 28, 2015

OK, finally figured it out. I did, in fact, have another global version of cwrap installed in /usr/local/share/lua/5.1/cwrap/. Deleting it fixed the build error, even though the global version of cwrap was not listed in the output of luarocks list.

Thanks for your patience!

OK, finally figured it out. I did, in fact, have another global version of cwrap installed in /usr/local/share/lua/5.1/cwrap/. Deleting it fixed the build error, even though the global version of cwrap was not listed in the output of luarocks list.

Thanks for your patience!

@alimuldal alimuldal closed this Jan 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment