At least 41 people have died in a magnitude-7.8 earthquake that was centered near the coast of Ecuador.