oracle/graal · error · ValueError

GraalHost toolchain library directory '{toolchain_lib_path}'

Error message

GraalHost toolchain library directory '{toolchain_lib_path}' is not a directory!

What it means

Raised in _resolve_graalhost_toolchain_lib_dir: the benchmark suite argument graalhost_toolchain_lib_dir, when provided, must point to an existing directory containing the GraalHost toolchain shared libraries that get fs-mapped into the guest at /lib. A non-directory value (or typo) fails fast with ValueError before any staging command runs.

Source

Thrown at sdk/mx.sdk/mx_sdk_benchmark.py:2302

            merged = dict(base)
            for key, value in extra.items():
                if key == "fsmappings" and isinstance(merged.get(key), list) and isinstance(value, list):
                    merged[key] = [*merged[key], *value]
                elif key in merged:
                    merged[key] = GraalHostPolyBenchStagingVm._merge_graalhost_config_values(merged[key], value)
                else:
                    merged[key] = value
            return merged
        return extra

    @staticmethod
    def _resolve_graalhost_toolchain_lib_dir(vm: "GraalHostPolyBenchStagingVm", args: list[str]) -> Path | None:
        toolchain_lib_dir = vm.bmSuite.polybench_bench_suite_args(args).graalhost_toolchain_lib_dir
        if toolchain_lib_dir is None:
            return None
        toolchain_lib_path = Path(toolchain_lib_dir).resolve()
        if not toolchain_lib_path.is_dir():
            raise ValueError(f"GraalHost toolchain library directory '{toolchain_lib_path}' is not a directory!")
        return toolchain_lib_path

    @staticmethod
    def _graalhost_toolchain_fs_mapping(toolchain_lib_dir: Path, library_name: str) -> dict[str, object]:
        return json.loads(
            GraalHostPolyBenchStagingVm.GRAALHOST_TOOLCHAIN_FSMAPPING_TEMPLATE.substitute(
                concrete=str((toolchain_lib_dir / library_name).resolve()),
                virt=f"/lib/{library_name}",
            )
        )

    def _create_staged_benchmark_fs_mapping_file(self) -> Path:
        """
        Create a graalhost configuration file that contains a single fs-mapping entry,
        exposing the staged benchmark directory to the isolate.
        """
        # The staged PolyBench artifact is produced on the host side, so GraalHost needs an explicit
        # fs-mapping for this output dir or the benchmark file is not visible inside the isolate.

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Point graalhost_toolchain_lib_dir at the real toolchain lib directory and verify it contains the expected .so files.
  2. Rebuild the GraalHost toolchain sysroot if it was removed.
  3. Omit the argument entirely when no toolchain libraries are needed (None is accepted).

Example fix

# before
--polybench-benchsuite-args graalhost_toolchain_lib_dir=/tmp/does-not-exist

# after
--polybench-benchsuite-args graalhost_toolchain_lib_dir=$HOME/graalos/toolchain/lib
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
d = Path(suite_args.graalhost_toolchain_lib_dir).resolve() if suite_args.graalhost_toolchain_lib_dir else None
if d is not None:
    assert d.is_dir(), f'graalhost_toolchain_lib_dir={d} is not a directory'

Try / catch

try/except ValueError; on failure either fix the path or drop the argument (None is valid) and rerun.

Prevention

When it happens

Trigger: Passing --polybench-benchsuite-args graalhost_toolchain_lib_dir=<path> where <path> is missing, a file, or a symlink to a removed dir; the resolved Path fails is_dir().

Common situations: Suite args referencing a toolchain sysroot that was cleaned or never built; CI caching a stale path; typos in long argument strings.

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/51c77ed7e9568613. Report an issue: GitHub.