The Food and Drug Administration has approved a generic version of a cancer drug in a move that the agency said would help relieve shortages.