Without knowing more about your system (and probably not then) I really don't know what the problem is. If you had a lot of unneeded files on /dev/sda1 you could delete some of them, but you say you don't. Looking at my /tmp directory, it's full of files I don't recognize, don't need (AFAIK), and don't know where they came from. I'd delete everything in sight there... if it were my system...
How big a partition is /dev/sda1? Is /dev/sda2 a "swap" partition? Or is there more room there for files? Is there a /dev/sdb? Does "fdisk /dev/sda" - the "p" command - indicate a "reasonable" partition? If you've got a serious problem in this area, reinstalling Ubuntu from scratch might be the easiest/safest thing. Pay attention to how big your partitions are!
The only time I had trouble with gcc was a long time ago, on an even smaller machine than this one, building HLA. It produced a fatal "out of memory" error. I was able to get it to compile by removing "-O2" from the flags in the makefile. This produces rather "dumb" code... but I didn't notice any difference from a downloaded precompiled version (that's HLA...
). You shouldn't need to do this, and it might not help anyway - different problem.
I don't know much about gcc - I use it as little as possible. I took a quick(!) look through "man gcc" and didn't see any obvious way to tell gcc to use something other than /tmp for its temporary files. There may be one... gcc has options for everything! This would require another drive/partition that had some space on it, anyway...
I'd start by deleting files. I wouldn't remove /tmp itself, and I'd leave /tmp/unix/x0 alone (Xwindows depends on it). Everything else in /tmp can probably go... Don't sue me if this trashes your system! You've got everything that would make you cry to lose backed up anyway, right? Backup more, and delete it until you can get Nasm to compile!
There's an underlying "reason" why you haven't got any room on /dev/sda1, and you probably should figure out what it is, or it'll cause you some different problem in the future. That probably isn't something we can help you with, without being able to sit down at your computer. Got any friends "in real life" who know anything about Ubuntu... or Linux... or any Unix?
Courage! It's "supposed to work"!
Best,
Frank