I think you're overestimating the difficulty. There are several engineering examples (Seabees and Army Corps of Engineers in Phillipines in WWII) and border control examples (USSR) that would seem to suggest it is really a matter of political will, not technology or economic capacity.
Maybe out Texas surrendering friend here has heard of Hadrian's Wall? Worked pretty well 2,000 years ago, to bad we only have half the technology and money of the Romans.