gcc

Steps to compile darwin for arm on ubuntu gcc

Has anyone got the steps to compile darwin libraries on gcc for arm on ubuntu? ...

Strange ld error

I have a project consisting of two files, main.c and logoff.c. When I try to compile them I get this error: gcc -c -g -Wall main.c gcc -c -g -Wall logoff.c gcc -o main -g -Wall main.o logoff.o ld: duplicate symbol _logoff in logoff.o and main.o I have a function named logoff in logoff.c, but I have searched main.c for the text "logoff...

How can I have a Makefile automatically rebuild source files that include a modified header file? (In C/C++)

I have the following makefile that I use to build a program (a kernel, actually) that I'm working on. Its from scratch and I'm learning about the process, so its not perfect, but I think its powerful enough at this point for my level of experience writing makefiles. AS = nasm CC = gcc LD = ld TARGET = core BUILD = build SOURCES...

AIX: Why does throwing an exception abort multithreaded code?

We get an abort when a C++ exception is thrown when running code compiled with -pthread. Platform: AIX 5.3 technical level 8 Compiler: gcc 3.4.6 Linker: AIX linker 1.65.2.4 Test Code: // exception.cpp #include <iostream> class MyException { public: MyException(){} virtual ~MyException(){}; }; void gTest() { t...

Can I make GCC warn on passing too-wide types to functions?

Following is some obviously-defective code for which I think the compiler should emit a diagnostic. But neither gcc nor g++ does, even with all the warnings options I could think of: -pedantic -Wall -Wextra #include <stdio.h> short f(short x) { return x; } int main() { long x = 0x10000007; /* bigger than short */ printf...

Any Macro or Technic for Part Optimization?

I am working on lock free structure with g++ compiler. It seems that with -o1 switch, g++ will change the execution order of my code. How can I forbid g++'s optimization on certain part of my code while maintain the optimization to other part? I know I can split it to two files and link them, but it looks ugly. ...

Python 2.5.2 and Solaris 8 (gcc 3.4.2) build issues

Hello there, I'm trying to build python 2.5.2 on Solaris 8 using gcc 3.4.2. I can't see any immediate errors in the ./configure step but, once built and i enter the python shell doing an import time errors with : Python 2.5.2 (r252:60911, Nov 21 2008, 18:45:42) [GCC 3.4.2] on sunos5 Type "help", "copyright", "credits" or "license" for...

Exception handling models of GCC

GCC supports Setjump-longjump (sjlj) and Dwarf2 table-based unwinding (dw2) exception handling models. What is the difference between the two models and how to choose the appropriate model? Why is Dwarf2 table-based unwinding (dw2) the more efficient model? I understand that the two models cannot be mixed. Reference: Technology Preview:...

Static vs global in terms of speed and space consumption in C

I would like to know difference between static variables and global variables in terms of access speed and space consumption. (If you want to know my platform: gcc compiler on Windows. (I am using Cygwin with Triton IDE for ARM7 embedded programming on windows. Triton comes with gcc compiler on Java platform which can be run on Windows.)...

What is __gxx_personality_v0 for?

This is a second-hand question from an OS development site, but it made me curious since I couldn't find a decent explanation anywhere. When compiling and linking a free-standing C++ program using gcc, sometimes a linker error like this occurs: out/kernel.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' This is appar...

GCC/ELF - from where comes my symbol ?

There is an executable that is dynamically linked to number of shared objects. How can I determine, to which of them some symbol (imported into executable) belongs ? If there are more than one possibility, could I silmulate ld and see from where it is being taken ? ...

Includes with the Linux GCC Linker

I don't understand how GCC works under Linux. In a source file, when I do a: #include <math.h> Does the compiler extract the appropriate binary code and insert it into the compiled executable OR does the compiler insert a reference to an external binary file (a-la Windows DLL?) I guess a generic version of this question is: Is ther...

Hide symbol(s) in Shared Object from LD

I have two third-party libraries occasionally having the same symbol name exported. When the executable is loaded, ld usually picks the wrong one and I getting crash as a result. I cannot do too much about the content of these libraries, so may be there is a way to instruct ld how to find the proper imlementation ? OS - Solaris 10, my p...

ld cannot find an existing library

I am attempting to link an application with g++ on this Debian lenny system. ld is complaining it cannot find specified libraries. The specific example here is ImageMagick, but I am having similar problems with a few other libraries too. I am calling the linker with: g++ -w (..lots of .o files/include directories/etc..) \ -L/usr/lib -l...

What is makeinfo, and how do I get it?

I'm trying to build GNU grep, and when I run make, I get: [snip] /bin/bash: line 9: makeinfo: command not found What is makeinfo, and how do I get it? (This is Ubuntu, if it makes a difference) ...

Building Gnuarm toolchain from source

I want to build a toolchain from gnuarm.org from sources. I don't want to use binary version because i'm running x64 linux. Can you point me to some kind of tutorial? ...

Where does gcc look for C and C++ header files?

On a Unix system, where does gcc look for header files? I spent a little time this morning looking for some system header files, so I thought this would be good information to have here. ...

Can the "using" declaration be used with templates?

Is it possible to use the "using" declaration with template base classes? I have read it isn't here but is that because of a technical reason or is it against the C++ standard, and does it apply to gcc or other compilers? If it is not possible, why not? Example code (from the link above): struct A { template<class T> void f(T); };...

may gcc be installed, but g++ does not work?

Dear all, I have a problem with simple c++ programs... I would like to install a program, but always have the error like "c++ compiler is unable to create executables"... Now I tried to compile a simple "hello world" program, but I get errors as I would if I compile a c++ program with a c compiler ("`cout' undeclared"... although I i...

Cross compiler for embedded platform in Windows

I wish to build a compiler (GCC port) for Linux, so that the built GCC runs on Windows and creates executables for an embedded platform. Is the above possible? ...