Build error with Cython

Hi There,

Previously I can build dgl source code successfully, after installing Cython, it has an error like this:

running install
running bdist_egg
running egg_info
writing dgl.egg-info/PKG-INFO
writing dependency_links to dgl.egg-info/dependency_links.txt
writing requirements to dgl.egg-info/requires.txt
writing top-level names to dgl.egg-info/top_level.txt
reading manifest file 'dgl.egg-info/SOURCES.txt'
writing manifest file 'dgl.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'dgl._ffi._cy3.core' extension
gcc -pthread -B /scratch/anaconda3/envs/py36/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../include/ -I../third_party/dmlc-core/include -I../third_party/dlpack/include -I/scratch/anaconda3/envs/py36/include/python3.6m -c dgl/_ffi/_cython/core.cpp -o build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o
g++ -pthread -shared -B /scratch/anaconda3/envs/py36/compiler_compat -L/scratch/anaconda3/envs/py36/lib -Wl,-rpath=/scratch/anaconda3/envs/py36/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o -o build/lib.linux-x86_64-3.6/dgl/_ffi/_cy3/core.cpython-36m-x86_64-linux-gnu.so

cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ 
/scratch/anaconda3/envs/py36/compiler_compat/ld: build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o: unable to initialize decompress status for section .debug_info
/scratch/anaconda3/envs/py36/compiler_compat/ld: build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o: unable to initialize decompress status for section .debug_info
/scratch/anaconda3/envs/py36/compiler_compat/ld: build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o: unable to initialize decompress status for section .debug_info
/scratch/anaconda3/envs/py36/compiler_compat/ld: build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.6/dgl/_ffi/_cython/core.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1  

I’m working on a remote mpi cluster without root so my environment is mixed by system gcc and local gcc (installed by linuxbrew or user_yum), but typically I will put my local path in front of the system path. I also have no right to run “sudo ldconfig” except “ldconfig”.

Does anyone know what’s wrong for this?

Could you please try:

  1. clean up the build files in python folder (e.g. build, dgl.egg-info, dist)
  2. rebuild by python setup.py install --user?

Also, here is a similar issue: https://github.com/Anaconda-Platform/anaconda-project/issues/183 . It looks like a problem with anaconda and cython when there are multiple GCC versions.

it doesn’t work. The anaconda issue may be helpful but I think uninstall cython is faster for me. Anyway, it built successful without cython.

Do you use anaconda to install dgl? I found similar issue and posted below.

I noticed this problem now so I build everything(such as emacs) under the envs “conda deactivate” except this one since I use anaconda, I have to build/install all python packages inside conda envs