androidc++linuxpcredevice-tree

Missing pcre(Perl Compatible Regular Expressions) object files while building TWRP custom recovery


Actually I am getting these errors while building TWRP custom recovery. I allso tried clean build make clean && make -j$(nproc --all) recoveryimage again and again but it always get stuck here.

I synced my TWRP source from this repo

Also Here is my device tree i used in this build.

Most of the missing object file are from pcre(Perl Compatible Regular Expressions). I tried installing relateable packages like pcre-cpp, pcre-devel, pcre-static, pcre2-devel, clang-devel, glibc-devel, gcc-c++, ... but nothing seams to work.

target StaticLib: libselinux (/home/harishkumar/Build_Android_5/TWRP-omni/out/target/product/LS_4008/obj/STATIC_LIBRARIES/libselinux_intermediates/libselinux.a)
/usr/bin/ld: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/EXECUTABLES/checkpolicy_intermediates/checkpolicy.o:/home/harishkumar/Build_Android_5/TWRP-omni/external/checkpolicy/checkpolicy.h:16: multiple definition of `te_assertions'; /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/EXECUTABLES/checkpolicy_intermediates/policy_define.o:/home/harishkumar/Build_Android_5/TWRP-omni/external/checkpolicy/checkpolicy.h:16: first defined here
/usr/bin/ld: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/EXECUTABLES/checkpolicy_intermediates/policy_parse.o:/home/harishkumar/Build_Android_5/TWRP-omni/external/checkpolicy/checkpolicy.h:16: multiple definition of `te_assertions'; /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/EXECUTABLES/checkpolicy_intermediates/policy_define.o:/home/harishkumar/Build_Android_5/TWRP-omni/external/checkpolicy/checkpolicy.h:16: first defined here
preparing StaticLib: libselinux_32 [including  /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/libpcre.a]
preparing StaticLib: libc++ [including  /home/harishkumar/Build_Android_5/TWRP-omni/out/target/product/LS_4008/obj/STATIC_LIBRARIES/libcompiler_rt_intermediates/libcompiler_rt.a]
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/pcre_chartables.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_byte_order.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_compile.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_config.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_dfa_exec.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_exec.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_fullinfo.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_get.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_globals.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_jit_compile.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_maketables.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_newline.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_ord2utf8.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_refcount.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_string_utils.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_study.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_tables.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_ucd.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_valid_utf8.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_version.o: No such file or directory
/bin/bash: line 1: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_xclass.o: No such file or directory
ar: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/pcre_chartables.o: No such file or directory
make: *** [build/core/host_static_library_internal.mk:27: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/libselinux.a] Error 1
make: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make: *** [build/core/host_executable_internal.mk:31: /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/EXECUTABLES/checkpolicy_intermediates/checkpolicy] Error 1

My Device Spec:

Host Os: Fedora Linux 40 (Forty) x86_64
Kernel: 6.8.5-301.fc40.x86_64
Target Device: Lyf Flame 7s

I am new in building custom recovery. This is my first time making device tree and cusom recovery for a device(which never had any device tree before). Any help will we appreciated.


Solution

  • I found solution to this error. Problem was, wrong address was appended before the location of object files.

    /home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libselinux_intermediates/WHOLE/libpcre_objs//home/harishkumar/Build_Android_5/TWRP-omni/out/host/linux-x86/obj32/STATIC_LIBRARIES/libpcre_intermediates/dist/pcre_xclass.o
    

    here you can see my home directory was appended twice. I fixed it by removing the unwanted variable from the make file


    in file

    build/core/definitions.mk at line no. 1223

    filelist="$$filelist $$ldir/$$f"; \
    

    edit this line to

    filelist="$$filelist $$f"; \