I have an object file, which I’d like to make into a Mach-O binary(I’m on Mac OS 10.6). Running ld -e _main source.o /usr/lib/libc.dylib produces the following output:
ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/dylib1.o/bundle1.o) for inferred architecture x86_64
How can I reference libc using ld?
You’ll need to add to the
ldinvocation the libraries that your object file calls to — in static or dynamic form. Forprintf, in particular, I think you want/usr/lib/libc.dylib.