Skip to content

Lib load fails under SBT, succeeds with plain java #1203

@jxtps

Description

@jxtps

If I create a small sample project with the following class:

package misc;

import org.bytedeco.pytorch.Device;
import org.bytedeco.pytorch.global.torch;

public class MyTest {

    public static void debug(String prop) {
        System.out.println(prop + "=" + System.getProperty(prop));
        System.setProperty(prop, "true");
    }

    public static void main(String[] args) {
        debug("org.bytedeco.javacpp.pathsFirst");
        debug("org.bytedeco.javacpp.logger.debug");
        Device cpu = new Device(torch.DeviceType.CPU);
    }
}

Then I can run that main function "standalone" in IntelliJ without problems, and the loading of a large number of libraries flashes by quickly.

However, if I instead run the play project (by creating a Play 2 run profile in IntelliJ), then when the controller calls MyTest.main() then some of the libraries flash by, but then the library loading hangs on:

Debug: Loading C:\Users\jxtps\.javacpp\cache\bin\libopenblas_nolapack.dll

If I then stop the server, the loading suddenly continues with the same javacpp debug printouts as when I ran MyTest.main() separately, but shortly thereafter the whole process exits.

This is really strange and I have no idea why it's happening. Right now I'm basically stuck with JavaCPP working great in isolation, but as soon as I try to use it within my sbt/play project it just freezes everything.

This is using Oracle Corporation Java 1.8.0_241 on windows, sbt 1.7.1, play 2.8.16, scala 2.13.8 and "org.bytedeco" % "pytorch-platform" % s"1.10.2-1.5.7". I have the relevant libtorch dlls all on the path (hence the org.bytedeco.javacpp.pathsFirst=true).

???

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions