[Solution] Building Ubuntu Touch source on Ubuntu 16.10


  • Community

    After receiving my Fairphone 2, I've been wrestling with the Android build system trying to get it to spit out the system.img on Ubuntu 16.10. First, I had issues getting the recommended packages to install. Then, every time I'd try to build I'd get strange errors that I later learned were caused by newer versions of gcc and g++. So, the following instructions will get you building in no time at all.

    Please note that we will be removing the new versions of gcc and g++ in these instructions, which may impede your ability to build newer software. You might consider getting an Ubuntu 16.04 container or virtual machine, then doing the following.

    First, ensure that you do not have the build-essential, gcc, or g++ packages installed.

    sudo apt-get remove g++ gcc

    Now, let's install the required packages to build Ubuntu Touch.

    sudo apt-get install git gnupg flex bison gperf zip \
    bzr curl libc6-dev libncurses5-dev x11proto-core-dev \
    libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev \
    tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev \
    schedtool g++-4.8-multilib gcc-4.8-multilib
    

    This will install gcc-4.8 and g++-4.8, but won't allow you to use the gcc, g++, or cc commands. We need to link our compilers to the right place. We'll use update-alternatives for this.

    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 10
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
    sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
    

    There, all done. Now you should be able to build the UBPorts source on Ubuntu 16.10. These instructions should also help you on Ubuntu 16.04 and earlier if you're having trouble.


  • Community

    For future Googlers, the errors include:

    Apt-get saying:

    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     build-essential : Depends: gcc (>= 4:4.4.3) but it is not going to be installed
                       Depends: g++ (>= 4:4.4.3) but it is not going to be installed
     g++-4.8-multilib : Depends: g++-4.8 (= 4.8.4-2ubuntu1~14.04.3) but it is not going to be installed
                        Depends: gcc-4.8-multilib (= 4.8.4-2ubuntu1~14.04.3) but it is not going to be installed
     g++-multilib : Depends: cpp (>= 4:4.8.2-1ubuntu6) but it is not going to be installed
                    Depends: gcc-multilib (>= 4:4.8.2-1ubuntu6) but it is not going to be installed
                    Depends: g++ (>= 4:4.8.2-1ubuntu6) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    

    And gcc errors like:

    frameworks/base/libs/androidfw/AssetManager.cpp: In member function ‘android::String8 android::AssetManager::getPkgName(const char*)’:
    frameworks/base/libs/androidfw/AssetManager.cpp:480:63: error: invalid conversion from ‘const char16_t*’ to ‘const uint16_t* {aka const short unsigned int*}’ [-fpermissive]
                 const uint16_t* str = tree.getAttributeStringValue(idx, &len);
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
    

    And

    system/core/adb/transport.c:807:9: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
             if (error_out)
             ^~
    system/core/adb/transport.c:809:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
                 continue;
                 ^~~~~~~~
    


  • hi, i'm try to port UbT to Moto G 2014

    i have an error when generating boot.img
    boot.img too large (10729472 > [10771200 - 270336])

    Can any one help me to fix this, recovery.img work fine


Log in to reply
 

Looks like your connection to UBports Forum was lost, please wait while we try to reconnect.