|
NachOS的安装 1.首先解压缩安装文件: tar zxvf NachOS-4.1_110.gz
上过信安实践的都会的吧~解压在当前文件夹之下
2.进入如下目录: cd NachOS-4.1/code/build.linux/
同上~
3.执行make depend(依赖检验): make depend
这里可能有一个问题当然你(没有问题最好拉),安装教程上没提到,就是会提示 error:iostream.h不存在,然后就继续不下去了。。。 因为这是老的c++头文件,新的编译器可能不认可(官方反对使用啦~) 修改NachOS4.1//lib/sysdep.h: "iostream.h" 改为 "iostream" 下一行再加句 using namespace std; 使用新的标准的头文件。
4.进行编译: make
可能碰到的问题(抄安装教程的) 在安装的过程中,由于g++版本兼容性的问题,可能在编译的时候出现以下的错误: 1.cc1plus: error: unrecognized command line option "-fwritable-strings" 解决方法:修改NachOS-4.1/code/build.linux/Makefile,第203行,将-fwritable-str ings去掉,即: CFLAGS = -ftemplate-depth-100 -Wno-deprecated -g -Wall $(INCPATH) $(DEFINES) $(HOSTCFLAGS) –DCHANGED
2.在编译NachOS-4.1/code/lib/list.cc时可能会出现很多如下的错误: ../lib/list.cc: In member function ‘void SortedList<T>::Insert(T)’: ../lib/list.cc:240: error: there are no arguments to ‘IsEmpty’ that depend on a template parameter, so a declaration of ‘IsEmpty’ must be available ../lib/list.cc:240: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated) ../lib/list.cc:241: error: ‘first’ was not declared in this scope ../lib/list.cc:242: error: ‘last’ was not declared in this scope ../lib/list.cc:243: error: ‘first’ was not declared in this scope ../lib/list.cc:251: error: ‘numInList’ was not declared in this scope ../lib/list.cc:255: error: ‘last’ was not declared in this scope ../lib/list.cc:258: error: ‘numInList’ was not declared in this scope ../lib/list.cc: In member function ‘void SortedList<T>::SanityCheck() const ’: ../lib/list.cc:341: error: ‘first’ was not declared in this scope ../lib/list.cc:341: error: ‘last’ was not declared in this scope ../lib/list.cc: In member function ‘void SortedList<T>::SelfTest(T*, int)’:
../lib/list.cc:371: error: there are no arguments to ‘RemoveFront’ that depend on a template parameter, so a declaration of ‘RemoveFront’ must be available ../lib/list.cc:374: error: there are no arguments to ‘IsEmpty’ that depend on a template parameter, so a declaration of ‘IsEmpty’ must be available 解决方法:修改NachOS-4.1/code/lib/list.cc文件,将错误信息中所出现的所有函 数(如IsEmpty())和变量(first,last等)增加this指针,即:this->IsEmpty(),th is->first,this->last等。 我对比了下大概有17个地方要改吧(见下行号)~ NachOS4.1/lib/list.cc: 240-245,247,251,255-256,258,341-342(各两个),371,374
现在 make 依然有错误。
../lib/sysdep.cc:84:39:error:declaration of C function 'int mprotect (char*, unsigned int, int)' conflicts with /usr/include/sys/mman.h:82:12: error: previous declaration 'int mprotect(void*, size_t, int)' here ../lib/sysdep.cc:95:25:error: error: declaration of C function 'int select(int, void*, void*, void*, timeval*)' conflicts with /usr/include/sys/select.h:109:12: error: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)' here ../lib/sysdep.cc: In function 'int Tell(int)': ../lib/sysdep.cc:405:19: error: 'tell' was not declared in this scope ../lib/sysdep.cc: In function 'void ReadFromSocket(int, char*, int)': ../lib/sysdep.cc:535:41: error: invalid conversion from 'int*' to 'socklen_t*' ../lib/sysdep.cc:535:41: error: initializing argument 6 of 'ssize_t recvfrom(int, void* ,size_t, int, sockaddr*, socklen_t*)' make: *** [sysdep.o] 错误 1
|