skip to Main Content

The issue is that building AOSP on Ubuntu 24.04 fails due to a missing libncurses5 library, which is no longer available in this version of Ubuntu.

Hello,

I want to compile the AOSP source code on my computer, but I find the following error reported, causing the compilation to fail.

[  0% 8/163124] bc: libclcore.bc <= frameworks/rs/driver/runtime/rs_f16_math.c
FAILED: out/target/product/generic_x86_64/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_f16_math.bc
/bin/bash -c "PWD=/proc/self/cwd prebuilts/clang/host/linux-x86/clang-3289846/bin/clang -Iframeworks/rs/script_api/include -Iexternal/clang/lib/Headers -MD -DRS_VERSION=24 -std=c99 -c -O3 -fno-builtin -emit-llvm -target renderscript64-linux-android -fsigned-char -D__x86_64__ -Wno-deprecated -Werror  -Werror -Wall -Wextra -Iframeworks/rs/cpu_ref -DRS_DECLARE_EXPIRED_APIS  -x renderscript frameworks/rs/driver/runtime/rs_f16_math.c -o out/target/product/generic_x86_64/obj/RENDERSCRIPT_BITCODE/libclcore.bc_intermediates/rs_f16_math.bc"
prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
12:48:08 ninja failed with: exit status 1

#### failed to build some targets (16 seconds) ####

As you can see, the error message is in libncurses.so.

libncurses.so.5: cannot open shared object file: No such file or directory

I have tried the following ways to solve this problem, with no success.

$ sudo dpkg --add-architecture i386  
$ sudo apt-get update

$ sudo apt-get install libncurses5:i386
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package libncurses5:i386

$ sudo apt-get install libncurses5-dev libncurses5
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libncurses-dev' instead of 'libncurses5-dev'
E: Unable to locate package libncurses5

I saw online that Ubuntu 24.04 no longer supports libncurses5 and needs to use libncurses6. But builing AOSP needs to use libncurses5. So, how can I solve this problem?

AOSP Branch: android-13.0.0_r9

My Ubuntu system:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       nobl

Thanks.

2

Answers


  1. The shift from ncurses5 to ncurses6 is breaking all kinds of things, but even if you get around it you might just reveal another problem, and another.

    Instead, I highly recommend building Android from a docker container rather than directly from your host OS. Then you can run whatever version of whatever Linux distro you like as your host OS and never worry about whether it can still build AOSP or not.

    Take a look at these projects:

    Note in one project it says that building from Docker is slower, that is only true if your host OS is not Linux (Mac OS, Windows, etc) so make sure your host OS is Linux and it will build just as fast from the container as from your host OS.

    Login or Signup to reply.
  2. Agree with @satur9nine that Docker is the way to go for AOSP.

    However, if you are want to install libncurses5, you can install the .deb packages. Start here, and follow one of the mirror links and grab libtinfo5_6.4-4 and libncurses5_6.4-4 for your arch.

    E.g.,

    sudo dpkg -i libtinfo5_6.4-4_amd64.deb
    sudo dpkg -i libncurses5_6.4-4_amd64.deb
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search