If the binary you compiled contains third-party content, or anything derived from thus, then it's subject to that content's license. There's three common ways this happens for C libraries: static linking, inlining, and copy-paste. Other languages might have more (C++, Haskell) or fewer (Python, Ruby) ways, depending on implementation.
If the binary doesn't contain anything derived from third-party code, then it's not covered by third-party licenses, and you can do whatever you want with it. If there's no binary at all, then unless you've copied someone else's work into your source code, there's also no infringement.
For example, lets say you write a Python script which uses GNU Readline (which is GPL'd). Your script is under the BSD 4-clause license, which is not GPL-compatible. Distributing the script is perfectly legal, because the only license covering it is BSD4. However, if you (or anybody else) copied GPL'd code into the script itself, distributing it would be illegal. Additionally, if you used something like py2exe to bundle your script (and all its dependencies) into a single binary, then the result is illegal to distribute (because GPL + BSD4 = :( ).
Some people have, understandably, gotten a bit confused by this; the confusion is not helped by cranks (on both sides) claiming that the GPL is "infections", "viral", or otherwise acts like some sort of legal contagion. The GPL is a copyright license; it can only grant rights, not take them away.
The actual case of MySQL is a bit murkier; they've put forward some truly bizarre claims in the past, such as that the MySQL protocol itself is copyrighted and any reimplementation is illegal. Probably no court would uphold this view, but Oracle has much much more money than most individuals. They don't have to win, they just have to bury you in lawyer's fees until you go bankrupt.
Also, the recent WordPress theme issue probably mucks this up even more from an understanding point of view. Some said even if the themes hadn't used GPL code but simply called existing routines, they needed to be GPL. Where do come down on that?
IMO, yes. If you compile a C program which dynamically links to Readline, and then distribute it, you're not distributing any part of Readline itself. The GPL does not apply because you do not need permission from anybody to distribute your own code.
In theory, GPL'd libraries are fine for proprietary applications to depend on (via dynamic linking). However, many vendors like to statically link their binaries so they don't have to worry about shared library incompatibility. This is where the LGPL comes in. A vendor could (for example) statically link GTK+ into their application, so they don't get complaints about somebody who tries to run it from a system without GTK+ installed. If they linked against Readline, they'd have to rely on the local system libraries.
Of course, it's possible to dynamically link a proprietary application against a GPL'd shared library, and then distribute them both. But now the GPL does apply, because GPL'd code is being distributed, and it's quite possible a judge could decide you're trying to play games to avoid the license.
Also, the recent WordPress theme issue probably mucks this up even more from an understanding point of view.
WordPress is a source of misinformation regarding the GPL (see below)
Some said even if the themes hadn't used GPL code but simply called existing routines, they needed to be GPL. Where do come down on that?
IMO, this is incorrect. The argument is that the WordPress API can be copyrighted, which (in the US at least) not a position held by the courts. If it were, any project which imitated an existing API (Wine of Win32, GnuTLS of OpenSSL, editline of Readline) would be illegal.
GPL misinformation originates from two sources, broadly:
* Those that want to distort the GPL's purpose, to transform it from a shield into shackles -- WordPress and MySQL are two examples. They release GPL'd code in the hopes of creating a "community" to mine for cheap bug fixes, but intentionally spread GPL fear so paying customers are less likely to download the Free version.
* Those who are opposed to Free software in general, who do not like the idea of users having full control over their property. Usually large companies -- prime examples are Microsoft (especially a few years ago) and Apple today. A few individual trolls/cranks exist here also, but they're mercifully rare.