In Buddhism, there are wholesome/skillful & unwholesome/unskillful desires.
Unwholesome desires are called 'craving' or 'tanha', which are the 'compulsion' referred to.
Now this, bhikkhus, is the noble truth of the origin of suffering: it is this craving which leads to new becoming, accompanied by
delight and lust, seeking delight here and there; that is, craving for
sensual pleasures, craving to be, craving not-to-be.
SN 56.11
'Craving' or 'compulsion' (namely the 'lust', 'resistance' & 'ignorance' quoted below) is shown by a lack of self-control, enslavement ('fettered') & the final result of suffering when not getting or losing the object of compulsion.
It is similar with an untaught worldling: when touched by a painful (bodily) feeling, he worries and grieves, he laments, beats his breast, weeps and is distraught. So he experiences two kinds of feeling: a bodily and a mental feeling.
Having been touched by that painful feeling, he resists (and resents) it. Then in him who so resists (and resents) that painful
feeling, an underlying tendency of resistance against that painful
feeling comes to underlie (his mind). Under the impact of that painful
feeling he then proceeds to enjoy sensual happiness. And why does he
do so? An untaught worldling, O monks, does not know of any other
escape from painful feelings except the enjoyment of sensual
happiness. Then in him who enjoys sensual happiness, an underlying
tendency to lust for pleasant feelings comes to underlie (his mind).
He does not know, according to facts, the arising and ending of these
feelings, nor the gratification, the danger and the escape, connected
with these feelings. In him who lacks that knowledge, an underlying
tendency to ignorance as to neutral feelings comes to underlie (his
mind). When he experiences a pleasant feeling, a painful feeling or a
neutral feeling, he feels it as one fettered by it. Such a one, O
monks, is called an untaught worldling who is fettered by birth, by
old age, by death, by sorrow, lamentation, pain, grief and despair. He
is fettered by suffering, this I declare.
SN 36.6