// GCC编译莫名其妙的报错
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc hello_server.c hello_server.c -o hello_server
/tmp/ccdVr3CQ.o: In function`main':
hello_server.c:(.text+0x0): multiple definition of `main'
/tmp/ccrChpRi.o:hello_server.c:(.text+0x0): first defined here
/tmp/ccdVr3CQ.o: In function`error_handling':
hello_server.c:(.text+0x187): multiple definition of `error_handling'
/tmp/ccrChpRi.o:hello_server.c:(.text+0x187): first defined here
collect2: error: ld returned 1 exit status
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc hello_server.c hello_server.c -o hello_server -pthread
/tmp/ccOzaoLV.o: In function`main':
hello_server.c:(.text+0x0): multiple definition of `main'
/tmp/cc8UnZv4.o:hello_server.c:(.text+0x0): first defined here
/tmp/ccOzaoLV.o: In function`error_handling':
hello_server.c:(.text+0x187): multiple definition of `error_handling'
/tmp/cc8UnZv4.o:hello_server.c:(.text+0x187): first defined here
collect2: error: ld returned 1 exit status
// arm交叉编译器是好的,奇怪
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ arm-linux-gnueabi-gc
arm-linux-gnueabi-gcc arm-linux-gnueabi-gcc-ar-7 arm-linux-gnueabi-gcc-ranlib arm-linux-gnueabi-gcov-7 arm-linux-gnueabi-gcov-tool
arm-linux-gnueabi-gcc-7 arm-linux-gnueabi-gcc-nm arm-linux-gnueabi-gcc-ranlib-7 arm-linux-gnueabi-gcov-dump arm-linux-gnueabi-gcov-tool-7
arm-linux-gnueabi-gcc-ar arm-linux-gnueabi-gcc-nm-7 arm-linux-gnueabi-gcov arm-linux-gnueabi-gcov-dump-7
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ arm-linux-gnueabi-gcc hello_server.c -o hello_server
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ ls
hello_server hello_server.c
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc
gcc gcc-7 gcc-ar gcc-ar-7 gcc-nm gcc-nm-7 gcc-ranlib gcc-ranlib-7// gcc-7是好的
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc-7 hello_server.c -o hello_server
// 现在换gcc又好了,莫名其妙
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc hello_server.c -o hello_server
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ ls
hello_server hello_server.c
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ rm hello_server
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ ls
hello_server.c
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc hello_server.c -o hello_server
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ ls
hello_server hello_server.c
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$
// gcc升级的时候有报错
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ sudo apt install gcc
[sudo] password for guang:
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version (4:7.3.0-3ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.130ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.130ubuntu3) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-23-generic
gzip: stdout: No space left on device //这里好像很关键
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.15.0-23-generic with1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
问题2:
guang@guang-ubuntu:~/Develop/trainning/liguang/trainning/netApp$ gcc error_handle.c
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status