eLvErDe commented on issue #8295: Building with cmake - error
URL: https://github.com/apache/incubator-mxnet/issues/8295#issuecomment-344641791
Hi,
I'm building Debian package and what is happening is very weird: mxnet get's build serveral
time with different options, mostly to enable CUDA or not.
When, CUDA is enabled, I define CC=gcc-4.9, CXX=g++-4.9 because it won't build with newer.
When CUDA is not enabled, CC=gcc and CXX=g++, which means 4.9 on Debian Jessie and 5.3
on Ubuntu Xenial.
Turns out build works fine on Xenial but breaks on Jessie. I bet this is somehow related
to a bad C++11 detection somewhere in CMake but I don't know where. Pytorch has the same issue,
Tensorflow works.
Here's the build command that works on Xenial:
`/usr/bin/nvcc /build/mxnet-0.12.0+debian/src/operator/tensor/elemwise_binary_broadcast_op_extended.cu
-c -o /build/mxnet-0.12.0+debian/debian/build/cuda/CMakeFiles/cuda_compile.dir/src/operator/tensor/./cuda_compile_generated_elemwise_binary_broadcast_op_extended.cu.o
-ccbin /usr/bin/gcc-4.9 -m64 -DNDEBUG=1 -DDMLC_USE_CXX11=1 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0
-DMSHADOW_USE_CUDA=1 -DMSHADOW_FORCE_STREAM -DUSE_CUDNN -DUSE_JEMALLOC -DMXNET_USE_OPENCV=1
-DMXNET_USE_LAPACK=1 -DUSE_JEMALLOC -DUSE_CUDNN -DMSHADOW_USE_CUDNN=1 -Xcompiler ,\"-Wall\",\"-Wno-unknown-pragmas\",\"-fPIC\",\"-Wno-sign-compare\",\"-O3\",\"-msse2\",\"-std=c++11\",\"-Wl,--no-undefined\",\"-fopenmp\"
-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50
-gencode arch=compute_52,code=sm_52 -Xcudafe --diag_suppress=cc_clobber_ignored -Xcudafe --diag_suppress=integer_sign_change
-Xcudafe --diag_suppress=useless_using_declaration -Xcudafe --diag_suppress=set_but_not_used
-Xcompiler -fPIC -D_FORCE_INLINES -DNVCC -I/usr/include -I/build/mxnet-0.12.0+debian/include
-I/build/mxnet-0.12.0+debian/src -I/usr/include -I/build/mxnet-0.12.0+debian/mshadow -I/build/mxnet-0.12.0+debian/cub
-I/build/mxnet-0.12.0+debian/nnvm/include -I/build/mxnet-0.12.0+debian/dmlc-core/include -I/build/mxnet-0.12.0+debian/dlpack/include
-I/usr/include/opencv
`
And the one that fails on Jessie:
`/usr/bin/nvcc -M -D__CUDACC__ /build/mxnet-0.12.0+debian/src/operator/tensor/elemwise_binary_broadcast_op_extended.cu
-o /build/mxnet-0.12.0+debian/debian/build/cuda/CMakeFiles/cuda_compile.dir/src/operator/tensor/cuda_compile_generated_elemwise_binary_broadcast_op_extended.cu.o.NVCC-depend
-ccbin /usr/bin/gcc-4.9 -m64 --std c++11 -DNDEBUG=1 -DDMLC_USE_CXX11=1 -DMSHADOW_USE_CBLAS=1
-DMSHADOW_USE_MKL=0 -DMSHADOW_USE_CUDA=1 -DMSHADOW_FORCE_STREAM -DUSE_CUDNN -DUSE_JEMALLOC
-DMXNET_USE_OPENCV=1 -DMXNET_USE_LAPACK=1 -DUSE_JEMALLOC -DUSE_CUDNN -DMSHADOW_USE_CUDNN=1
-Xcompiler ,\"-Wall\",\"-Wno-unknown-pragmas\",\"-fPIC\",\"-Wno-sign-compare\",\"-O3\",\"-msse2\",\"-Wl,--no-undefined\",\"-fopenmp\"
-gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50
-gencode arch=compute_52,code=sm_52 -Xcudafe --diag_suppress=cc_clobber_ignored -Xcudafe --diag_suppress=integer_sign_change
-Xcudafe --diag_suppress=useless_using_declaration -Xcudafe --diag_suppress=set_but_not_used
-Xcompiler -fPIC -D_FORCE_INLINES -DNVCC -I/usr/include -I/build/mxnet-0.12.0+debian/include
-I/build/mxnet-0.12.0+debian/src -I/usr/include -I/build/mxnet-0.12.0+debian/mshadow -I/build/mxnet-0.12.0+debian/cub
-I/build/mxnet-0.12.0+debian/nnvm/include -I/build/mxnet-0.12.0+debian/dmlc-core/include -I/build/mxnet-0.12.0+debian/dlpack/include
-I/usr/include/opencv`
After turning space into new lines, here's the diff:
```
--- /tmp/3 2017-11-15 16:35:14.870059217 +0100
+++ /tmp/4 2017-11-15 16:35:18.066070115 +0100
@@ -1,11 +1,14 @@
/usr/bin/nvcc
+-M
+-D__CUDACC__
/build/mxnet-0.12.0+debian/src/operator/tensor/elemwise_binary_broadcast_op_extended.cu
--c
-o
-/build/mxnet-0.12.0+debian/debian/build/cuda/CMakeFiles/cuda_compile.dir/src/operator/tensor/./cuda_compile_generated_elemwise_binary_broadcast_op_extended.cu.o
+/build/mxnet-0.12.0+debian/debian/build/cuda/CMakeFiles/cuda_compile.dir/src/operator/tensor/cuda_compile_generated_elemwise_binary_broadcast_op_extended.cu.o.NVCC-depend
-ccbin
/usr/bin/gcc-4.9
-m64
+--std
+c++11
-DNDEBUG=1
-DDMLC_USE_CXX11=1
-DMSHADOW_USE_CBLAS=1
@@ -20,7 +23,7 @@
-DUSE_CUDNN
-DMSHADOW_USE_CUDNN=1
-Xcompiler
-,\"-Wall\",\"-Wno-unknown-pragmas\",\"-fPIC\",\"-Wno-sign-compare\",\"-O3\",\"-msse2\",\"-std=c++11\",\"-Wl,--no-undefined\",\"-fopenmp\"
+,\"-Wall\",\"-Wno-unknown-pragmas\",\"-fPIC\",\"-Wno-sign-compare\",\"-O3\",\"-msse2\",\"-Wl,--no-undefined\",\"-fopenmp\"
-gencode
arch=compute_30,code=sm_30
-gencode
```
Here we go, one use "-std=c++11", the other is not. Also I see this -D__CUDACC__ being
defined on Xenial only but looking at the code make me think it might just be a side effect
of C++11 not being enabled.
Anyway, I just hardcoded -DCMAKE_CXX_FLAGS="-std=c++11" to make CMake configure line and
started the build again. I'll let you know if it works correctly.
But again, it's being added automatically on Xenial/Stretch/Buster so their must be an
explanation.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
|