Extension Development Workflow: Errors with Bazel

• Hardware Platform (Jetson / GPU)

x86_64/NVIDIA GeForce RTX 3060 Laptop

• DeepStream Version
Windows11/Ubuntu WSL2/Docker Desktop/Container: nvidia/deepstream:7.1-gc-triton-devel

• TensorRT Version
10.9.0.34-1+cuda12.8 amd64

• NVIDIA GPU Driver Version (valid for GPU only)

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.124.06             Driver Version: 572.70         CUDA Version: 12.8     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060 ...    On  |   00000000:01:00.0  On |                  N/A |
| N/A   45C    P8             19W /   95W |    1312MiB /   6144MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

• Issue Type( questions, new requirements, bugs)

I followed the documentation: Extension Development Workflow

I have an error with bazel.

/tmp/test/extensions/test# bazel build …

INFO: Repository rules_python instantiated at:
  /tmp/test/WORKSPACE:34:13: in <toplevel>
Repository rule http_archive defined at:
  /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
WARNING: Download from https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Unknown host: urm.nvidia.com
ERROR: An error occurred during the fetch of repository 'rules_python':
   Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp10637611564116379902/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
ERROR: /tmp/test/WORKSPACE:34:13: fetching http_archive rule //external:rules_python: Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp10637611564116379902/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
ERROR: Analysis of target '//extensions/test:register_test_ext' failed; build aborted: no such package '@rules_python//python': java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp10637611564116379902/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
INFO: Elapsed time: 0.285s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (26 packages loaded, 86 targets configured)
    currently loading: @com_extension_dev//build
root@01f1e2e81c40:/tmp/test/extensions/test# bazel build ...
INFO: Repository rules_python instantiated at:
  /tmp/test/WORKSPACE:34:13: in <toplevel>
Repository rule http_archive defined at:
  /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
WARNING: Download from https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Unknown host: urm.nvidia.com
ERROR: An error occurred during the fetch of repository 'rules_python':
   Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp1133587412676880328/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
ERROR: /tmp/test/WORKSPACE:34:13: fetching http_archive rule //external:rules_python: Traceback (most recent call last):
        File "/root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
                download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp1133587412676880328/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
ERROR: Analysis of target '//extensions/test:register_test_ext' failed; build aborted: no such package '@rules_python//python': java.io.IOException: Error downloading [https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz] to /root/.cache/bazel/_bazel_root/d1309ac1e2719cdf777c0d6e936fc92b/external/rules_python/temp1133587412676880328/rules_python-0.1.0.tar.gz: Unknown host: urm.nvidia.com
INFO: Elapsed time: 0.209s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (4 packages loaded, 73 targets configured)
    currently loading: @com_extension_dev//build

Is there a bazel configuration file to be changed somewhere in the container?

Thanks.

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

I inserted the details of my configuration.

The problem is in the generated file “WORKSPACE” in the folder of the new extension (/tmp/test).
There is these URLs in the code:

"https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/magic_enum/v0.9.3.zip"
"https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/bazelbuild/rules_python/rules_python-0.1.0.tar.gz"
etc.

What should I use instead of these URLs?
Thanks

NB: “The WORKSPACE file is already disabled in Bazel 8 (late 2024) and will be removed in Bazel 9 (late 2025)” source. In the container, Bazel version 6 is installed.

I removed the version 6 of bazel.

rm -rf /usr/local/bin/bazel
rm -rf /usr/local/lib/bazel

I installed the last version of Bazel (8).

I inserted in the file MODULE.bazel the external libs of WORKSPACE file. I did not find the same version :-/ so I put the last version.

bazel_dep(name = "rules_python", version = "1.2.0")
bazel_dep(name = "magic_enum", version = "0.9.7")
bazel_dep(name = "yaml-cpp", version = "0.8.0")

I disabled the lines about these libs in the WORKSPACE file.

When I execute bazel, I have this error.
/tmp/test# bazel build … --enable_workspace

ERROR: /tmp/test/extensions/test/BUILD:7:19: Compiling extensions/test/HelloWorld.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target //extensions/test:libgxf_test.so) /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 49 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/com_extension_dev/gxf/core/entity.hpp:26,
                 from external/com_extension_dev/gxf/core/component.hpp:26,
                 from bazel-out/k8-opt/bin/external/StandardExtension/_virtual_includes/StandardExtension/gxf/std/codelet.hpp:21,
                 from extensions/test/HelloWorld.hpp:4,
                 from extensions/test/HelloWorld.cpp:2:
external/com_extension_dev/gxf/core/expected_macro.hpp:24:10: fatal error: magic_enum.hpp: No such file or directory
   24 | #include "magic_enum.hpp"  // NOLINT(build/include)
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Target //extensions/test:libgxf_test.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.409s, Critical Path: 0.26s
INFO: 17 processes: 17 internal.
ERROR: Build did NOT complete successfully
FAILED:
    Fetching repository @@rules_python++python+python_3_11_x86_64-unknown-linux-gnu; starting

An idea to resolve this problem?
if an extension is compiled with different versions, the extension will work always with graph composer?

  1. The bazel tool is ready in the docker nvcr.io/nvidia/deepstream:7.1-gc-triton-devel, you don’t need to install by yourself.
  2. Have you installed the ubuntu OS according to DeepStream On WSL — DeepStream documentation?
  3. Have you synced the extensions from NGC as Extension Development Workflow — DeepStream documentation?

I’ve tried the extension sample in WSL, it works well.

The problem is about your domain : urm.nvidia.com

