Issues with OpenCV

Hello,

I hope whomever is reading this is having a good day! I’m trying to have a codelet use OpenCV. I’ve created a skeleton codelet, in which are just bare minimum to run. With ‘skeleton codelet’ I mean make the codelet as simple as Ping. When I deploy it and run on my Jetson device it works fine. However, if I run it in my docker environment it does not run and gives me an error that libopencv_core.so cannot be found. So I tried the edge_detector app from tutorials, and If i strip that one to a skeleton I get the same issue.

So my question here is, why is the modules.cpp looking for libopencv_core.so, what does it mean to have loaded a module? And how can it not find the .so file, specifically for x86 lib? I checked the bazel cache, the libopencv_core.so, libopencv_core.so.4.1 and

BUILD file:

load("//bzl:module.bzl", "isaac_app", "isaac_cc_module")

isaac_cc_module(
    name = "codelet",
    srcs = ["codelet.cpp"],
    hdrs = ["codelet.hpp"],
    visibility = ["//visibility:public"],
    deps = [
        "//third_party:opencv",
    ],
)

isaac_app(
    name = "my_app",
    modules = [
        "sight",
        "//apps/nvidia_isaac_app/my_app:codelet",
    ],
    visibility = ["//visibility:public"],
)

Error log:

2021-06-09 07:54:57.756 WARN external/com_nvidia_isaac_engine/engine/alice/backend/backend.cpp@200: This application does not have an execution group configuration. One will be autogenerated to the best of the systems abilities if possible.
2021-06-09 07:54:57.756 WARN external/com_nvidia_isaac_engine/engine/gems/scheduler/scheduler.cpp@341: No default execution groups specified. Attempting to create scheduler configuration for 12 remaining cores. This may be non optimal for the system and application.
2021-06-09 07:54:57.756 INFO external/com_nvidia_isaac_engine/engine/gems/scheduler/scheduler.cpp@291: Scheduler execution groups are:
2021-06-09 07:54:57.756 INFO external/com_nvidia_isaac_engine/engine/gems/scheduler/scheduler.cpp@300: BlockerGroup: Cores = [3, 4, 5], Workers = No
2021-06-09 07:54:57.756 INFO external/com_nvidia_isaac_engine/engine/gems/scheduler/scheduler.cpp@300: WorkerGroup: Cores = [11, 10, 9, 8, 7, 6, 1, 0, 2], Workers = Yes
2021-06-09 07:54:57.759 INFO external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@271: Loaded module ‘packages/sight/libsight_module.so’: Now has 31 components total
2021-06-09 07:54:57.759 ERROR external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@295: apps/nvidia_isaac_app/libcodelet_module.so: libopencv_core.so.4.1: cannot open shared object file: No such file or directory
2021-06-09 07:54:57.759 PANIC external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@297: Could not load all required modules for application

If i set export LD_DEBUG=libs I can see that it tries to find libopencv_core, but fails. How can I add the actual path to this search space?

I could add it to LD_LIBRARY_PATH , however then i need to add it for each app folder name which seems really bad and a pain to update if the app name changes…

 28416:	find library=libopencv_core.so.4.1 [0]; searching
 28416:	 search path=		(LD_LIBRARY_PATH)
 28416:	 search path=/usr/lib/x86_64-linux-gnu		(system search path)
 28416:	  trying file=/usr/lib/x86_64-linux-gnu/libopencv_core.so.4.1
 28416:	 search path=/usr/lib/i386-linux-gnu		(LD_LIBRARY_PATH)
 28416:	  trying file=/usr/lib/i386-linux-gnu/libopencv_core.so.4.1
 28416:	 search path=tls/x86_64/x86_64:tls/x86_64:tls/x86_64:tls:x86_64/x86_64:x86_64:x86_64:		(RUNPATH from file /root/.cache/bazel/_bazel_root/4ba0b84eadbbe44ac95feee54d73b56c/execroot/com_nvidia_isaac_sdk/bazel-out/k8-opt/bin/apps/app/components/codelet/codelet.runfiles/com_nvidia_isaac_sdk//apps/app/components/codelet/../../../../_solib_k8/_U@opencv_Ux86_U64_S_S_Copencv_Ux86_U64___Uexternal_Sopencv_Ux86_U64_Slib/libopencv_features2d.so.4.1)
 28416:	  trying file=tls/x86_64/x86_64/libopencv_core.so.4.1
 28416:	  trying file=tls/x86_64/libopencv_core.so.4.1
 28416:	  trying file=tls/x86_64/libopencv_core.so.4.1
 28416:	  trying file=tls/libopencv_core.so.4.1
 28416:	  trying file=x86_64/x86_64/libopencv_core.so.4.1
 28416:	  trying file=x86_64/libopencv_core.so.4.1
 28416:	  trying file=x86_64/libopencv_core.so.4.1
 28416:	  trying file=libopencv_core.so.4.1
 28416:	 search cache=/etc/ld.so.cache
 28416:	 search path=/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/lib:/usr/lib		(system search path)
 28416:	  trying file=/lib/x86_64-linux-gnu/libopencv_core.so.4.1
 28416:	  trying file=/usr/lib/x86_64-linux-gnu/libopencv_core.so.4.1
 28416:	  trying file=/lib/libopencv_core.so.4.1
 28416:	  trying file=/usr/lib/libopencv_core.so.4.1
 28416:	

2021-06-10 15:23:42.361 ERROR external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@297: apps/app/components/codelet/libcodelet_module.so: libopencv_core.so.4.1: cannot open shared object file: No such file or directory
2021-06-10 15:23:42.361 PANIC external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@299: Could not load all required modules for application

I was having this problem but I was using bazel 4.2.1 installed by apt. I switch to using the bazel that ./engine/build/scripts/install_dependencies.sh installs in /usr/local/bin (3.1.0) and it finds the .so’s now.