Do not add the ART APEX to LD_LIBRARY_PATH in the CTS tests, and link
statically what's needed instead.

Adding /apex/com.android.art/${LIB} to LD_LIBRARY_PATH conflates the
linker namespace separation and causes ART module libs to be loaded in
the default (= system) namespace. That causes linker errors when the
module is used on older system images where unstable shared libs are no
longer compatible.

Instead link all internal libs statically and only leave the ones with
exported APIs (which these CTS tests are intended to test).

Merged-In set to a CL in main to avoid merging there - gtests are
already linked statically there - it'll require a different fix.

Test: lunch aosp_x86_64
      atest art_libnativebridge_cts_tests \
            art_standalone_libdexfile_external_tests \
            libnativeloader_test \
            art_standalone_libartpalette_tests
  using a cvd with a TM system image (had to apply
  https://r.android.com/2654960 to make atest work in
  android13-tests-dev)
Bug: 317042881
Change-Id: I538b00418f2e5563f6d88ae8a6aa99372e44bb78
Merged-In: I538b00418f2e5563f6d88ae8a6aa99372e44bb78
Merged-In: I75a844f53663385ef98351f60d3adb900157f5e5
3 files changed