torch / distro

Torch installation in a self-contained folder
BSD 3-Clause "New" or "Revised" License
555 stars 481 forks source link

the way to switch default compiler #173

Closed cdluminate closed 5 years ago

cdluminate commented 7 years ago

Debian Sid had changed its default compiler to GCC-6, which gets no support from CUDA 8.0 . So we need a workaround to switch torch/distro compiler to GCC-5 (Sid ships it but stretch doesn't).

I made some hacky changes and this seems to be working:

diff --git a/install.sh b/install.sh
index f36d84b..7e7a52f 100755
--- a/install.sh
+++ b/install.sh
@@ -106,8 +106,8 @@ cd ${THIS_DIR}/pkg/optim     && $PREFIX/bin/luarocks make optim-1.0.5-0.rockspec
 if [ -x "$path_to_nvcc" ]
 then
     echo "Found CUDA on your machine. Installing CUDA packages"
-    cd ${THIS_DIR}/extra/cutorch && $PREFIX/bin/luarocks make rocks/cutorch-scm-1.rockspec || exit 1
-    cd ${THIS_DIR}/extra/cunn    && $PREFIX/bin/luarocks make rocks/cunn-scm-1.rockspec    || exit 1
+    cd ${THIS_DIR}/extra/cutorch && CC=gcc-5 $PREFIX/bin/luarocks make rocks/cutorch-scm-1.rockspec || exit 1
+    cd ${THIS_DIR}/extra/cunn    && CC=gcc-5 $PREFIX/bin/luarocks make rocks/cunn-scm-1.rockspec    || exit 1
 fi

I hope it helps.

pingtt commented 7 years ago

It works! You are a genius!