Search code examples
androidandroid-source

AOSP: fatal error: 'cstdio' file not found


I'm stuck with the error below while building a private vendor specific clone of AOSP. What's weird is that I have tried on 3 machines and everything works fine one the one machine that I cannot use.

/home/username/workspace/aosp/prebuilts/clang/host/linux-x86/clang-r383902b1/bin/clang++ -c -DPCCTS_USE_NAMESPACE_STD -I Pccts/h -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/   Pccts/h/AParser.cpp -o AParser.o
In file included from Pccts/h/AParser.cpp:30:
In file included from Pccts/h/pcctscfg.h:61:
Pccts/h/pccts_stdio.h:5:10: fatal error: 'cstdio' file not found
#include <cstdio>
         ^~~~~~~~
1 error generated.
make[3]: *** [GNUmakefile:68: AParser.o] Error 1
make[3]: Leaving directory '/home/username/workspace/aosp/bootable/bootloader/edk2/BaseTools/Source/C/VfrCompile'
make[2]: *** [GNUmakefile:79: VfrCompile] Error 2
make[2]: Leaving directory '/home/username/workspace/aosp/bootable/bootloader/edk2/BaseTools/Source/C'
make[1]: *** [GNUmakefile:25: Source/C] Error 2
make[1]: Leaving directory '/home/username/workspace/aosp/bootable/bootloader/edk2/BaseTools'
make: *** [makefile:133: EDK_TOOLS_BIN] Error 2
make: Leaving directory '/home/username/workspace/aosp/bootable/bootloader/edk2'

Background: I need to build an app inside this AOSP environment. This app uses hidden APIs so it can only build within AOSP env. I have tried this on 3 machines:

  1. My personal gaming rig (i9-13900KF, 32 Core, 64GB Ram, Ubuntu 22.04.3 LTS)
  2. Corporate desktop (Xeon W-2295, 32 Core, 32GB Ram, Ubuntu 22.04.3 LTS)
  3. Corporate laptop (i9-11950H, 16 Core, 64GB Ram, Ubuntu 22.04.3 LTS)

Out of these 3 machines I've only been able to build it on #1. The problem with that is that I can't put any corporate code on mer personal PC.

In order to replicate my success from the personal PC on the corporate ones, I tried the following:

  • Clean & Rebuild on the personal machine to rule out a 'fluke'. It worked again and again.
  • Match the list of installed packages on the corporate machines to my personal machine
  • Copying the entire repo from my personal machine onto the corporate machine (tar)
  • Copying the entire repo + build outputs from my personal machine onto the corporate machine (tar/rsync)

I've checked and installed gcc, g++, clang, and anything else I could think of, but nothing seems to resolve it. The fact that the 3 environments are as close to each other as I know how to make them and I'm literally copying the exact same code, but only one works is even more confusing to me.


Solution

  • These two things worked for me:

    # download binary openssl packages from Impish build
    wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.1.1f-1ubuntu2.20_amd64.deb
    wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb
    wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
    
    # install downloaded binary packages
    sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
    sudo dpkg -i libssl-dev_1.1.1f-1ubuntu2.20_amd64.deb
    sudo dpkg -i openssl_1.1.1f-1ubuntu2.20_amd64.deb