-
Notifications
You must be signed in to change notification settings - Fork 6
Get debug working on linux #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linux-debugging
Are you sure you want to change the base?
Conversation
|
It looks like the only actual changes here are the working directory and referring to Doorstop from Doorstop/Doorstop.dll, right? As for the glibc dependency, that would be in the libdoorstop.so library, right? That file actually comes from Doorstop 4.4 |
|
I swapped out the Doortop lib and stuff in my local but didn't include that in the PR. It now makes sense why I am getting a glibc error. Ubuntu 22.04 (the version I am using) ships with GLIBC_2.35. Doorstop 4.4 is compiled against GLIBC_2.38. Doorstop 4.3 is compiled against GLIBC_2.35. Glibc is backward compatible. Using version 4.3 will get you the largest range of compatibility since it will work on any distro using GLIBC_2.35 or greater. I assumed you where using 4.0.0 because that is what was specified in the .doorstop_version file. "As for the glibc dependency, that would be in the libdoorstop.so library, right?" It is possible to get the Linux stuff working without the run.sh file by setting the environmental variables on the GeneralCommandLine object, but progress is being made so that could be a future improvement. |
|
I had things working at one point but now I am getting the following error. My guess is that I have some kind of version mismatch. Where is the Pdb2Mdb converter from? |
|
Swapping out the OHarmony.dll for the one my mod is building with fixed the above error. I don't know where your file came from. It is much larger that the one in my PR. |
| // If we're debugging in Rimworld, instead of /pwd/RimWorldLinux ...args we want to run /bin/sh /pwd/run.sh /pwd/RimWorldLinux ...args | ||
| if (debugInLinux) { | ||
| val bashScriptPath = "${Path(pathToRun).parent}/run.sh" | ||
| arguments = "$bashScriptPath $pathToRun $arguments" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was messing up the commandline.
When running on linux the command should be /bin/sh and the run script command should be the first argument. Any user provided arguments should come at the end. The println I added makes the issue pretty obvious once you look at the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't have been messing it up. The arguments I had should have ended up as /bin/sh as the command and then ["dir/run.sh", "dir/RimWorldLinux", ...userArgs] as the end result. If you take a look at run.sh:75 it should be taking the first argument in as the executable name, so not passing in the executable would mean that if a user defines arguments in the command line options, it would eat the first argument as the executable name.
Perhaps it was the fact that the executable name shouldn't include it's directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make it work the way you had it you would want
arguments = "$bashScriptPath $arguments"
You already build the run.sh path on this line
val bashScriptPath = "${Path(pathToRun).parent}/run.sh"
The reason I refactored the code some is to do the .split(' ') sooner. I have created a lot of programs that call commandline stuff from Java that needed to run on Windows, Linux and AIX. Splitting on space is fine until some asshole gives you a file path or file name with a space in it.
"Perhaps it was the fact that the executable name shouldn't include it's directory?"
Since we are setting the work directory you could just call run.sh and it would work. It is totally a matter of preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some trouble getting run.sh executable. Setting it as +x in the resources wasn't preserving the permissions when copying it over and setting the permissions manually in Kotlin wasn't working for me, which is why I'm calling run.sh as an argument to /bin/sh instead.
But yeah, I think moving the .split earlier makes sense, I was going to just look into having getCommandLineOptions return a list directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing a bash script into /bin/sh is a MUCH more portable solution than trying to execute the bash script directly. This was the right call.
"But yeah, I think moving the .split earlier makes sense, I was going to just look into having getCommandLineOptions return a list directly"
I totally support this.
It's probably from an outdated version of Harmony that I've been using in my mods, but it's more of a fallback than a definitive version, especially since different versions of Rimworld need different versions of Harmony. My plugin is actually meant to be scanning the Rimworld Steam Workshops folder for the version of Harmony you currently have installed, and if it finds you have one installed it uses the version of Harmony that is shipped for that version of Rimworld. |
buildPlugin.sh
Outdated
| export Version="2024.1-EAP" | ||
|
|
||
| cd "src/dotnet/ReSharperPlugin.RimworldDev" | ||
| FrameworkPathOverride=$(dirname $(which dotnet))/../../../../lib/dotnet/sdk/7.0.202/ dotnet build ReSharperPlugin.RimworldDev.csproj /property:Configuration=Release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? I would have thought that the globals.json in the root dir of this project should have negated the need to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does just calling :buildPlugin from gradle without excluding compileDotNet not work? That's how I do it in my CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm apparently ./gradlew :buildPlugin does work. It didn't when I first setup the script, but that was before you created this branch.
I just got something working and never revised it. I'll push an update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file could be removed all together. It is really just documentation at this point.
I am the type of dev that runs git commands in the Intellij terminal rather than use the UI.
|
I'll test this locally sometime tomorrow and look at merging/releasing in the next week, thanks for the contribution :) |
Since OHarmony.dll is a dotnet dll you should be able to use the same file on all platforms. The better solution may be to create a new resource folder for them and name them based on the version of Rimworld. Then add something that reads the Version.txt file and selects the correct OHarmony.dll version and copies it. |
Hi, not to rush you or anything but is there some reason this hasn't been merged in yet? I'm just asking as it's been almost a month since your last message. |
I got debugging working on linux with these changes. Excuse my Kotlin, I have now written like 50 lines of it.
I STRONGLY recommend switching to Doorstop 4.3.0 for Linux. The 4.0.0 version has a hard dependency on a specific version of glibc. The hard glibc requirement will mean that a huge number of Linux users won't be able to use the plugin.