dyld_stub_binding_helper undefined symbol / crt1.o link error



I am trying to compile on Mac OS X 10.4 my C program. I am stuck at the
link phase where I get (gcc 4.01):

$ gcc -s -Os -Wall -fprofile-arcs -fpack-struct -fno-common -ffast-math
-ffloat-store -fno-strict-aliasing -fno-align-functions
-fno-align-labels -fno-align-loops -fno-align-jumps
-fsingle-precision-constant -nostdlib -nodefaultlibs -nostartfiles
main.o -lpthread /Library/Frameworks/SDL.framework/Versions/A/SDL
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL -lgcc -o
intro
/usr/bin/ld: Undefined symbols:
dyld_stub_binding_helper
collect2: ld returned 1 exit status
make: *** [intro] Error 1

According to this:
http://developer.apple.com/documentation/DeveloperTools/Reference/MachOR
eference/Reference/reference.html#//apple_ref/c/func/dyld_stub_binding_h
elper

if I add the -lcrt1.o argument to the command line I get another error:

/usr/bin/ld: multiple definitions of symbol __start
main.o definition of __start in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../crt1.o private
external definition of __start in section (__TEXT,__text)
collect2: ld returned 1 exit status
make: *** [intro] Error 1

any insights on how to solve this error?

--zapro

PS.
The source file (even a dummy hello world code) was compiled with:
CFLAGS = -s -Os -Wall -fprofile-arcs -fpack-struct -fno-common
-ffast-math -ffloat-store -fno-strict-aliasing -fno-align-functions
-fno-align-labels -fno-align-loops -fno-align-jumps
-fsingle-precision-constant
-F/Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks

gcc $(CFLAGS) -c main-test.c -o main-test.o
gcc $(CFLAGS) -fverbose-asm -S main-test.c -o main-test.S
.



Relevant Pages

  • Re: dyld_stub_binding_helper undefined symbol / crt1.o link error
    ... collect2: ld returned 1 exit status ... You need to ask either in a gcc help group, or more likely on a group ...
    (comp.lang.c)
  • Re: can not figure out the problem
    ... /tmp/ccAxyQSj.o: In function `main':: undefined reference to `sqrt' collect2: ld returned 1 exit status ... At first I thought is because the gcc "math.h" do not have the function ...
    (comp.lang.c)
  • g77-3.4, ubuntu 7.10
    ... sudo apt-get install g77-3.4 ... But when I try to compile this is what I get ... collect2: ld returned 1 exit status ...
    (Ubuntu)
  • Re: Undefined reference to main
    ... : undefined reference to `main' ... collect2: ld returned 1 exit status ... This happens whether I compile the code using a makefile or normally ...
    (comp.os.linux.development.apps)
  • Help: some error compiling glibc 2.4
    ... collect2: ld returned 1 exit status ... I'm using gcc 4.1.0, on linux ...
    (comp.os.linux.development.system)