This is why almost all free programming languages has their standard library under licenses like LGPL. That license was was created by the free software foundation for the glibc, in order to give direct permission to compile and ship non-free software that uses it.
For programming languages that include a prelude or standard library on which most actual programs will rely on in whole or in part, it may be problematic (and, of course, its especially problematic for languages where substantial parts of the interpreter/compiler itself is part of that standard library, as is the case of any language which implements a general purpose eval.)