To state the obvious, homelessness is a complex and intractable problem. It is caused largely by mental illness and substance abuse, but also by laziness and poor life decisions, and simple bad luck. Many good people end up out on the streets for reasons that are not their fault, not the least of which is a shortage of "affordable" housing - quite severe in some locales.
It is easy to say, "somebody" ought to do "something," or that "we spend a ton on money on [whatever], but can't provide housing for those who need it."
But "we" do not live in a socialist utopia. No government has formally assumed the responsibility to provide housing for those who need it, and certainly the U.S. Federal Government is prohibited from doing so, under the Constitution. Furthermore, we live in a society where masses of people do the least possible amount of work, hoping to exploit The System at every turn, and as quickly as some government or other entity would assume the obligation of universal housing, the need for it would explode.
What is the solution? Be specific. If you know the solution, let other people know, because it sure as hell isn't obvious.