Skip to content

Selecting a JVM does not set its LD_LIBRARY_PATH #3877

@Flowdalic

Description

@Flowdalic

Version(s)

1.9.1

Describe the bug

Selecting a JVM does not set its LD_LIBRARY_PATH. Therefore, shared libraries provided by the JVM can not be loaded.

To Reproduce

Assume I want to use Graal VMs tracing agent:

$ scala-cli run \
        --jvm graalvm:21 \
        --java-opt -agentlib:native-image-agent=config-output-dir=`pwd`/trace \
        my.sc -- --help
Error occurred during initialization of VM
Could not find agent library native-image-agent on the library path, with error: libnative-image-agent.so: cannot open shared object file: No such file or directory

Instead, I have to manually set LD_LIBRARY_PATH

$ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/flo/.cache/coursier/arc/https/github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-linux-amd64-22.3.1.tar.gz/graalvm-ce-java17-22.3.1/lib" scala-cli run \
        --jvm graalvm:21 \
        --java-opt -agentlib:native-image-agent=config-output-dir=`pwd`/trace \
        my.sc -- --help

Expected behaviour

Selecting a JVM does not just entail running the according JVM binary. It also means adjusting the system library path (and PATH, if applicable). Therefore, scala-cli should do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GraalVMIssues tied with GraalVM native imagesbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions