CentOS,全称Community Enterprise Operating System,中文名为社区企业操作系统。是一个基于Red Hat Linux 提供的可自由使用源代码的企业级Linux发行版本。由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。每个版本的CentOS都会获得十年的支持。新版本的CentOS大约每两年发行一次,而每个版本的CentOS会定期更新一次,以便支持新的硬件。
1. make生成模块的过程中,报错
*.c:error :stray '\357' in program
---stray '\273' in program
---stray '\277' in program
问题分析:出现此类问题,一般是比较简单的问题。类比于linux/Ubantu,一般是代码末尾忘记写';'会出现类似错误信息。
而此处则主要是因为文件的格式问题。
解决方法:将对应的源文件格式由utf-8另存为ANSI/ASCII格式,问题即可得到解决。
2. make生成模块的过程中,报错
/root/desktop/--/alt_tse.c:923:15: 错误:expected declaration specifiers or ‘...’ before string constant /root/desktop/--/alt_tse.c:924:16: 错误:expected declaration specifiers or ‘...’ before string constant /root/desktop/--/alt_tse.c:925:20: 错误:expected declaration specifiers or ‘...’ before string constant
问题分析:非代码语法和逻辑错误,经查找确定,属于缺头文件
问题解决:加#include <linux/module.h>
3. 编译uboot/kernel/driver时,报错
/bin/sh:-c:line0 :syntax error near unexpected token '('
问题分析:根据错误提示,可知与字符'('有关,括号未识别
问题解决:经过分析和实验,在路径中去掉'('即可解决该问题,或者重命名时,记住使用英文字符(
4.移植模块时,报错
ar: illegal option -- 2
Usage: ar [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...
ar -M [<mri-script]
commands:
d - delete file(s) from the archive
m[ab] - move file(s) in the archive
p - print file(s) found in the archive
q[f] - quick append file(s) to the archive
r[ab][f][u] - replace existing or insert new file(s) into the archive
t - display contents of archive
x[o] - extract file(s) from the archive
command specific modifiers:
[a] - put file(s) after [member-name]
[b] - put file(s) before [member-name] (same as [i])
[D] - use zero for timestamps and uids/gids
[N] - use instance [count] of name
[f] - truncate inserted file names
[P] - use full path names when matching
[o] - preserve original dates
[u] - only replace files that are newer than current archive contents
generic modifiers:
[c] - do not warn if the library had to be created
[s] - create an archive index (cf. ranlib)
[S] - do not build a symbol table
[T] - make a thin archive
[v] - be verbose
[V] - display the version number
@<file> - read options from <file>
emulation options:
No emulation specific options
ar: supported targets: elf32-i386 a.out-i386-linux pei-i386 elf64-x86-64 elf64-l1om elf64-little elf64-big elf32-little elf32-big srec symbolsrec verilog tekhex binary ihex trad-core
make: *** [libapplication] 错误 1
问题分析:ar命令不被识别。
问题解决:经过查找,Makefile中CFLAGS用错了。在我的Makefile中,CFLAGS有其他的含义。可以在$(LIBS) : $(OBJS)
$(AT)$(AR) -rs $@.a $^
直接去掉${CFLAGS}
Makefie中,CFLAGS 是编译选项
LDFLAGS 是链接选项
LIBS 是告诉链接器要链接哪些库文件