gcc-based CompilerThe GNU Compiler Collection (GCC) C/C++ compiler (gcc or g++) is widely used in compiling C and C++ code for both native and embedded targets. Because the compiler is open source and highly configurable, its resultant behavior can vary significantly between development environments. Customizing or optimizing a compiler configuration file for your particular installation is therefore can involve more changes than is necessary for other compilers. Fortunately, gcc itself is helpful in providing the information necessary for the customization.
With gcc-based compilers, even the name of the compiler executable is indeterminate; common names include gcc, g++, arm-non-eabi-gcc and powerpc-linux-g++. In the following instructions, we'll use 'GCC_NAME' to represent the name by which gcc is invoked - you'll need to adjust that to the name actually used in your environment.
Automatic Creation of a Configuration FileThe easiest and most precise approach for creating a compiler configuration file for gcc specific to your environment is to have Imagix 4D automatically build it. In the ./imagix/bin directory of the Imagix 4D installation, you'll find a script named imagix-gnu. The script queries gcc, which returns not only the version number and location of the include directories, but also information about the existence and values of a large number of macro definitions that are specific to gcc as it's configured in your environment. The script then builds a compiler configuration file that reflects your specific build of gcc.
The script can be invoked from a command line as:
imagix-gnu GCC_NAME [inc_file_name]If you don't specify the inc_file_name, the new .inc file will be named gnu_GCC_NAME.inc
Semi-Automatic Creation of a Configuration FileWith some configurations of gcc or in some environments, a problem can occur in the querying of gcc by the imagix-gnu script. When this occurs, the script returns a message about the problem. In these circumstances, it may still possible to generate a specific compiler configuration file for your installation by manually invoking the gcc queries, and then having the imagix-gnu script collate the results and generate the new configuration file.
The detailed instructions for doing this are in the file ./imagix/tcl/mkgnu.manual. Of the 3 steps in the instructions, step 2 will take the most experimentation. Try the various alternative formats, and find a query command line approach that communicates successfully with gcc in your environment. Once you've found that, apply it to each of the four compiler commands listed, capturing the output of the command to the specified file name. After you've done that and the four manual_xxxxx files are in place, you'll be able to run imagix-gnu to generate the new compiler configuration file.
Manual Creation of a Configuration FileThe final alternative is to manually adjust one of the default gcc-related compiler configuration files that are part of the Imagix 4D distribution. Configuration files are included for a number of different native environments. These files are generally named gnu_xxxx.inc. They can serve as the starting point for creating a compiler configuration file for your specific variant of gcc.
If you choose to manually refine one of these configuration files, you'll need to first determine which version of gcc you're running. This can be found by invoking:
GCC_NAME -vYou'll also need to determine the include paths for the gcc system header files. One way to do this is to create an empty file, name it foo.cpp, and invoke:
GCC_NAME -v foo.cppIn the resulting messages, you'll find both the version number and the series of system include directories searched by gcc.
Use this version and include directory information to modify the user-modified section of the appropriate gnu_xxxx.inc file.