2

I have a program to be compiled in which I need to have gcc.

However, when a python 2.7 virtual conda enviornment being installed, it needs gcc. So I believe I don't have to install gcc package seperately inside the enviornment. Is this true? And how do I actually see this?

Furthermore, gcc has already been installed in the system itself. I do not want the program to use this system gcc when it's compiling but to use the gcc version which is inside the enviornment. How do I actually test this? Thanks in advance!

This discussion might be useful.

according to this post "If you download python binaries, it's already compiled and doesn't use your gcc"

So to reprase my question, can we use the gcc inside the virtual to compile the program? or do I have to install gcc inside the env?

     (yourenvname) ~$gcc -v
        Using built-in specs.
        COLLECT_GCC=gcc
        COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
        OFFLOAD_TARGET_NAMES=nvptx-none
        OFFLOAD_TARGET_DEFAULT=1
        Target: x86_64-linux-gnu
        Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.2.0-8ubuntu3.2' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix    
gcc version 7.2.0 (Ubuntu 7.2.0-8ubuntu3.2) 


(yourenvname) ~$python
Python 2.7.16 |Anaconda, Inc.| (default, Mar 14 2019, 21:00:58) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Jenny
  • 601
  • 1
    os.system("gcc --version")??? – xenoid Apr 16 '19 at 06:50
  • Hi xenoid: This command raises an error. (yourenvname) ~$import os (yourenvname) ~$os.system("gcc --version") bash: syntax error near unexpected token "gcc --version"' I have checked the gcc version inside and outside the env
    (yourenvname) ~$which gcc home/jen/miniconda2/yes/envs/yourenvname/bin/gcc ~$which gcc /usr/bin/gcc
    – Jenny Apr 16 '19 at 08:03
  • I think as I have edited in the main question, python only uses gcc to compile it and after that we cannot use it inside the env to compile another program. Could someone confirm this? – Jenny Apr 16 '19 at 08:08
  • I forgot to open python in my first comment`>>> import os

    os.system("gcc --version") gcc (Debian 4.9.2-10+deb8u2) 4.9.2 0`

    – Jenny Apr 16 '19 at 09:42
  • So this should answer your question? – xenoid Apr 16 '19 at 09:47
  • Unfortunately not. I'd like to know if I could use [GCC 7.3.0] (this GCC is the one which python uses to compile the binary) to compile my program inside the virtualenv or do I have to install gcc inside the virtualenv?. – Jenny Apr 16 '19 at 09:54
  • @Jenny Did you get the answer to this question? – Bing Oct 30 '19 at 16:14

0 Answers0