Error in installation of o2 via alibuild in Ubuntu 22.04.2 LTS

I am trying to install O2 on my pc which is running on Ubuntu 22.04.2 LTS using the documentation Installing O2 and O2Physics · ALICE O2 documentation
However, I am getting errors when I am trying to build it. I am attaching the errors I am getting and the aliDoctor warning and errors below.

==> Building GEANT3@v4-2
==> GEANT3 is being built (use --debug for full output): failed    
ERROR: Error while executing /home/sawan/alice/sw/SPECS/ubuntu2204_x86-64/GEANT3/v4-2-local1/build.sh on `sawan-OptiPlex-7050'.
ERROR: Log can be found in /home/sawan/alice/sw/BUILD/GEANT3-latest/log
ERROR: Please upload it to CERNBox/Dropbox if you intend to request support.
ERROR: Build directory is /home/sawan/alice/sw/BUILD/GEANT3-latest/GEANT3.

Output from command “aliDoctor O2Physics --defaults o2” is

WARNING: Package CMake cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v3.23.1
WARNING: verge() { [[  "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]]; }
WARNING: type cmake && verge 3.23.1 `cmake --version | sed -e 's/.* //' | cut -d. -f1,2,3`
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: CMake: cmake is /usr/bin/cmake
WARNING: 
SUCCESS: Required package openmp will be picked up from the system.
WARNING: Package libuv cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v1.40.0
WARNING: printf "#include <uv/version.h>\n#if UV_VERSION_HEX < 0x12a00\n#error libuv >=1.40.0 required\n#endif\n" | c++ -I$(brew --prefix libuv)/include -xc++ - -c -o /dev/null 2>&1
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: libuv: <stdin>:1:10: fatal error: uv/version.h: No such file or directory
WARNING: libuv: compilation terminated.
WARNING: 
WARNING: Package FFTW3 cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v3.3.9
WARNING: false
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: FFTW3: 
WARNING: 
SUCCESS: Package OpenSSL will be picked up from the system.
WARNING: Package GCC-Toolchain cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v12.2.0-alice1
WARNING: set -e
WARNING: which gfortran || { echo "gfortran missing"; exit 1; }
WARNING: case $REQUESTED_VERSION in
WARNING:   v12*) MIN_GCC_VERSION=120100 ;;
WARNING:   v10*) MIN_GCC_VERSION=100200 ;;
WARNING:   *) MIN_GCC_VERSION=70300 ;;
WARNING: esac
WARNING: which gcc
WARNING: test -f "$(dirname "$(which gcc)")/c++"
WARNING: gcc -xc++ - -c -o /dev/null << EOF
WARNING: #define GCCVER ((__GNUC__ * 10000)+(__GNUC_MINOR__ * 100)+(__GNUC_PATCHLEVEL__))
WARNING: #if (GCCVER < $MIN_GCC_VERSION)
WARNING: #error "System's GCC cannot be used: we need at least GCC $REQUESTED_VERSION. We'll compile our own version."
WARNING: #endif
WARNING: EOF
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: GCC-Toolchain: /usr/bin/gfortran
WARNING: GCC-Toolchain: /usr/bin/gcc
WARNING: GCC-Toolchain: <stdin>:3:2: error: #error "System's GCC cannot be used: we need at least GCC v12.2.0-alice1. We'll compile our own version."
WARNING: 
SUCCESS: Required package Python-system will be picked up from the system.
SUCCESS: Required package make will be picked up from the system.
WARNING: Package lz4 cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v1.9.3
WARNING: printf "#include <lz4.h>\n" | cc -xc -I$(brew --prefix lz4)/include - -c -M 2>&1
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: lz4: <stdin>:1:10: fatal error: lz4.h: No such file or directory
WARNING: lz4: compilation terminated.
WARNING: 
WARNING: Package utf8proc cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v2.6.1
WARNING: printf "#include <utf8proc.h>\n" | c++ -c -I$(brew --prefix utf8proc)/include -xc++ - -o /dev/null 2>&1;
WARNING: if [ $? -ne 0 ]; then printf "Use brew install utf8proc"; exit 1; fi
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: utf8proc: <stdin>:1:10: fatal error: utf8proc.h: No such file or directory
WARNING: utf8proc: compilation terminated.
WARNING: utf8proc: Use brew install utf8proc
WARNING: 
SUCCESS: Package zlib will be picked up from the system.
SUCCESS: Package GLFW will be picked up from the system.
SUCCESS: Package FreeType will be picked up from the system.
SUCCESS: Package libpng will be picked up from the system.
SUCCESS: Package lzma will be picked up from the system.
SUCCESS: Package bz2 will be picked up from the system.
WARNING: Package sqlite cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v3.15.0
WARNING: printf '#include <sqlite3.h>\nint main(){}\n' | cc -xc - -lsqlite3 -o /dev/null;
WARNING: if [ $? -ne 0 ]; then printf "SQLite not found.\n * On RHEL-compatible systems you probably need: sqlite sqlite-devel\n * On Ubuntu-compatible systems you probably need: libsqlite3-0 libsqlite3-dev\n"; exit 1; fi
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: sqlite: <stdin>:1:10: fatal error: sqlite3.h: No such file or directory
WARNING: sqlite: compilation terminated.
WARNING: sqlite: SQLite not found.
WARNING: sqlite:  * On RHEL-compatible systems you probably need: sqlite sqlite-devel
WARNING: sqlite:  * On Ubuntu-compatible systems you probably need: libsqlite3-0 libsqlite3-dev
WARNING: 
SUCCESS: Required package yacc-like will be picked up from the system.
SUCCESS: Package libxml2 will be picked up from the system.
WARNING: Package GSL cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v1.16
WARNING: printf "#include \"gsl/gsl_version.h\"\n#define GSL_V GSL_MAJOR_VERSION * 100 + GSL_MINOR_VERSION\n# if (GSL_V < 116)\n#error \"Cannot use system's gsl. Notice we only support versions from 1.16 (included)\"\n#endif\nint main(){}" | c++  -I$(brew --prefix gsl)/include -xc++ - -o /dev/null
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: GSL: <stdin>:1:10: fatal error: gsl/gsl_version.h: No such file or directory
WARNING: GSL: compilation terminated.
WARNING: 
SUCCESS: Required package opengl will be picked up from the system.
SUCCESS: Required package Xdevel will be picked up from the system.
WARNING: Package TBB cannot be picked up from the system and will be built by aliBuild.
WARNING: This is due to the fact the following script fails:
WARNING: 
WARNING: brew() { true; }; REQUESTED_VERSION=v2021.5.0
WARNING: printf "#include <tbb/concurrent_unordered_map.h>\n static_assert(TBB_INTERFACE_VERSION >= 11009, \"min version check failed\");\n" | c++ -std=c++11 -xc++ - -c -o /dev/null
WARNING: 
WARNING: with the following output:
WARNING: 
WARNING: TBB: <stdin>:2:16: error: 'TBB_INTERFACE_VERSION' was not declared in this scope
WARNING: 

==> The following packages will be built by aliBuild because
     usage of a system version of it is not allowed or supported, by policy:
    
    - Clang 
    - json-c 
    - GEANT3 
    - HepMC3 
    - libwebsockets 
    - googlebenchmark 
    - KFParticle 
    - curl 
    - alibuild-recipe-tools 
    - MCStepLogger 
    - double-conversion 
    - Alice-GRID-Utils 
    - ITSResponse 
    - fmt 
    - boost 
    - GEANT4_VMC 
    - ONNXRuntime 
    - Python-modules-list 
    - fastjet 
    - GEANT4 
    - MPFR 
    - JAliEn-ROOT 
    - Python-modules 
    - Python 
    - Monitoring 
    - libffi 
    - libjalienO2 
    - UUID 
    - generators 
    - arrow 
    - protobuf 
    - VecGeom 
    - VMC 
    - ZeroMQ 
    - xsimd 
    - Common-O2 
    - O2Physics 
    - ms_gsl 
    - AliEn-Runtime 
    - FairCMakeModules 
    - flatbuffers 
    - Ppconsul 
    - vgm 
    - GMP 
    - capstone 
    - ninja 
    - FairLogger 
    - FairMQ 
    - simulation 
    - defaults-release 
    - ROOT 
    - cgal 
    - Vc 
    - libInfoLogger 
    - RapidJSON 
    - re2 
    - ApMon-CPP 
    - XRootD 
    - AliEn-CAs 
    - xjalienfs 
    - O2 
    - MLModels 
    - FairRoot 
    - O2-customization 
    - pythia6 
    - libtirpc 
    - pythia 
    - lhapdf 
    - Configuration 
    - DebugGUI

==> The following packages will be picked up from the system:
    
    - zlib
    - libxml2
    - libpng
    - OpenSSL
    - GLFW
    - lzma
    - bz2
    - FreeType
    
    If this is not you want, you have to uninstall / unload them.

==> The following packages will be built by aliBuild because they couldn't be picked up from the system:
    
    - GCC-Toolchain
    - lz4
    - utf8proc
    - sqlite
    - GSL
    - FFTW3
    - libuv
    - TBB
    - CMake
    
    This is not a real issue, but it might take longer the first time you invoke aliBuild.
    Look at the error messages above to get hints on what packages you need to install separately.

Have you put the complete log somewhere? Or can you repeat it with --debug so the complete error message would be visible?

@slokos
Here are the errors from the error log file.
/home/sawan/alice/sw/ubuntu2004_x86-64/GCC-Toolchain/v12.2.0-alice1-1/bin/…/lib/gcc/x86_64-unknown-linux-gnu/12.2.0/…/…/…/…/x86_64-unknown-linux-gnu/bin/ld: cannot find -lROOT::EGPythia6: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/geant321.dir/build.make:17203: libgeant321.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/geant321.dir/all] Error 2
make: *** [Makefile:156: all] Error 2