diff --git a/setup.py b/setup.py
index 1d9a765..a50e9cb 100644
--- a/setup.py
+++ b/setup.py
@@ -90,7 +90,7 @@ def build_libs(libs):
         assert lib in dep_libs, 'invalid lib: {}'.format(lib)
     build_libs_cmd = ['bash', 'torch/lib/build_libs.sh']
     my_env = os.environ.copy()
-    my_env["PYTORCH_PYTHON"] = sys.executable
+    #my_env["PYTORCH_PYTHON"] = sys.executable
     if WITH_SYSTEM_NCCL:
         my_env["NCCL_ROOT_DIR"] = NCCL_ROOT_DIR
     if WITH_CUDA:
diff --git a/torch/lib/build_libs.sh b/torch/lib/build_libs.sh
index af7020e..a91bd05 100755
--- a/torch/lib/build_libs.sh
+++ b/torch/lib/build_libs.sh
@@ -24,7 +24,7 @@ C_FLAGS=" -DTH_INDEX_BASE=0 -I$INSTALL_DIR/include \
   -I$INSTALL_DIR/include/THS -I$INSTALL_DIR/include/THCS \
   -I$INSTALL_DIR/include/THPP -I$INSTALL_DIR/include/THNN \
   -I$INSTALL_DIR/include/THCUNN"
-LDFLAGS="-L$INSTALL_DIR/lib "
+LDFLAGS="-L$INSTALL_DIR/lib $SLAPOS_COMPILE_ARGS"
 LD_POSTFIX=".so.1"
 LD_POSTFIX_UNVERSIONED=".so"
 if [[ $(uname) == 'Darwin' ]]; then
