android__Ubuntu-编译环境搭建
msd6369__Ubuntu-编译环境搭建
站在用户的角度思考问题,与客户深入沟通,找到观山湖网站设计与观山湖网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:网站建设、成都网站设计、企业官网、英文网站、手机端网站、网站推广、域名注册、雅安服务器托管、企业邮箱。业务覆盖观山湖地区。
在安装编译环境前需要做做以下步骤:
(一). 安装ubuntu10.04 server x64位操作系统 此步骤需要注意以下设置:
安装 Ubuntu 10.04 LTS Server 64bit
1) CD-ROM 启动 ... 没有说明的地方直接《回车》,或选择“default”
2) 英文、缺省键盘
2) 服务器名字:ubuntu03
3) 选择时区: Select from worldwide list --> Asis/shanghai
4) use entire disk (第二选项)
5) username: it
6) Encrypt your home directory --> (No)
7) Software selection --> OpenSSH、Samba、Manual
手动选择:(操作方式:回车键展开,移动要安装的包,+ 键标记为i)
admin --> quota
devel
docs
interpreters
libdevel
libs
8) Mail Server --> (No Configuration)
9) Grub --> install to mbr
10) 配置网卡
# vi /etc/network/interfaces
auto lo eth0
iface eth0 inet static
address 172.16.1.19
netmask 255.255.255.0
broadcast 172.16.1.255
gateway 172.16.1.1
11) 配置DNS
# vi /etc/resolv.conf
nameserver 172.16.1.7
domain siviton.local
备份更新源,将更新源改为 163.com
# mv /etc/apt/sources.list/etc/apt/sources_old.list
# vi /etc/apt/sources.list
deb http://mirrors.163.com/ubuntu/ lucidmain universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ lucidmain universe restricted multiverse
deb http://mirrors.163.com/ubuntu/lucid-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/lucid-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/lucid-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/lucid-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ lucid-proposeduniverse main multiverse restricted
deb http://mirrors.163.com/ubuntu/lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/lucid-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/lucid-updates universe main multiverse restricted
# apt-get update
( 选装 gcc )# apt-get installbuild-essential
2.Install quota
# sudo apt-get install quota quotatool
# sudo gedit /etc/fstab
# /dev/hda1 UUID=4ea80ca3-37b7-447e-831a-700a38627029 / ext3defaults,errors=remount-ro,usrquota,grpquota 0 1
安装samba #apt-get install samba smbfs
# apt-get install system-config-samba
重启 # /etc/init.d/smbd restart 或service smbdrestart
添加samba帐号$sudo smbpasswd user
3.Install webmin
# sudo apt-get install perl perl-baseperl-modules libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtimelibio-pty-perl apt-show-versions python
# wget http://prdownloads.sourceforge.net/webadmin/webmin_1.630_all.deb
# sudo dpkg --install webmin_1.630_all.deb
4.Install GUI desktop (可选)
# sudo apt-get install ubuntu-desktop
5.Install xRDP (可选)
# sudo apt-get install xrdp
(二)配置 Android 编译环境
. 安装自带 SVN
0) # sudo apt-get install subversion
视需要选择是否编译安装 SVN 1.7.5版
1) # svn cohttp://svn.apache.org/repos/asf/apr/apr/branches/1.3.x apr
# svn cohttp://svn.apache.org/repos/asf/apr/apr-util/branches/1.3.x apr-util
安装过程如下:
1. 编译安装 apr-1.4.8
1)tar xvf apr-1.4.8.tar.gz
2)cd apr-1.4.8
3)./buildconf ## 这个比较重要 apt-get install autoconf libtool
4)./configure
5)make
6)make install
2. 编译安装 apr-util
1)tar xvf apr-util-1.5.2.tar.gz
2)mv apr-1.4.8 apr ## 此处把 apr-1.4.8 改名为 apr
3)cd apr-util-1.5.2
4)./buildconf
5)./configure--with-apr=/usr/local/apr ## 指明 apr 路径
6)make
7)make install
3. 压缩 sqlite,改名为 sqlite-amalgamation,复制到 svn 1.8.3 文件中
mv sqlite-amalgamation-3071501 subversion-1.8.3/ssqlite-amalgamation
## 上面指令不是实际执行的指令,示例用,注意 sqlite-amalgamation 文件夹里应该是 4 个源文件
4. 编译安装 subversion-1.8.3
1)cd subversion-1.8.3
2)./configure --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr/bin/apu-1-config
3)make
4)make install
5)cp /usr/local/bin/svn* /usr/bin ## 复制编译好的 svn* 执行文件到 /usr/bin 并覆盖
6)# 验证 svn --version
svn--version
svn,version 1.7.5 (r1336830)
compiled Mar 27 2014, 11:59:14
(三)安装arm*文件
(1)安装ARM Tool-Chain:
将arm-2010.09-arm-none-linux-gnueabi.tgz,arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2,复制到ubuntu虚拟机的/opt文件夹中;
解压ARM Tool-Chain文件:
tar xvfarm-2010.09-arm-none-linux-gnueabi.tgz
tar xvjfarm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
安装必要组件:
apt-get install git-coregnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libsx11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-devg++-multilib mingw32 tofrodos python-markdown libxml2-utils liblzo2-2
(2)安装JDK:
在http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u31-oth-JPR网址下载:jdk-6u31-linux-i586.bin,jre-6u31-linux-i586.bin
复制文件jdk-6u31-linux-i586.bin,jre-6u31-linux-i586.bin到/usr/local,
chmod +x jdk-6u31-linux-i586.bin
chmod +x jre-6u31-linux-i586.bin
执行./jdk-6u31-linux-i586.bin安装jdk;执行./ jre-6u31-linux-i586.bin安装jre;
在/etc/profile.d/文件夹下添加一个java.sh文件,文件内容为:
exportJAVA_HOME=/usr/local/jdk1.6.0_31
exportCLASSPATH=.:$JAVA_HOME/lib
exportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
在终端执行:source/etc/profile
测试java,javac:打印出如下信息,说明安装成功
root@ubuntu03:~#java
Usage:java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
root@ubuntu03:~#javac
Usage:javac
wherepossible options include:
-g Generate all debugginginfo
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
(4)编译错误:
A.Supernova编译出现dos2unix指令找不到的问题,需要安装tofrodos:
dos2unix on Ubuntu 10.04
Yet another "feature"from the developers of ubuntu to simplify life. "dos2unix" and"unix2dos" are missing in version 10.04 (Lucid).
installdos2unix package:
sudo aptitude install tofrodos
或者
sudo apt-get install tofrodos
Thenif you want "dos2unix" type "fromdos" and if you want"unix2dos", type "todos". If you have a habit of typing inthe old commands, its best to create links.Go to/usr/bin:
sudo ln -s fromdos dos2unix
sudo ln -s todos unix2dos
# vi /etc/profile
exportPATH=$PATH:/opt/arm-2010.09/bin:/opt/arm-2011.03/bin
B. Android编译时出现liblzo找不到编译错误的问题:
sudoapt-get install liblzo2-2
问题分析:shell scripts代码对于标准bash而言没有错,因为Ubuntu为了加快开机速度,用dash代替了传统的bash,是dash在捣鬼。
解决方法:取消dash:
sudo dpkg-reconfigure dash
在选择项中选No,即可。
验证完成:
#svn cosvn://172.16.1.9/msd6369/base
#./buildsvt.sh android (测试1) -- Make -6 32分钟、Make -12 26分钟
#./buildsvt.sh supernova (测试2)
(四)开启ubuntu 的Ccache 模式
. 添加环境变量
# vi /etc/profile ,尾添以下两行
exportUSE_CCACHE=1
exportCCACHE_DIR=/var/.ccache
2. 建立缓存目录
# mkdir /var/.ccache
3. 安装ccache
# apt-get install ccache
4. 设置缓存大小:
# ccache -M 20G
5. 可以用以下命令查看 ccache 的运行情况:
# ccache -s
或者
# watch -n1 -d ccache -s
172.16.1.17上的状态:
root@ubuntu03:~#ccache -s
cachedirectory /var/.ccache
cachehit 13242134
cachemiss 2286727
calledfor link 644670
compilefailed 8
ccacheinternal error 7
preprocessorerror 1
cachefile missing 6
not aC/C++ file 388041
unsupportedcompiler option 109699
files incache 354507
cachesize 35.5 Gbytes
max cachesize 40.0 Gbyte
(五)ubuntu LVM模式
########.ubuntuserver使用LVM模式进行管理后 其他加入的硬盘同样需要以LVM分区的形式挂载。
1.$sudofdisk -l 查看服务器上的所有硬盘信息。
Disk/dev/sda: 240.1 GB, 240057409536 bytes
255heads, 63 sectors/track, 29185 cylinders
Units =cylinders of 16065 * 512 = 8225280 bytes
Sectorsize (logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Diskidentifier: 0x0003075c
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 248832 83 Linux
Partition1 does not end on cylinder boundary.
/dev/sda2 32 29186 234179585 5 Extended
/dev/sda5 32 29186 234179584 8e Linux LVM
Disk/dev/sdb: 180.0 GB, 180045766656 bytes
255heads, 63 sectors/track, 21889 cylinders
Units =cylinders of 16065 * 512 = 8225280 bytes
Sectorsize (logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Diskidentifier: 0x0c8a4135
Device Boot Start End Blocks Id System
/dev/sdb1 1 21889 175823361 83 Linux
Disk/dev/sdc: 2000.4 GB, 2000398934016 bytes
255heads, 63 sectors/track, 243201 cylinders
Units =cylinders of 16065 * 512 = 8225280 bytes
Sectorsize (logical/physical): 512 bytes / 512 bytes
I/O size(minimum/optimal): 512 bytes / 512 bytes
Diskidentifier: 0xbe24f476
Device Boot Start End Blocks Id System
/dev/sdc1 1 243201 1953512001 83 Linux
2.$sudopvscan /*查看系统所有物理卷 还有$sudo pvdisplay
3.$sudopvcreate /dev/sdb /*创建物理卷(初始化硬盘)此命令将整个磁盘创建为物理卷。 如果需要将物理卷里面的单个分区作为物理卷命令如下:
$sudo pvcreate /dev/sdb1
4.创建卷组(vgdisplay)
ubuntu@ubuntu04:/home$sudo vgcreate sdclvg /dev/sdc
5.激活卷组
ubuntu@ubuntu04:/$sudo vgchange -ay sdclvg
6.创建逻辑卷 (lvdisplay)
ubuntu@ubuntu04:/home$sudo lvcreate -n sdc_lv -L 1800Gsdclvg
Logical volume "sdc_lv" created
7.格式化
ubuntu@ubuntu04:/home$sudo mkfs.ext4 /dev/sdclvg/sdc_lv
8.挂载
ubuntu@ubuntu04:/home$sudo mount /dev/sdclvg/sdc_lv /sdc1/
9.查看
ubuntu@ubuntu04:/home$sudo df -lh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu04-root
211G 196G 5.0G 98% /
none 7.9G 236K 7.9G 1% /dev
none 7.9G 0 7.9G 0% /dev/shm
none 7.9G 9.4M 7.9G 1% /var/run
none 7.9G 0 7.9G 0% /var/lock
none 7.9G 0 7.9G 0% /lib/init/rw
/dev/sda1 228M 17M 199M 8% /boot
/dev/mapper/sdblvg-sdb_lv
162G 188M 154G 1% /sdb1
/dev/mapper/sdclvg-sdc_lv
1.8T 196M 1.7T 1% /sdc1
网站名称:android__Ubuntu-编译环境搭建
链接地址:http://ybzwz.com/article/jhppcc.html