[SOLVED] Is there any dependency between cpp-extension and gcc version

I would like to know if there is a dependency between gcc-version and cpp-extension compilation.

I have tried compiling the standard cpp-extension (LLTM from here) example under two gcc version (5.2.0, 6.1.0 with conda), both of them are unable to compile the extension.

The details are given below:

Ubuntu : 14.04
Python version: 3.6.5
Pytorch installation: conda install pytorch-nightly -c pytorch (version 1.0.0.dev20181008)
gcc installation: conda install -c omgarcia gcc-6 or conda install -c cqwz gcc-5

Error in gcc 5.2.0:

g++: error: -fuse-linker-plugin is not supported in this configuration

Error in gcc 6.1.0:

creating build/lib.linux-x86_64-3.6
g++ -pthread -shared -L/home/arul/anaconda3/envs/pytorch-nightly/lib -Wl,-rpath=/home/arul/anaconda3/envs/pytorch-nightly/lib,--no-as-needed -L/home/arul/anaconda3/envs/pytorch-nightly/lib -Wl,-rpath=/home/arul/anaconda3/envs/pytorch-nightly/lib,--no-as-needed build/temp.linux-x86_64-3.6/lltm.o -L/home/arul/anaconda3/envs/pytorch-nightly/lib -lpython3.6m -o build/lib.linux-x86_64-3.6/lltm_cpp.cpython-36m-x86_64-linux-gnu.so
/usr/bin/ld: /home/arul/anaconda3/envs/pytorch-nightly/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtbeginS.o: unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

It seems the gcc installed using conda is not compatible with the other libraries native in the OS (Ubuntu). After updating the system gcc to 6.4.0 (by following this), the compilation works.