$ ping nvidia.com
PING nvidia.com (34.194.97.138) 56(84) bytes of data.
$ ping urm.nvidia.com
ping: urm.nvidia.com: No address associated with hostname

In EU (France), this address does not work.

Can you fix the configuration of your repository to see/use this domain in EU?
(or plan B… update Bazel with a public repository available in EU and update the code of your example)
(or plan C… give directly the IP of server behind the domain urm.nvidia.com)

Can you see anything in web browser with the address https://urm.nvidia.com/artifactory/sw-isaac-gxf-generic-local/dependencies/external/?

I cannot.

We need to check this issue, it may take some time. Thank you!

1 Like

They’re using internal NVIDIA links, so you’ll need to modify them. My modified file works for me
change
/opt/nvidia/graph-composer/extension-dev/build/graph_extension.bzl
to

"""
SPDX-FileCopyrightText: Copyright (c) 2021-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Modified by Mohamed Rizk, Computer Vision Engineer at Racid Witco.
"""

load("@com_extension_dev//build/toolchain:toolchain.bzl", "toolchain_configure")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def load_extension_dev_workspace():
    toolchain_configure(name = "toolchain")

    http_archive(
        name = "yaml-cpp",
        build_file = "@com_extension_dev//build:third_party/yaml-cpp.BUILD",
        strip_prefix = "yaml-cpp-0.8.0",
        urls = ["https://github.com/jbeder/yaml-cpp/archive/refs/tags/0.8.0.tar.gz"],
        sha256 = "fbe74bbdcee21d656715688706da3c8becfd946d92cd44705cc6098bb23b3a16",
        type = "tar.gz",
    )

    http_archive(
        name = "rules_python",
        url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
        sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
    )

    http_archive(
        name = "magic_enum",
        strip_prefix = "magic_enum-0.9.3",
        urls = ["https://github.com/Neargye/magic_enum/archive/refs/tags/v0.9.3.tar.gz"],
        sha256 = "3cadd6a05f1bffc5141e5e731c46b2b73c2dbff025e723c8abaa659e0a24f072",
        type = "tar.gz",
    )

def graph_cc_extension(
        name,
        interfaces = [],
        srcs = [],
        hdrs = [],
        visibility = None,
        deps = [],
        linkopts = [],
        **kwargs):
    """
    Creates an extension as DSO with file name libgxf_XXX.so
    where XXX is the desired name of the module.
    """

    native.cc_binary(
        name = "libgxf_" + name + ".so",
        srcs = srcs + hdrs,
        visibility = visibility,
        deps = deps + ["@com_extension_dev//:extension_dev"],
        linkopts = linkopts + ["-Wl,-no-undefined"],
        linkshared = True,
        **kwargs
    )

def _graph_nvidia_extension_impl(repository_ctx):
    if not repository_ctx.which("registry"):
        fail("registry not found. Graph Composer tools must be installed")

    ext_uuid = None

    exec_res = repository_ctx.execute([
        "registry",
        "extn",
        "info",
        "-n",
        repository_ctx.name,
    ])
    if exec_res.return_code != 0:
        fail("Failed to get information for extension " + repository_ctx.name +
             ":\n" + exec_res.stderr)

    for line in exec_res.stdout.splitlines():
        if "uuid" in line:
            ext_uuid = line.split(" ")[-1]

    if ext_uuid == None:
        fail("Failed to get information for extension " + repository_ctx.name +
             ":\n" + exec_res.stderr)

    exec_res = repository_ctx.execute([
        "registry",
        "extn",
        "dependencies",
        "-n",
        repository_ctx.name,
        "-s",
        repository_ctx.attr.version,
    ])
    if exec_res.return_code != 0:
        fail("Failed to get dependencies for extension " + repository_ctx.name +
             ":\n" + exec_res.stderr)

    missing_deps = {}
    for line in exec_res.stdout.splitlines():
        if "- name:" in line:
            dep_ext_name = line.split(" ")[3]
            dep_ext_ver = line.split(" ")[5]
            exec_res = repository_ctx.execute([
                "ls",
                repository_ctx.path("../@" + dep_ext_name + ".marker"),
            ])
            if exec_res.return_code != 0:
                missing_deps[dep_ext_name] = dep_ext_ver

    if missing_deps:
        print(" ", "**** Following Nvidia  extensions should be added to workspace if not already ****\n" +
              "\n".join([n + " version " + v for n, v in missing_deps.items()]))

    exec_res = repository_ctx.execute([
        "registry",
        "extn",
        "import",
        "interface",
        "-n",
        repository_ctx.name,
        "-s",
        repository_ctx.attr.version,
        "-d",
        ".",
    ])

    if exec_res.return_code != 0:
        fail("Failed to import NGC extension " + repository_ctx.name +
             ":\n" + exec_res.stderr)

    exec_res = repository_ctx.execute(["ls", ext_uuid + "/"])
    for f in exec_res.stdout.splitlines():
        if "BUILD" in f:
            repository_ctx.execute(["mv", ext_uuid + "/" + f, "BUILD"])
        else:
            repository_ctx.execute(["mv", ext_uuid + "/" + f, f])

graph_nvidia_extension = repository_rule(
    implementation = _graph_nvidia_extension_impl,
    attrs = {"version": attr.string(mandatory = True)},
)

@m.rizk218

I changed the file graph_extension.bzl but after, the generated WORKSPACE contains always the bad url.

So, I changed the file WORKSPACE directly. It compiles now.

Thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.