1

I am new to Linux and I've been trying to install the plasma widgets window Appmenu and window buttons. They show up in the widget list but without a icon and cannot be used.

When I run sh install.sh in the directory where I extracted the files, I got the following:

install.sh: 1: [: -a: unexpected operator
mkdir: cannot create directory ‘build’: File exists
install.sh: 5: install.sh: cmake: not found
make: No targets specified and no makefile found.  Stop.

Then it asks for the password and I get:

make: *** No rule to make target 'install'. Stop.

Can I get a straightforward guide on how to install correctly?

Eliah Kagan
  • 117,780
eftimo
  • 21
  • What is the source for "the plasma widgets window Appmenu & window buttons"? Please post the link. – DK Bose Aug 23 '19 at 01:32
  • https://github.com/psifidotos/applet-window-buttons , https://github.com/psifidotos/applet-window-appmenu – eftimo Aug 23 '19 at 04:25
  • What is your version of Kubuntu? And what does plasmashell --version show? – DK Bose Aug 23 '19 at 05:13
  • kubuntu 18.04, 5.12.8 – eftimo Aug 23 '19 at 05:44
  • There's mention of certain "development packages" that are needed. Do you have those? I don't use widgets which aren't already there by default and so can't help. Maybe you could ask at https://www.reddit.com/r/kde/ where I know the developer is available. – DK Bose Aug 23 '19 at 05:53

2 Answers2

1

The cmake command is needed to build that code, and you don't have it. This, rather than the [: -a: unexpected operator message, appears to be what is actually keeping your build from continuing. So first install cmake. Some software needs a very new version of cmake to build (which you can install if you need to) but most does not. I recommend you install the cmake package.

While you're at it, it's a good idea to make sure you have the usual toolchain for building programs on your Ubuntu system, too, which the build-essential package will get you.

These commands will install both cmake and those other tools:

sudo apt update
sudo apt install build-essential cmake

This will likely be sufficient to enable you to successfully build the software, or at least to get past the current error you're facing. However, I recommend you delete the build directory and its contents before proceeding:

rm -r build

After further troubleshooting steps that involve installing or removing software or editing files from the source code (or, if you like, even every time you build the source code), I recommend removing the build directory and starting fresh.

The messages you're getting about -a are probably not stopping the build from succeeding. You can probably ignore them. They also would likely go away if you used bash instead of sh, though I don't think that's the best solution. If you want to get rid of them or you suspect they are causing a problem then you can either edit the install.sh script to use the appropriate test (or no test) or you can manually perform the actions that script performs. So if you want to do something about this, see below for the details.


In the source code for both applet-window-buttons and applet-window-appmenu, install.sh currently has this as its complete contents:

if ! [ -a build ] ; then
    mkdir build
fi
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr .. -Wnodev
make
sudo make install

This is the file you are attempting to run with sh that is producing errors. Its use of the -a test is very strange. -a typically appears between two other expressions, and causes [ to return true when both expressions are true.

In Ubuntu, sh is provided by dash. If you use bash instead of dash, it may work (or appear to work). Perhaps that's what the authors did. However, instead of doing that, I recommend you either fix the script or just manually do what it does.

If you want to fix the script, one way would be to replace -a with -e or -d. The -e test takes a filename operand and checks if it exists; -d checks if it exists and is a directory. Another way to fix the script would just be to remove the if and fi lines entirely; mkdir would fail if the directory exists, but that's no problem.

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr .. -Wnodev
make
sudo make install

But all this script does is create a build directory if there isn't one, change into it with cd, run cmake with some arguments, run make, and then run sudo make install. You can just do these things yourself. One way to do so is to run those commands in your interactive shell, one after another.

This has advantages. As written, the script doesn't stop just because some step reports failure, but you probably would want to stop. You could make further modifications to the script to achieve that (perhaps ending each line except the first and last with &&) but it's probably easier to just run the commands yourself if you're not planning on compiling the code numerous times.

Eliah Kagan
  • 117,780
1

I was also facing some issues. Managed to build it on Kubuntu 21.04. Following should be kept in mind

  • Delete the build/ folder in subsequent build attempts
  • Install the dependencies. This can be referred.
  • Do make sure gcc, cmake etc. are not conflicting
  • After the install, the widget appears in the "add widget" option on panel
Somnath
  • 11