您好,登錄后才能下訂單哦!
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
<ESC>退出后,確認安裝
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 <options> <source files>
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。