Torch7: Isn't there a way for out-of-source building manually?

Created on 10 Apr 2016  Â·  10Comments  Â·  Source: torch/torch7

Hi, all:

1)
I followed the installation doc at http://torch.ch/docs/getting-started.html# and almost have torch installed, which is still NOT there.

I prefer the traditional way to git torch7, and then
mkdir build cd build ccmake ../

But, it looks the ONLY way to install torch is just to follow these 3 lines:
git clone https://github.com/torch/distro.git ~/torch --recursive cd ~/torch; bash install-deps; ./install.sh

2) Since I'm using GCC 5.3.1, I met the error message when I "./install.sh":

CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCStorage.cu

/usr/include/string.h: In function ‘void* __mempcpy_inline(void_, const void_, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
CMake Error at THC_generated_THCBlas.cu.o.cmake:266 (message):
Error generating file
/home/jiapei/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCBlas.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:354: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o' failed
make[2]: ** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCBlas.cu.o] Error 1
make[2]: *
* Waiting for unfinished jobs....
/usr/include/string.h: In function ‘void* __mempcpy_inline(void_, const void_, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
CMake Error at THC_generated_THCReduceApplyUtils.cu.o.cmake:266 (message):
Error generating file
/home/jiapei/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCReduceApplyUtils.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:216: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCReduceApplyUtils.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCReduceApplyUtils.cu.o] Error 1
/usr/include/string.h: In function ‘void* __mempcpy_inline(void_, const void_, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
CMake Error at THC_generated_THCHalf.cu.o.cmake:266 (message):
Error generating file
/home/jiapei/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCHalf.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:2119: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCHalf.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCHalf.cu.o] Error 1
/usr/include/string.h: In function ‘void* __mempcpy_inline(void_, const void_, size_t)’:
/usr/include/string.h:652:42: error: ‘memcpy’ was not declared in this scope
return (char *) memcpy (__dest, __src, __n) + __n;
^
CMake Error at THC_generated_THCStorage.cu.o.cmake:266 (message):
Error generating file
/home/jiapei/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCStorage.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:1164: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCStorage.cu.o' failed
make[2]: ** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCStorage.cu.o] Error 1
CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed
make[1]: *
* [lib/THC/CMakeFiles/THC.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Error: Build error: Failed building.

The solution should be here:
http://www.visionopen.com/forums/topic/for-gcc-5-3-1/
add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") at the very front of CMakeLists.txt .

However, it looks like this solution doesn't solve my problem and I still get the above error messages. Any other suggestions?

cheers
Pei

Most helpful comment

Following what @jiapei100 said, it worked for me in Ubuntu 16.04. I executed this little script in the root of ~/torch folder:

#!/bin/bash
for file in $(find . -name "*CMakeLists.txt" | sed "s|\./||")
do
  echo "trying to fix $file"
  echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")' | cat - "$file" > temp && mv temp "$file"
done

All 10 comments

Ok... yes, problem seems to be solved

Add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") to every single CMakeLists.txt .

However, I still leave this issue open, for I still have the following warning:

CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65 (message):
Removing non-existent dependency file: generic/THCTensor.h

Cheers
Pei

Can you explain how/where to changed the line? (ie. where are the CMakeList.txt?)

add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") at the very front of CMakeLists.txt ,in the root folder where you install

@swearos Well, no. What jiapei100 said: " to every single CMakeLists.txt"
Only so it worked.

You can fix the warnings by installing the following package:

https://github.com/hughperkins/FindCUDA

luarocks install findcuda

On Sun, Apr 10, 2016 at 8:30 PM, JIA Pei [email protected] wrote:

Ok... yes, problem seems to be solved

Add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") to every
single CMakeLists.txt .

However, I still leave this issue open, for I still have the following
warning:

CMake Warning at /usr/share/cmake-3.5/Modules/FindCUDA/make2cmake.cmake:65
(message):
Removing non-existent dependency file: generic/THCTensor.h

Cheers
Pei

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
https://github.com/torch/torch7/issues/635#issuecomment-208101281

luarocks install findcuda

Error: No results matching query were found.

?

Following what @jiapei100 said, it worked for me in Ubuntu 16.04. I executed this little script in the root of ~/torch folder:

#!/bin/bash
for file in $(find . -name "*CMakeLists.txt" | sed "s|\./||")
do
  echo "trying to fix $file"
  echo 'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES")' | cat - "$file" > temp && mv temp "$file"
done

this should be fixed now

I am still experiencing this issue on Ubuntu 16.04, cuda 7.5 and findcuda installed. I didn't yet move to cuda 8.0 RC as recommended for Ubuntu 16.04 since support in other libraries is missing.

I am having similar error and still the error persist. I tried to add set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORCE_INLINES") but in vain.

I am on Mac OS X 10.9.5

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stonebig picture stonebig  Â·  7Comments

suice07 picture suice07  Â·  5Comments

mf27 picture mf27  Â·  5Comments

cjmcmurtrie picture cjmcmurtrie  Â·  7Comments

visonpon picture visonpon  Â·  3Comments