There is a persistent myth that solar panels take more energy to fabricate than they produce in their lifetime. It is shown false with minimal effort (consider if the entire cost of a panel was energy. no labor, not capital equipment overhead, no raw materials… they still have payback periods shorter than their lifetimes).
Basically, Greenhouse gas emission including construction, material acquisition, maintenance etc. per kWh im g CO2: Solar: 32 Nuclear: 66 (which assumes that enrichment is done with conventional energy)\ Coal: 960
Solar power in Germany (the page claims) takes between 15 - 100 months to generate as much energy as producing them takes. I assume 100 is for old panels, and with modern (=more efficiently produced) panels it's more like 15. Wind power takes just 3 - 23 months to establish this "energy payback".
The page has more detailed figures and sources.