← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #700657]: [2.0.4]sikulixapi with java 11 on maxOS M1: problems using OCR features (Tesseract lib missing)

 

Question #700657 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/700657

    Status: Open => Answered

RaiMan proposed the following answer:
You have to understand the Homebrew concept for macOS M1 machines (see
Home-brew docs).

In 2.0.6 (only snapshots available at the moment) I try to reflect all
specific aspects of macOS M1 with respect to SikuliX

The snippets from 2.0.6 are only to give you some insights about what you would have to do in your wrapper.
Setting the Jan-path correctly is the key feature.
 
     if (Commons.runningMac()) {
        String libPath = "/usr/local/lib";
        if (Commons.runningMacM1()) {
          libPath = "/opt/homebrew/lib";
        }
        File libTess = new File(libPath, "libtesseract.dylib");
        if (libTess.exists()) {
          Commons.jnaPathAdd(libPath); //----------------------------- add the path
        } else {
          throw new SikuliXception(String.format("OCR: validate: libtesseract.dylib not in %s", libPath));
        }
      }


// the respective method from Commons:

  public static String jnaPathAdd(String sFolder) {
    String jnaPath = System.getProperty("jna.library.path");
    if (null == jnaPath) {
      jnaPath = "";
    }
    File folder = new File(sFolder);
    if (!folder.exists()) {
      return null;
    }
    if (!jnaPath.isEmpty()) {
      jnaPath = File.pathSeparator + jnaPath;
    }
    jnaPath = folder.getAbsolutePath() + jnaPath;
    System.setProperty("jna.library.path", jnaPath);
    return jnaPath;
  }

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.