Wiktionary
beat one's head against a stone wall
vb. (context intransitive idiomatic English) To waste effort on a futile project.