Uploaded image for project: 'Daffodil'
  1. Daffodil
  2. DAFFODIL-2544

Running sbt in windows causes "Unrecognized option: -mem" failure

    XMLWordPrintableJSON

Details

    Description

      If you try to start sbt in a windows command shell, you get the error

      Unregcognized option: -mem

      And if fails to start.

      After some trial and error, it looks like sbt on windows does not actually parse the contents of the .sbtopts file, but instead just sends the contents directly to java. Our .sbtopts file uses the "-mem" option to increase memory given to Java needed for compiling/running tests. In linux, this works and sbt to parses the -mem option, converts it to the correct Java memory options (e.g. -Xms, -Xmx), and then passes those to java. But windows does not do that, so we get a failure.

      Note that things work fine in our Windows CI tests because our CI uses msys2, which is essentially a modified version of cygwin, so doesn't use the sbt .bat that has this problem, but instead uses the same sbt script that Linux uses.

      To get around this, we should modify our .sbtopts file so that it it provides the memory options that Java expects, so we do not rely on sbt to convert -mem to those options.

      For reference, Daffodil sets -mem to 4096, which is equivalent to this in the .sbtopts file

      -J-Xms4096m
      -J-Xmx4096m
      -J-Xss4M
      -J-XX:ReservedCodeCacheSize=512m
      

      So we should just replace -mem with those options in our .sbtopts file

      Attachments

        Activity

          People

            mphyo21 Min Phyo Aung
            slawrence Steve Lawrence
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: