Libraries are pre-compiled, whether they are static or dynamic. Thus if I compile a library in my computer (say an intel processor), how is my library going to help or "understood" when it is linked to source files in a different processor based computer? Libraries are at the end of the day object files. So how is a it gonna work for a different processor?
If I get what you're asking correctly, you're asking how source code files that use compiled libraries on a specific machine compile and run properly on a different machine even if the machine code of these libraries is different.
The short answer is that source code (i.e., the code we write) is actually machine-independent, unlike machine code (the 0s and 1s that our source code is translated to) which is machine-dependent.
The long answer, however, is that the libraries we use by our programs are compiled for the sake of reducing the compilation time of our programs. Of course we don't need to compile these huge libraries every time we compile our program since their code is the same.
Now back to the real-life example on how source code compiles and run successfully under different machines.
Arabic is my native language (so is machine code for a computer), and you have a friend of yours who is a translator (a compiler). He actually translates English into Arabic (or source code into machine code). Now you wrote an email (a program) for me in English (source code), teaching me how to make a cake, referring to some articles (libraries) that I should use to learn how to do that correctly. These articles were actually in Arabic. Then you asked your friend to go and translate your email for me. Your friend, then, stopped by and translated the email for me. Fortunately for us he did that very fast because he didn't have to translate the articles that you asked me to read because they were already in my native language so I had no troubles understanding them. And I made a delicious cake! :)
Now, if you pulled out every "Arabic" word from the example above and put "Spanish" instead, for example, do you think anything would go wrong?
Absolutely not! As you can see even if different processors understand different machine languages, this has nothing to do with the source code we write as long as we have compilers that translate this source code into the machine language for that specific computer we're working on.