Skip to content

[BUG] [java] documented build steps for Java fail: "GPUInfoProviderImpl.java:[105,24] cannot find symbol" #2252

Description

@jameslamb

Describe the bug

I tried to build the Java bindings locally today, on an x86_64 Linux machine.

Found that the build failed like this:

$ ./build.sh clean libcuvs java
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/jlamb/repos/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/spi/JDKProvider.java:[10,1] cannot find symbol
  symbol:   static cudaStreamSynchronize
  location: class com.nvidia.cuvs.internal.panama.headers_h_1
[ERROR] /home/jlamb/repos/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/GPUInfoProviderImpl.java:[36,27] cannot find symbol
  symbol:   method cudaGetDeviceCount(java.lang.foreign.MemorySegment)
  location: class com.nvidia.cuvs.internal.GPUInfoProviderImpl.AvailableGpuInitializer
[ERROR] /home/jlamb/repos/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/GPUInfoProviderImpl.java:[93,22] cannot find symbol
  symbol:   method cudaGetDevice(java.lang.foreign.MemorySegment)
  location: class com.nvidia.cuvs.internal.GPUInfoProviderImpl
[ERROR] /home/jlamb/repos/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/GPUInfoProviderImpl.java:[97,24] cannot find symbol
  symbol:   method cudaSetDevice(int)
  location: class com.nvidia.cuvs.internal.GPUInfoProviderImpl
[ERROR] /home/jlamb/repos/cuvs/java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/GPUInfoProviderImpl.java:[105,24] cannot find symbol
  symbol:   method cudaSetDevice(int)
  location: class com.nvidia.cuvs.internal.GPUInfoProviderImpl

Steps/Code to reproduce bug

Checked out the latest commit on main (9ae6f93), and cleaned all prior build artifacts to ensure I had a clean starting state.

git checkout main
git pull upstream main
git clean -d -f -X

Created a conda environment with the CTK and other build dependencies.

conda create \
  --name cuvs-dev \
  --yes \
  --file ./conda/environments/all_cuda-133_arch-x86_64.yaml

source activate cuvs-dev

Then followed the docs and built with build.sh

./build.sh clean libcuvs java

https://github.com/rapidsai/cuvs/blob/9ae6f93f62f77449df9eaac41409ce76e78f4bcf/java/README.md#L19

Expected behavior

Expected to be able to build the Java bindings locally.

Environment details (please complete the following information):

Bare-metal on a local workstation.

environment details (click me)
$ nvidia-smi
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 590.48.01              Driver Version: 590.48.01      CUDA Version: 13.1     |
+-----------------------------------------+------------------------+----------------------+
| 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 RTX A6000               Off |   00000000:01:00.0  On |                  Off |
| 30%   40C    P8             27W /  300W |    1305MiB /  49140MiB |      3%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

$ java -version
openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment (build 22.0.2+9-70)
OpenJDK 64-Bit Server VM (build 22.0.2+9-70, mixed mode, sharing)

$ mvn -version
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: /home/jlamb/.asdf/installs/maven/3.9.9
Java version: 22.0.2, vendor: Oracle Corporation, runtime: /home/jlamb/.asdf/installs/java/openjdk-22.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.17.0-29-generic", arch: "amd64", family: "unix"

$ conda env export
name: cuvs-dev
channels:
  - conda-forge
  - rapidsai-nightly
