Hello all. I am trying to build small sample of application and shared library with DWARF symbolic info in external dSYM files. My code is:
file test.c: #include <stdio.h>
extern int sum(int a, int b);
int main() { int a = 10; int b = 100; int c = sum( a, b ); printf( "%d %d %d\n", a, b, c ); return 0; }
file sum.c: int sum(int a, int b) { return a+b; }
I am building it with the following commands, assuming i am in the same folder where files are: #! /bin/sh
#build shared lib gcc -c -O3 -gdwarf-2 sum.c gcc -o libsum.dylib -dynamiclib sum.o -install_name @executable_path/libsum.dylib dsymutil -o libsum.dSYM libsum.dylib strip -x libsum.dylib
#build test gcc -c -O3 -gdwarf-2 test.c gcc -o test test.o -L./ -lsum dsymutil -o test.dSYM test strip test
On the Intel iMac 20" Mac OS X 10.4.10 Xcode 2.4.1 Core Duo 2 2 GHz everything build and run nice. On the PowerMac G5 (dual-core G5 2 GHz) Mac OS X 10.4.10 I am getting error message: ERROR: No debug map or DWARF data was found to link And no "dSYM" file for a shared library.
If i remove optimization flag (-O3) then I could build without any error. Adding any optimization (i had tryed -O1, -Os) gives me the same error.
Is it a bug in the compiler or i am doing something wrong? Thank you in advance. -- Sincerely, Rustam Muginov |