Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understand xcode linking (ld)

Tags:

xcode

linker

ld

After running into linker errors one time too many, I have come to the conclusion that I really need to understand how ld works, rather than just asking SO for black magic fixes everytime something doesn't work. I've found the Mac OS ld man pages which do provide some information, but as they say, they are intended for people who already understand ld. How can one gain that understanding?

Part of the problem is that there are different flavors of ld -- unix and gcc at a minimum -- and does clang have its own flavor? So I'm not sure what docs apply.

like image 312
William Jockusch Avatar asked Feb 02 '23 09:02

William Jockusch


2 Answers

Here's a great tutorial about linkers:
Beginner's Guide to Linkers

It's very technical stuff, of course, but very well explained. I don't think you still will see «black magic», as you say, after reading it.

like image 174
Macmade Avatar answered Feb 14 '23 15:02

Macmade


Here is another article that is more specific to Xcode and Mac OS X: https://gist.github.com/loderunner/b6846dd82967ac048439

like image 37
avicene Avatar answered Feb 14 '23 13:02

avicene