gcc编译出错---make[5]: *** [s-attrtab] Killed
内存不足导致的编译出错,解决方法是增加swapfile。
root@ubuntu:home# swapon -s
Filename Type Size Used Priority
创建swapfile大小512M;
root@ubuntu:home# dd if=/dev/zero of=/swapfile bs=1024 count=512k
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 8.54637 s, 62.8 MB/s
应用&设置;
root@ubuntu:/# mkswap /swapfile
Setting up swapspace version 1, size = 524284 KiB
no label, UUID=f4719d4d-1d1f-49c9-b34e-b2af28e6374e
root@ubuntu:/# swapon /swapfile
添加到开机启动项:
root@ubuntu:/# vim /etc/fstab
"/etc/fstab" 13L, 756C
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=3fea2e6f-860e-40c6-8a43-296130837358 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=d1d5044f-57be-4eeb-a577-3e3bc99591a5 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sda2 /root/sda2 ext4 rw 0 1
/swapfile none swap default 0 0
~
"/etc/fstab" 14L, 837C written
root@ubuntu:home# swapon -s
Filename Type Size Used Priority
/swapfile file 524284 8468 -1
root@ubuntu:/# free
total used free shared buffers cached
Mem: 506756 499228 7528 1104 2548 395148
-/+ buffers/cache: 101532 405224
Swap: 524284 0 524284
重新编译,即可顺利编译完成gcc