What does ‘Gagging’ mean?

The original meaning of this word is choking or retching (making movements and sounds like vomiting). However, it also means to desperately need or want something.

“I’m gagging for a cuppa. I haven’t had one all day!”