There are several types of glues. Glues that use a plastic or rubber dissolved in a petroleum based solvent will smell like the solvent. For example, rubber cement is latex rubber dissolved in n-heptane.
n-heptane
N-heptane is just a chain of 7 carbon atoms, with 2 hydrogen atoms attached to each carbon, and another one at each end. It is a component of gasoline, and smells like it.
Model airplane cement uses toluene as a solvent. It also has a characteristic odor.
Some glues, like epoxy, come in two parts, which react together to form a new molecule. Each part contains some volatile molecules that have characteristic odors, but as they cure they can also emit new molecules with different odors.
Silicone rubber adhesives combine with the moisture in the air to cure, and in the curing process they release lactic acid, which has a sharp eye-stinging odor.