Suppose you want to build a large scale habitable structure in space or on a planet or moon without an atmosphere or any organics, and this would be a long term or permanent settlement, not a temporary location. Where would you get the oxygen for its inhabitants to breathe from? And, if you got it from a different location how would you ship it? 

In both cases the sheer volume of necessary oxygen (and other elements used in human-breathable air) would make it very difficult or impossible to build such a habitat, no? 

It seems to me that ensuring a constant supply of oxygen for such a habitat is so difficult as to make it impossible to build. 

Would the only way to pull this off, be to build habitats in locations that were already connected to some large source of oxygen?