Closed kodingkoning closed 10 months ago
Looking at other information about sbt, it seems that it's an issue of trying to build without being root. Is there a way to manually set where to build?
I also tried building incrementally, and when I run netlogo/compile
in sbt, that works fine.
Hey Elizabeth, sorry you ran into this issue. It's definitely odd, if you're able to update the submodule extensions using git
, you should be able to build them. Root permissions should not be required to run sbt
. One way to check is to just open a terminal in the NetLogo repository, cd extensions/array
, and then run sbt package
to see if you can run the extension packaging standalone. If that fails then probably there is some odd file permissions issue. If it works, then the problem would have to be with how NetLogo's sbt session is creating the sub-processes to build the extensions.
Is there a way to manually set where to build?
By default sbt builds to a target/
folder for each sub-project in the repo, so, for example, array will build to extensions/array/target/
There may be a way to change that, but I've never had to before.
One thing to note, depending on why you're trying to build NetLogo you may not need the extensions. If you're just making changes to the UI or adding a new primitive or something you can just use netlogo/run
to test your work, or something like netlogo/Test/language
to run language tests. Building the extensions, as happens with running dist/buildNetLogo
is necessary when packaging a NetLogo release and sometimes when you're testing out an extension from within the NetLogo repository.
When I run sbt package
it works fine. If I then go back to the top directory, I still get the same error. I could probably do without the array extension, but I would prefer having it.
When I try ./sbt netlogo/run
, then I get an error about opening the X11 window server. I'm trying to run this headless. How can I do that without running ./sbt all
?
For running headlessly from sbt, just use netlogo/runMain org.nlogo.headless.Main
and then add command line switches as per the BehaviorSpace documentation.
Example: netlogo/runMain org.nlogo.headless.Main --model "../models/IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo" --experiment "Wolf Sheep Simple model analysis"
If you can be more specific about what changes you are making and testing to the NetLogo code, I can better advise on avoiding running the all
command - again it's usually used when running the full test suite or when bundling NetLogo for distribution, so most of it isn't necessary for development.
I tried with the textbook model: ./sbt netlogo/runMain org.nlogo.headless.Main --model models/IABM\ Textbook/chapter\ 4/Wolf\ Sheep\ Simple\ 5.nlogo --experiment "Wolf Sheep Simple model analysis"
But I get the error:
[error] Expected whitespace character
[error] netlogo/runMain
[error] ^
Am I correct in running this from sbt, or is there a different executable I'm meant to use?
Right, so the command I wrote assumed you'd started an interactive session with just ./sbt
. If you want to start sbt and run a command: ./sbt "netlogo/runMain org.nlogo.headless.Main --model \"../models/IABM Textbook/chapter 4/Wolf Sheep Simple 5.nlogo\" --experiment \"Wolf Sheep Simple model analysis\""
And just to ask the question, are you intending to do NetLogo development, as in changes to Java or Scala files to alter how NetLogo runs? If you just want to run a NetLogo model headlessly you just need to install one of the packages and follow the BehaviorSpace directions I'd linked before, no need to use git/sbt/etc.
Great, that's working for me now!
I am planning to make modifications to NetLogo, mostly in optimizations for performance. I haven't implemented any changes yet -- I'm still trying to get a baseline.
@kodingkoning Awesome, that sounds great. If you need any other info on working around the failing extension builds or on your optimization work, just let me know.
I am trying to build NetLogo, but I am getting a "Permission Denied" error at the "extensions/array" directory. What might be causing this? I tried a clean checkout and got the same error the second time. I also confirmed that I had updated the submodules, as the instructions said.