For the purposes of contributing to an IRA, compensation (i.e. earned income) does not include income from a pension, an annuity or Social Security. Generally speaking, you must have earned the income by performing services (i.e. work) or received it as alimony and/or a separate maintenance for it to be considered compensation for the purposes of contributing to an IRA.
This question was answered by Denise Appleby