LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to force NS2 to use the version 4.4 of gcc instead of 4.6.3 (https://www.linuxquestions.org/questions/linux-software-2/how-to-force-ns2-to-use-the-version-4-4-of-gcc-instead-of-4-6-3-a-4175485823/)

r0w225 11-25-2013 08:57 AM

How to force NS2 to use the version 4.4 of gcc instead of 4.6.3
 
hi all
am having some problem with my ns2 , it was working fine up until it doesnt anymore and i am suspecting the updates to be incompatible with the version of my unix system [Ubuntu 12.04 LTS]. in fact when i ran a tcl script it runs in half and exits while it was running perfectely before. i dont know what must be the error because there is no error printd in the screen, apart of the fact that when i check the trace file i can see that the packets were not sent.
i would like to downgrade the gcc to the 4.4 version. How can i do this?
Code:

boris@boris-Veriton-M680G:~/ns-allinone-2.35$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)


knudfl 11-25-2013 01:02 PM

First : You can have as many versions of gcc/g++ as you want,
installed at the same time.

Using gcc/g++ version 4.4 :
$ cd ns-allinone-2.35/ && export CC=gcc-4.4 CXX=g++-4.4 && ./install
*** This is not "forcing", but a quite ordinary command !

Reconfiguring in ns-2.35 :
$ cd ns-allinone-2.35/ns-2.35/ && export CC=gcc-4.4 CXX=g++-4.4 && ./configure


All versions, ns-2.26 ... ns-2.34 : Use gcc/g++ version 4.1.2 :
Post #18 http://www.linuxquestions.org/questi...022/page2.html

-

John VV 11-25-2013 01:54 PM

you can export the version ( as above , VERY good option for ns2)

set the version in "Alternatives" ( this is what it is meant for )

or use a shell script to set the links in /usr/bin to the version you want to use
-- the last way is what i use ( very old habit from before alternatives )

r0w225 11-26-2013 02:49 AM

Quote:

Originally Posted by knudfl (Post 5070446)
First : You can have as many versions of gcc/g++ as you want,
installed at the same time.

Using gcc/g++ version 4.4 :
$ cd ns-allinone-2.35/ && export CC=gcc-4.4 CXX=g++-4.4 && ./install
*** This is not "forcing", but a quite ordinary command !

Reconfiguring in ns-2.35 :
$ cd ns-allinone-2.35/ns-2.35/ && export CC=gcc-4.4 CXX=g++-4.4 && ./configure


All versions, ns-2.26 ... ns-2.34 : Use gcc/g++ version 4.1.2 :
Post #18 http://www.linuxquestions.org/questi...022/page2.html

-

Hi knudfl
indeed i did that command before posting, while i was installing the 2.35 version (was using ns-allinone2.34)
and i thought it will appear when i typed gcc -v, but it shows the 4.6 version of gcc. so i thought it failed.
Thank you anyway for the assistance, i think of downgrading my version of ubuntu as well to see if ns2 will work again.
thanks

John VV 11-26-2013 04:00 AM

There is NO NEED to reinstall a old version of Ubuntu
Just install a older copy of Gcc
i currently have Gcc 3.4, 4.3 and 4.6 installed and checking Gcc 4.8 for problems with the programs i MUST HAVE

r0w225 11-26-2013 04:05 AM

Quote:

Originally Posted by John VV (Post 5070763)
There is NO NEED to reinstall a old version of Ubuntu
Just install a older copy of Gcc
i currently have Gcc 3.4, 4.3 and 4.6 installed and checking Gcc 4.8 for problems with the programs i MUST HAVE

Understood, but a question though, isnt it going to tell me that i already have the most current version of gcc and therefore refuse to download the old one?
if anyone is using ns2, can i forward to him the module to test-on

John VV 11-26-2013 01:15 PM

NO
you install gcc 4.4 along side 4.6
you then export the version to use
or set the version id alternatives
or you set the version using a shell script

BUT you HAVE to install an older version of GCC
i normally have 3 or 4 different versions installed


The software IS DESIGNED so that more than one version can be installed

just like Python is designed
i have 3 versions on Python installed and 4 versions of gcc

r0w225 11-26-2013 01:48 PM

Quote:

Originally Posted by John VV (Post 5070974)
NO
you install gcc 4.4 along side 4.6
you then export the version to use
or set the version id alternatives
or you set the version using a shell script

BUT you HAVE to install an older version of GCC
i normally have 3 or 4 different versions installed


The software IS DESIGNED so that more than one version can be installed

just like Python is designed
i have 3 versions on Python installed and 4 versions of gcc

Okay. I did all of that. Ns ia working but still run my tcl script
in half. Guess the problem is elsewhere but for this thread
I could do what i asked for. And installed an old version of gcc
thank you for your assistance, i will mark it as solve.


All times are GMT -5. The time now is 02:39 AM.