The optimal design of a set of actual shimming coils for NMR magnets is addressed. The problem is firstly described in the framework of electromagnetic inverse problems and then regularized on the basis of feasibility considerations, in the limit of negligible cross sections. The effects of finite cross section are then introduced, and an assessment of the results is done. Finally, by employing a genetic, global optimisation technique, a broad range search in the parameters space is performed, leading to solutions not foreseen by the studies based on the thin coil assumption.