France here, small buildings under 20m2 are called "ateliers". You have the right to build them, but getting a legal status is difficult.
If you do get this legal status, one is entitled to drinking
water and electricity. Which means expenses the
local government has to cough up.
On the other hand they're desperate for folk to come and stay because the villages are dying, the whole countryside is.
So they're in limbo, wanting the people, but not the costs for utilities.
There are people who buy "terrain constructible" who get permits for strawbale houses i know of and the same rights to utilities follow. But the catch 22 is that they have made it so that the
energy company has a department nowadays deciding on how many and where you have to install sockets. Not yourself, but done by an expensive electrician. They are difficult about septic systems too.
I guess for Spain it's even worse, they're a poorer country which has traditionally attracted swath of northern European rejects, because of the favorable climate and cheap price of living.
Granada in my youth was swarming with misfits, myself being one of them for a while, the gypsy caves have sadly been evicted.
Usually the rebellious spirit of these people were something the authorities didn't like. Having to deal with the Basque people up north and the Catalan movement for people the central government in Madrid is weary of any wrong think. I guess.
That people here say Portugal is less strict makes sense in the light of my musings.
Young people everywhere are dreaming of tiny houses and living free, meaningfull lives. Conservative powers hate to see us succeed. We're not very organized and easy to disperse, but never give up because of the nightmarish livestyle they envision for us to embrace.
The babyboomer generation will leave their
retirement mobile homes soon. The market will be swamped by cheap second hand mobile homes.
It would be ideal to scoop one up for cheap and visit friend and likeminded folk all over the continent in their alternative housing and amending food forests.