Replace third/openxr source code with libopenxr_loader.so

47 views
Skip to first unread message

王强

unread,
Dec 13, 2023, 5:02:15 AM12/13/23
to gn-dev
I need to replace third/openxr source code with libopenxr_loader.so.
1、Delete source_set("openxr") from third_party/openxr/BUILD.gn
2、Add source_set("openxr")
  source_set("openxr") {
    # This visibility is done to help enforce the dependency that
    # openxr_platform.h requires platform headers to be included before it.
    # If you'd like to expand this visibility, you will need to make similar
    # DEPS rules for it as are present in the below locations.
    visibility = [
      "//chrome/browser/vr/*",
      "//components/webxr/*",
      "//device/vr/*",
    ]

    loadable_module = [
      "openxr_loader/arm64-v8a-debug/libc++_shared.so",
      "openxr_loader/arm64-v8a-debug/libopenxr_loader.so",
    ]

    public_configs = [ ":config" ]
  }
But  compile failed:
[0/1] Regenerating ninja files
ERROR at //third_party/openxr/BUILD.gn:85:23: Assignment had no effect.
    loadable_module = [
                      ^
You set the variable "loadable_module" here and it was unused before it went
out of scope.
See //components/webxr/android/BUILD.gn:104:26: which caused the file to be included.
      public_configs = [ "//third_party/openxr:config" ]
                         ^----------------------------
FAILED: build.ninja.stamp
../../buildtools/linux64/gn --root=../.. -q --regeneration gen .
ninja: error: rebuilding 'build.ninja': subcommand failed


Replace loadable_module to libs
[0/1] Regenerating ninja files
[2/5] SOLINK ./libchrome.cr.so
FAILED: libchrome.cr.so libchrome.cr.so.TOC lib.unstripped/libchrome.cr.so
"python3" "../../build/toolchain/gcc_solink_wrapper.py" --readelf="../../third_party/llvm-build/Release+Asserts/bin/llvm-readelf" --nm="../../third_party/llvm-build/Release+Asserts/bin/llvm-nm" --strip=../../third_party/llvm-build/Release+Asserts/bin/llvm-strip  --sofile="./lib.unstripped/libchrome.cr.so" --tocfile="./libchrome.cr.so.TOC" --output="./libchrome.cr.so" -- ../../third_party/llvm-build/Release+Asserts/bin/clang++ -shared -Wl,-soname="libchrome.cr.so" -Wl,--version-script=gen/chrome/android/libchrome_linker_script.txt -Werror -fuse-ld=lld -Wl,--fatal-warnings -Wl,--build-id -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,--color-diagnostics -Wl,--no-rosegment -Wl,--undefined-version -Wl,--no-call-graph-profile-sort -Wl,--exclude-libs=libvpx_assembly_arm.a -Wl,-z,max-page-size=16384 --target=aarch64-linux-android26 -Wl,-mllvm,-enable-machine-outliner=never -no-canonical-prefixes -Wl,--gdb-index -Wl,-z,defs -Wl,--as-needed --unwindlib=none -nostdlib++ --sysroot=../../third_party/android_toolchain/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Wl,-z,force-bti -Wl,-wrap,calloc -Wl,-wrap,free -Wl,-wrap,malloc -Wl,-wrap,memalign -Wl,-wrap,posix_memalign -Wl,-wrap,pvalloc -Wl,-wrap,realloc -Wl,-wrap,valloc -Wl,-wrap,malloc_usable_size -Wl,-wrap,realpath -Wl,-wrap,strdup -Wl,-wrap,strndup -Wl,-wrap,getcwd -Wl,-wrap,asprintf -Wl,-wrap,vasprintf -Wl,--dynamic-linker,/system/bin/linker64 -o "./lib.unstripped/libchrome.cr.so" @"./libchrome.cr.so.rsp" ./libqr_code_generator_ffi_glue.rlib obj/third_party/rust/qr_code/v2/lib/libqr_code-qr_code-2.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libstd.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/liballoc.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libcompiler_builtins.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_core.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libcore.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libprofiler_builtins.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libcfg_if.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libhashbrown.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_alloc.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/liblibc.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libpanic_abort.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libpanic_unwind.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libunwind.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/librustc_demangle.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libstd_detect.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libaddr2line.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libgimli.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libminiz_oxide.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libadler.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libobject.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libmemchr.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libgetopts.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/librustc_std_workspace_std.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libunicode_width.rlib local_rustc_sysroot/lib/rustlib/aarch64-linux-android/lib/libtest.rlib obj/third_party/rust/cxx/v1/lib/libcxx-cxx-1.rlib
ld.lld: error: undefined symbol: xrGetInstanceProcAddr
>>> referenced by openxr_platform_helper_android.cc:58 (../../components/webxr/android/openxr_platform_helper_android.cc:58)

>>>               obj/components/webxr/android/android/openxr_platform_helper_android.o:(webxr::OpenXrPlatformHelperAndroid::Initialize())
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


But there is this interface in libopenxr_loader.so. I tried not to call this interface and was able to compile successfully, but  libopenxr_loader.so  is not included in ChromePublic.apk.

王强

unread,
Dec 13, 2023, 5:05:59 AM12/13/23
to gn-dev, 王强
Reply all
Reply to author
Forward
0 new messages