torch / torch7

http://torch.ch
Other
9k stars 2.38k forks source link

Error in Make! #1093

Open QuestionPython opened 7 years ago

QuestionPython commented 7 years ago
[guest@base]: ~/Projects/torch7>$ sudo make
[sudo] password for guest: 
[ 53%] Built target TH
[ 58%] Built target luaT
[ 61%] Generating random.c
make[2]: execvp: /home/guest/Projects/torch7/random.lua: Permission denied
make[2]: *** [CMakeFiles/torch.dir/build.make:66: random.c] Error 127
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/torch.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
[guest@base]: ~/Projects/torch7>$ sudo make
[ 53%] Built target TH
[ 58%] Built target luaT
[ 61%] Generating random.c
make[2]: execvp: /home/guest/Projects/torch7/random.lua: Permission denied
make[2]: *** [CMakeFiles/torch.dir/build.make:66: random.c] Error 127
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/torch.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
tastyminerals commented 7 years ago

This is not how you install Torch, please use install.sh script or follow official instructions here.

dlannan-fmad commented 4 years ago

I think if you want to build the basic 'core' for torch, you will need to refer to the install.sh: https://github.com/torch/distro/blob/master/install.sh#L110 It seems there are around 15 'core' packages needed to build it.

There is a way to do it without a big install process (would be nice if there was a little install sh for this repo). Following these steps for luajit based setup:

  1. checkout cwrap into your torch folder: https://github.com/torch/cwrap You should have a cwrap folder within the torch7 folder.
  2. Modify random.lua and TensorMath.lua to have this included at the top of their files: package.path = package.path..";./?/init.lua"
  3. Make sure you have luajit installed somewhere ( sudo apt install luajit )
  4. Run these two commands: luajit random.lua random.c luajit TensorMath.lua TensorMath.c
  5. run make

This successfully builds libtorch.so, libTH.so, libluaT.so . But remember you will need the other packages to do things with it :) I found this useful to be able to bind torch into other projects.