Andrew,
Could you test the Termux build with the attached patch2?  I found a mistake in what I had checked into GIT that I thought I had fixed.  I do not get a failure on fedora or ubuntu 16 so can not test.
Mistake was corrected in the following + line in patch2 (QSort was mistakenly typed as qsort).
  
-               qsort(SortArray, NewColorSubdiv[Index].NumEntries,
-                     sizeof(QuantizedColorType *), SortCmpRtn);
+               QSort(SortArray, -1, NewColorSubdiv[Index].NumEntries, SortRGBAxis);

                /* Relink the sorted list into one: */
                for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++) {
@@ -339,19 +359,4 @@

On Wed, Sep 4, 2024 at 11:38 AM Andrew Randrianasulu <randrianasulu@gmail.com> wrote:
due to giflib-5.2.2.patch2

I removed patch and build is ok. Not sure where this  patch was needed, may be on older distros?

I also tried to "set -e" before building cingg and get build breaking error somewhere in x265 dir, as reported already.

but for me default (seen with "set -o" ) errexit=off, you can set it off for specific build by executing  "set  +e" before building cingg.