dependencies:
  - _go_select=2.3.0=cgo
  - _openmp_mutex=4.5=20_gnu
  - _python_abi3_support=1.0=hd8ed1ab_2
  - attrs=26.1.0=pyhcf101f3_0
  - binutils=2.45.1=default_h4852527_102
  - binutils_impl_linux-64=2.45.1=default_hfdba357_102
  - binutils_linux-64=2.45.1=default_h4852527_102
  - bzip2=1.0.8=hda65f42_9
  - c-ares=1.34.6=hb03c661_0
  - c-compiler=1.11.0=h4d9bdce_0
  - ca-certificates=2026.6.17=hbd8a1cb_0
  - cffi=2.0.0=py314h4a8dc5f_1
  - cfgv=3.5.0=pyhd8ed1ab_0
  - clang=20.1.8=default_cfg_hcbb2b3e_16
  - clang-20=20.1.8=default_h99862b1_16
  - clang-format=20.1.8=default_h99862b1_16
  - clang-format-20=20.1.8=default_h99862b1_16
  - clang-tools=20.1.8=default_h57a47db_16
  - clang_impl_linux-64=20.1.8=default_cfg_h027053c_16
  - cmake=4.3.4=hc85cc9f_0
  - colorama=0.4.6=pyhd8ed1ab_1
  - compiler-rt=20.1.8=hb700be7_1
  - compiler-rt_linux-64=20.1.8=hffcefe0_1
  - coverage=7.14.2=py314h67df5f8_0
  - cpython=3.14.6=py314hd8ed1ab_100
  - cuda-bindings=13.3.1=py314h42812f9_1
  - cuda-cccl_linux-64=13.3.3.3.1=ha770c72_0
  - cuda-core=1.0.1=cuda13_py314h025f531_0
  - cuda-crt-dev_linux-64=13.3.33=ha770c72_0
  - cuda-crt-tools=13.3.33=ha770c72_0
  - cuda-cudart=13.3.29=hecca717_0
  - cuda-cudart-dev=13.3.29=hecca717_0
  - cuda-cudart-dev_linux-64=13.3.29=h376f20c_0
  - cuda-cudart-static=13.3.29=hecca717_0
  - cuda-cudart-static_linux-64=13.3.29=h376f20c_0
  - cuda-cudart_linux-64=13.3.29=h376f20c_0
  - cuda-driver-dev_linux-64=13.3.29=h376f20c_0
  - cuda-nvcc=13.3.33=hcdd1206_0
  - cuda-nvcc-dev_linux-64=13.3.33=he91c749_0
  - cuda-nvcc-impl=13.3.33=h85509e4_0
  - cuda-nvcc-tools=13.3.33=he02047a_0
  - cuda-nvcc_linux-64=13.3.33=hb2fc203_0
  - cuda-nvrtc=13.3.33=hecca717_0
  - cuda-nvrtc-dev=13.3.33=hecca717_0
  - cuda-nvtx=13.3.29=hecca717_0
  - cuda-nvtx-dev=13.3.29=ha770c72_0
  - cuda-nvvm-dev_linux-64=13.3.33=ha770c72_0
  - cuda-nvvm-impl=13.3.33=h4bc722e_0
  - cuda-nvvm-tools=13.3.33=h4bc722e_0
  - cuda-pathfinder=1.5.5=pyhc364b38_0
  - cuda-profiler-api=13.3.27=h7938cbb_0
  - cuda-python=13.3.1=py_min_310_1
  - cuda-version=13.3=hcbadf70_3
  - cupy=14.1.1=py314hdea9c46_0
  - cupy-core=14.1.1=py314hcd3b49b_0
  - cxx-compiler=1.11.0=hfcd1e18_0
  - cython=3.2.5=py314h1807b08_0
  - distlib=0.4.3=pyhcf101f3_0
  - dlpack=0.8=h59595ed_3
  - exceptiongroup=1.3.1=pyhd8ed1ab_0
  - filelock=3.29.4=pyhd8ed1ab_0
  - gcc=14.3.0=h6f77f03_19
  - gcc_impl_linux-64=14.3.0=h235f0fe_19
  - gcc_linux-64=14.3.0=h50e9bb6_27
  - go=1.26.4=h282a287_0
  - gxx=14.3.0=h76987e4_19
  - gxx_impl_linux-64=14.3.0=h2185e75_19
  - gxx_linux-64=14.3.0=hd240bd5_27
  - icu=78.3=h33c6efd_0
  - identify=2.6.19=pyhd8ed1ab_0
  - importlib-metadata=9.0.0=pyhcf101f3_0
  - importlib-resources=7.1.0=pyhd8ed1ab_0
  - importlib_resources=7.1.0=pyhd8ed1ab_0
  - iniconfig=2.3.0=pyhd8ed1ab_0
  - joblib=1.5.3=pyhd8ed1ab_0
  - jsonschema=4.26.0=pyhcf101f3_0
  - jsonschema-specifications=2025.9.1=pyhcf101f3_0
  - kernel-headers_linux-64=4.18.0=he073ed8_9
  - keyutils=1.6.3=hb9d3cd8_0
  - krb5=1.22.2=hbde042b_1
  - ld_impl_linux-64=2.45.1=default_hbd61a6d_102
  - libabseil=20260107.1=cxx17_h7b12aa8_0
  - libblas=3.11.0=8_h4a7cf45_openblas
  - libbrotlicommon=1.2.0=hb03c661_1
  - libbrotlidec=1.2.0=hb03c661_1
  - libbrotlienc=1.2.0=hb03c661_1
  - libcap=2.78=hd0affe5_0
  - libcblas=3.11.0=8_h0358290_openblas
  - libclang=20.1.8=default_h99862b1_16
  - libclang-cpp20.1=20.1.8=default_h99862b1_16
  - libclang13=20.1.8=default_h746c552_16
  - libcublas=13.5.1.27=h676940d_0
  - libcublas-dev=13.5.1.27=h676940d_0
  - libcufft=12.3.0.29=hecca717_0
  - libcufile=1.18.0.66=h85c024f_0
  - libcurand=10.4.3.29=h676940d_0
  - libcurand-dev=10.4.3.29=h676940d_0
  - libcurl=8.20.0=hcf29cc6_0
  - libcusolver=12.2.2.18=h676940d_0
  - libcusolver-dev=12.2.2.18=h676940d_0
  - libcusparse=12.8.1.7=hecca717_0
  - libcusparse-dev=12.8.1.7=hecca717_0
  - libedit=3.1.20250104=pl5321h7949ede_0
  - libev=4.33=hd590300_2
  - libexpat=2.8.1=hecca717_1
  - libffi=3.5.2=h3435931_0
  - libgcc=15.2.0=he0feb66_19
  - libgcc-devel_linux-64=14.3.0=hf649bbc_119
  - libgcc-ng=15.2.0=h69a702a_19
  - libgfortran=15.2.0=h69a702a_19
  - libgfortran5=15.2.0=h68bc16d_19
  - libgomp=15.2.0=he0feb66_19
  - libiconv=1.18=h3b78370_2
  - liblapack=3.11.0=8_h47877c9_openblas
  - libllvm20=20.1.8=hf7376ad_1
  - liblzma=5.8.3=hb03c661_0
  - libmpdec=4.0.0=hb03c661_1
  - libnghttp2=1.68.1=h877daf1_0
  - libnl=3.11.0=hb9d3cd8_0
  - libnvfatbin=13.3.29=hecca717_0
  - libnvjitlink=13.3.33=hecca717_0
  - libnvjitlink-dev=13.3.33=hecca717_0
  - libnvptxcompiler-dev=13.3.33=ha770c72_0
  - libnvptxcompiler-dev_linux-64=13.3.33=ha770c72_0
  - libopenblas=0.3.33=pthreads_h94d23a6_0
  - libraft=26.08.00a32=cuda13_260622_1dde2731
  - libraft-headers=26.08.00a32=cuda13_260622_1dde2731
  - libraft-headers-only=26.08.00a32=cuda13_260622_1dde2731
  - librmm=26.08.00a39=cuda13_260622_a4ab3990
  - libsanitizer=14.3.0=h8f1669f_19
  - libsqlite=3.53.2=h0c1763c_0
  - libssh2=1.11.1=hcf80075_0
  - libstdcxx=15.2.0=h934c35e_19
  - libstdcxx-devel_linux-64=14.3.0=h9f08a49_119
  - libstdcxx-ng=15.2.0=hdf11a46_19
  - libsystemd0=260.2=h6f4a2f1_1
  - libucxx=0.51.00a31=cuda13_260622_ef40c362
  - libudev1=260.2=h6f4a2f1_1
  - libuuid=2.42.2=h5347b49_0
  - libuv=1.52.1=h280c20c_0
  - libxml2=2.15.3=h49c6c72_0
  - libxml2-16=2.15.3=hca6bf5a_0
  - libzlib=1.3.2=h25fd6f3_2
  - llvm-openmp=22.1.8=h4922eb0_0
  - make=4.4.1=hb9d3cd8_2
  - narwhals=2.22.1=pyhcf101f3_0
  - nccl=2.30.7.1=h1aa9b5a_0
  - ncurses=6.6=hdb14827_0
  - ninja=1.13.2=h171cf75_0
  - nodeenv=1.10.0=pyhd8ed1ab_0
  - nodejs=26.3.1=he4ff34a_0
  - numpy=2.5.0=py314h2b28147_0
  - nvidia-ml-py=13.610.43=pyhd8ed1ab_0
  - openblas=0.3.33=pthreads_h6ec200e_0
  - openssl=3.6.3=h35e630c_0
  - packaging=26.2=pyhc364b38_0
  - pathspec=1.1.1=pyhd8ed1ab_0
  - pip=26.1.2=pyh145f28c_0
  - platformdirs=4.10.0=pyhcf101f3_0
  - pluggy=1.6.0=pyhf9edf01_1
  - pre-commit=4.6.0=pyha770c72_0
  - pycparser=3.0=pyhcf101f3_0
  - pygments=2.20.0=pyhd8ed1ab_0
  - pylibraft=26.08.00a32=cuda13_cp311_abi3_260622_1dde2731
  - pytest=9.1.1=pyhc364b38_2
  - pytest-cov=7.1.0=pyhcf101f3_0
  - python=3.14.6=habeac84_100_cp314
  - python-discovery=1.4.2=pyhcf101f3_0
  - python-gil=3.14.6=h4df99d1_100
  - python_abi=3.14=8_cp314
  - pyyaml=6.0.3=py314h67df5f8_1
  - rapids-build-backend=0.4.2=py_0
  - rapids-dependency-file-generator=1.21.0=py_0
  - rapids-logger=0.2.3=h98325ef_0
  - rdma-core=63.0=h192683f_1
  - readline=8.3=h853b02a_0
  - referencing=0.37.0=pyhcf101f3_0
  - rhash=1.4.6=hb9d3cd8_1
  - rmm=26.08.00a39=cuda13_cp311_abi3_260622_a4ab3990
  - rpds-py=2026.5.1=py314h1bee95f_0
  - rust=1.96.0=h53717f1_0
  - rust-std-x86_64-unknown-linux-gnu=1.96.0=h2c6d0dc_0
  - scikit-build-core=0.12.2=pyh04d0eab_0
  - scikit-learn=1.9.0=np2py314hf09ca88_0
  - scipy=1.16.3=py314hf07bd8e_2
  - setuptools=82.0.1=pyh332efcf_0
  - sysroot_linux-64=2.28=h4ee821c_9
  - threadpoolctl=3.6.0=pyhecae5ae_0
  - tk=8.6.13=noxft_h366c992_103
  - tomli=2.4.1=pyhcf101f3_0
  - tomlkit=0.15.0=pyha770c72_0
  - typing_extensions=4.15.0=pyhcf101f3_0
  - tzdata=2025c=hc9c84f9_1
  - ucx=1.20.1=hf72d326_0
  - ucxx=0.51.00a31=cuda13_cp311_abi3_260622_ef40c362
  - ukkonen=1.1.0=py314h9891dd4_0
  - virtualenv=21.5.1=pyhcf101f3_0
  - yaml=0.2.5=h280c20c_3
  - zipp=4.1.0=pyhcf101f3_0
  - zstd=1.5.7=hb78ec9c_6
prefix: /home/jlamb/miniforge3/envs/cuvs-dev

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions