溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

android__Ubuntu-編譯環(huán)境搭建

發(fā)布時(shí)間:2020-06-09 06:52:30 來(lái)源:網(wǎng)絡(luò) 閱讀:919 作者:minmanman 欄目:移動(dòng)開(kāi)發(fā)

msd6369__Ubuntu-編譯環(huán)境搭建

 

在安裝編譯環(huán)境前需要做做以下步驟:

(). 安裝ubuntu10.04 server x64位操作系統(tǒng) 此步驟需要注意以下設(shè)置:
安裝 Ubuntu 10.04 LTS Server 64bit

1)  CD-ROM 啟動(dòng) ... 沒(méi)有說(shuō)明的地方直接《回車》,或選擇“default

2)  英文、缺省鍵盤(pán)

2)  服務(wù)器名字:ubuntu03

3)  選擇時(shí)區(qū): Select from worldwide list --> Asis/shanghai

4)  use entire disk (第二選項(xiàng))

5)  username:  it

6)  Encrypt your home directory            --> (No)

7)  Software selection  --> OpenSSH、SambaManual

    手動(dòng)選擇:(操作方式:回車鍵展開(kāi),移動(dòng)要安裝的包,+ 鍵標(biāo)記為i

              admin --> quota

              devel

              docs

              interpreters

              libdevel

              libs

    <ESC>退出后,確認(rèn)安裝

8)  Mail Server -->  (No Configuration)

9)  Grub        -->  install to mbr

10) 配置網(wǎng)卡

    # 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帳號(hào)$sudo?。螅恚猓穑幔螅螅鳎洹。酰螅澹颉?/span>

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 編譯環(huán)境

. 安裝自帶 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

 

   安裝過(guò)程如下:

 

1. 編譯安裝 apr-1.4.8

    1)tar xvf apr-1.4.8.tar.gz 

    2)cd apr-1.4.8

    3)./buildconf                              ## 這個(gè)比較重要  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,復(fù)制到 svn 1.8.3 文件中

    mv sqlite-amalgamation-3071501 subversion-1.8.3/ssqlite-amalgamation  

    ## 上面指令不是實(shí)際執(zhí)行的指令,示例用,注意 sqlite-amalgamation 文件夾里應(yīng)該是 4 個(gè)源文件

 

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             ## 復(fù)制編譯好的 svn* 執(zhí)行文件到 /usr/bin 并覆蓋

   6# 驗(yàn)證 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.tgzarm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2,復(fù)制到ubuntu虛擬機(jī)的/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網(wǎng)址下載:jdk-6u31-linux-i586.binjre-6u31-linux-i586.bin

        復(fù)制文件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

        執(zhí)行./jdk-6u31-linux-i586.bin安裝jdk;執(zhí)行./ jre-6u31-linux-i586.bin安裝jre

        /etc/profile.d/文件夾下添加一個(gè)java.sh文件,文件內(nèi)容為:

exportJAVA_HOME=/usr/local/jdk1.6.0_31

exportCLASSPATH=.:$JAVA_HOME/lib

exportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

        在終端執(zhí)行:source/etc/profile

        測(cè)試javajavac:打印出如下信息,說(shuō)明安裝成功

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)編譯錯(cuò)誤:

A.Supernova編譯出現(xiàn)dos2unix指令找不到的問(wèn)題,需要安裝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編譯時(shí)出現(xiàn)liblzo找不到編譯錯(cuò)誤的問(wèn)題:

sudoapt-get install liblzo2-2

問(wèn)題分析:shell scripts代碼對(duì)于標(biāo)準(zhǔn)bash而言沒(méi)有錯(cuò),因?yàn)?/span>Ubuntu為了加快開(kāi)機(jī)速度,用dash代替了傳統(tǒng)的bash,是dash在搗鬼。

解決方法:取消dash
sudo dpkg-reconfigure dash
在選擇項(xiàng)中選No,即可。

驗(yàn)證完成:

#svn cosvn://172.16.1.9/msd6369/base

    #./buildsvt.sh android    (測(cè)試1) -- Make -6 32分鐘、Make -12 26分鐘

#./buildsvt.sh supernova  (測(cè)試2)

 

(四)開(kāi)啟ubuntu Ccache 模式

. 添加環(huán)境變量

    # vi /etc/profile ,尾添以下兩行

exportUSE_CCACHE=1

exportCCACHE_DIR=/var/.ccache

 

2. 建立緩存目錄

     # mkdir /var/.ccache

 

3. 安裝ccache

     # apt-get install ccache

 

4. 設(shè)置緩存大?。?/span>

     # ccache -M 20G

 

5. 可以用以下命令查看 ccache 的運(yùn)行情況:

     # ccache -s

     或者

     # watch -n1 -d ccache -s

 

172.16.1.17上的狀態(tài):   

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模式進(jìn)行管理后 其他加入的硬盤(pán)同樣需要以LVM分區(qū)的形式掛載。

 

1.$sudofdisk -l  查看服務(wù)器上的所有硬盤(pán)信息。

 

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   /*查看系統(tǒng)所有物理卷 還有$sudo pvdisplay

3.$sudopvcreate /dev/sdb  /*創(chuàng)建物理卷(初始化硬盤(pán))此命令將整個(gè)磁盤(pán)創(chuàng)建為物理卷。                     如果需要將物理卷里面的單個(gè)分區(qū)作為物理卷命令如下:

 $sudo pvcreate /dev/sdb1

 

4.創(chuàng)建卷組vgdisplay)

ubuntu@ubuntu04:/home$sudo vgcreate sdclvg /dev/sdc

5.激活卷組

ubuntu@ubuntu04:/$sudo vgchange -ay sdclvg

6.創(chuàng)建邏輯卷 (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


向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI