user1223183
user1223183

Reputation: 85

Flatpak Intellij Idea - problem with subversion executable

After installing Intellij Idea using flatpak on Clear Linux I'm not able to make it run svn executable. I added ---filesystem=host to flatpak permissions and tried to set executable path to /run/host/usr/bin/svn but with no luck (path is available/exists, though Intellij keeps complain)

svn command is normally available from system terminal. When I try to run /run/host/usr/bin/svn command via Intellij Idea built-in terminal, I've got error that library is not available:

sh-5.0$ /run/host/usr/bin/svn /run/host/usr/bin/svn: error while loading shared libraries: libsvn_client-1.so.0: cannot open shared object file: No such file or directory

I also tried set flatpak-spawn. Following command works perfectly fine in Intellij Idea built-in terminal:

/usr/bin/flatpak-spawn --host /usr/bin/svn, though when set as path to svn executable still gives me Intellij Idea error: "The path to Subversion executable is probably wrong"

Could anybody please help with making it work?

Upvotes: 1

Views: 2710

Answers (3)

ejm
ejm

Reputation: 835

I am using a similar solution to caluga.

#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host /usr/bin/env -- svn "$@"
  • exec makes it replace the wrapper script process so the wrapper script process can end.
  • I'm using /bin/sh instead of /bin/bash as bash features are not needed.
  • using /usr/bin/env, but maybe not necessary if PATH is set up right.
  • remember to quote "$@" in case there are spaces in arguments.

I am putting it in ~/.local/bin and referencing it with its absolute path in the IntelliJ settings (Settings -> Version Control -> Subversion -> Path to Subversion executable).

I also was running into problems with IntelliJ saying that /app/idea-IC path does not exist. Figured that something outside the flatpak (i.e. svn or env) was trying to change directory to the working directory from where the wrapper script was invoked (inside the flatpak). Using cd allows the wrapper script to change to a directory that exists both inside the flatpak and on the host.

Fedora Silverblue or toolbox users might want to use dev tools inside their toolbox, in which case you can do:

#!/bin/sh
cd
exec /usr/bin/env -- flatpak-spawn --host toolbox run svn "$@"

Upvotes: 1

caluga
caluga

Reputation: 121

I found a really ugly solution for dealing with SVN with the JetBrains family, which does actually answer the question. But in a very roundabout way. Unfortunately Alex Nelson's solution didn't work for me.

You would think the Flatpak would come with a valid SVN, since it's actually part of the expected requirements for the program...

When in the terminal, you can run

cd ..
/usr/bin/flatpak-spawn --host vim ./svn

Then press i to go into input mode, then paste the following in the opened text file (Basically what it does is create an executable which passes it to the flatpak-spawn invocation):

#!/bin/bash

/usr/bin/flatpak-spawn --host /usr/bin/svn $@

Save and quit from vim (ESC, then :wq!). Make it executable:

chmod +x svn

Then in IntelliJ's menu, set the "path to svn" to

/home/<yourusername>/IdeaProjects/svn

It's worked for everything I've tried... Hope this helps out anyone else who was struggling with this.

Upvotes: 3

Alex Nelson
Alex Nelson

Reputation: 1242

TLDR: You probably need to add the path to svn into your IntelliJ terminal Path.

Details: It looks like you are having a path issue. I had a similar problem running kubectl running PyCharm installed from a flatpak on Pop_Os.

If I try to run kubectl I see the following:

enter image description here

I have kubectl installed in /usr/local/bin. This is a screenshot from my 'normal' terminal.

enter image description here

In the PyCharm terminal this location is mounting under /run/host/usr/local/bin/.

enter image description here

If I look at my path in the PyCharm terminal, it is not there.

enter image description here

So I'll add the /run/host/usr/local/bin/ to my path and I can then run kubectl:

enter image description here

To make sure this comes up all the time, I need to add the PATH to the Terminal settings:

enter image description here

I can now execute any of the commands in my /usr/local/bin dir.

Upvotes: 2

Related Questions