老手分享Ubuntu 10.10成功安装Nachos的方法及命令
终于将nachos安装成功 写文一篇已示庆贺,自己的安装过程:
1. 使用Ubuntu 10.10安装
2. 由于自带gcc4.4,版本太高,卸载之
3. 网上下载3.4手动安装(这费了不少劲,最后还是选择的deb包自动安装……因为2.96没装上)
4. 安装Nachos4.1。make depend成功,没有提示错误,高兴,成功近在咫尺
5 make。n多错误出现。不过有人已经将错误解决方法贴出
在此引用(原作者未知):
“可能碰到的问题(抄安装教程的)
在安装的过程中,由于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(),this->first,this->last等。 ”
将其提到的问题解决,再make
6. 新问题出现,并且教程没提,只能自己查找。错误为“undefined reference to `__gxx_personality_v0' ”
解决方法(引用,原作者未知):
“1. Linux Develop Notes
* 编译 c++ 程序需要添加 -lstdc++ sample: gcc -lstdc++ -o test test.c,否则会报 "undefinedreference to '__gxx_personality_v0' " 错误
2. 唉,用gcc命令编译C程序,用g++命令编译C++程序。
g++和gcc本质一样的,本质上还是gcc,大家实验室所有的c++程序都是用gcc编译的,一般的程序用gcc足够了。 对于 C++ 程序,编译的时候用 gcc 或者 g++ 都可以。但是在进行连接的时候最好用 g++,因为用 g++ 会自动进行 C++ 标准库的连接;用 gcc 连接 C++ 程序也可以,但是需要人为指定连接 C++ 标准库,否则就会出现 undefined reference to `__gxx_personality_v ' 之类的错误。
可见-lstdc++ 所对应的是标准C++库”
查看该信息后,修改makefile,将cc后添加 -lstdc++,再make,依然报错
再修改makefile,将LD=gcc-3.4改为 LD=g++-3.4,再make,成功,Oh yeah!!! 看来确实是
“用gcc命令编译C程序,用g++命令编译C++程序”
运行Nachos,成功(应该是成功了吧,第一次用Nachos……)!!!Oh yeah !!!哈哈!!!
tests summary: ok:0
Machine halting!
Ticks: total 10, idle 0, system 10, user 0
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0