Skip to content

Installation Instructions

sjbalaji edited this page Mar 12, 2013 · 7 revisions

Designated Initializer support for GCC v4.4.5

The project aims at modifying the GCC parser and related files to provide designated initializer support for g++ compiler present in GCC v4.4.5 Steps for GCC installation:

1. add "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib" in .bashrc

2. Install the following dependencies in the same order as given below

m4-1.4.16

gmp-5.0.2

mpfr-2.4.0

(extract the tar files, cd to the respective folders and run "configure;make;make check;sudo make install")

3. Now all the dependencies are satisfied and gcc can be installed

make two directories called gccbuild and gccbin

cd gccbuild

gccsrc/configure --prefix=/home/$USER/gccbin --program-suffix=4.4.5

make

make install

4. All the binaries will be created in gccbin

delete original symlinks gcc and g++ in /usr/bin

sudo rm /usr/bin/gcc /usr/bin/g++

create the symlinks again

sudo ln -s /home/$USER/gccbin/bin/gcc-4.4.5 /usr/bin/gcc

sudo ln -s /home/$USER/gccbin/bin/g++-4.4.5 /usr/bin/g++

5. Check your gcc version

gcc -version

it should point to the binaries in your gccbin folder

6. Check the installation by compiling designated_initializer.cc

#include <stdio.h>
 
int main ()
{
  // Labeled initializer 
  struct info {
    int a,b,c;
  }var = {.c=5,.b=10};
  // Indexed initializer
  int a[] = {[1]=11,[3]=22};
  // Ranged initializer 
  int b1[] = {[1 ... 4]=1,[3] = 2};
  printf("Designated initializer examples \n");
  return 0;
}
If the installation is proper then the program should compile without any errors.

You need to have GCC v4.4.5 installed in your system. If, you don't have it the entire source code with necessary changes is available .

Clone this wiki locally