RPM build errors: File not found: /home/deploy/installroot/usr/bin

Hi,

I’m trying to package Screen Usage Monitor for aarch64. Compiling the application (if I click on the “Hammer”-Icon in the Sailfish IDE), works without errors but when I try to package the application (by clicking on the green “Play”-Icon in the Sailfish IDE), I get the following error (some parts translated from German, I appologise for possible translation errors):

Processing files: jolla-settings-screenmonitor-1.0.4-1.aarch64
error: File not found: /home/deploy/installroot/usr/bin


RPM build errors:
    File not found: /home/deploy/installroot/usr/bin
15:58:02: The proccess "/home/nsc/SailfishOS/bin/sfdk" exitted with return code 1.
Error when creating/deploying the project jolla-settings-screenmonitor (Kit: SailfishOS-4.5.0.18-aarch64 (in Sailfish SDK Build Engine))
When executing the "RPM Build" step

Has anyone an idea what could be the problem here?

Spec file is the problem and using two names for package that leads to unexpected behaviour.
%{_bindir} should be %{_bindir}/%{name}
but in this case replace
%{_bindir}
with
%{_bindir}/ScreenMonitor

2 Likes

Hmm, I have done what you suggested, but this just changes the error message to the new directory not being found. (I am quite new to RPM-packaging, so I am sorry if I don’t understand obvious things :sweat_smile: )

Processing files: jolla-settings-screenmonitor-1.0.4-1.aarch64
error: File not found: /home/deploy/installroot/usr/bin/ScreenMonitor

RPM build errors:
    File not found: /home/deploy/installroot/usr/bin/ScreenMonitor
19:56:26: The process "/home/nsc/SailfishOS/bin/sfdk" exitted with return code 1.
Error when creating/deploying the project jolla-settings-screenmonitor (Kit: SailfishOS-4.5.0.18-aarch64 (in Sailfish SDK Build Engine))
When executing the "RPM Build" step

(I’ve uploaded the code here if you want to check)

EDIT: I forgot to mention earlier: when I try the application in the Emulator (so on i486) it works without errors

For me with this fix it builds without an error.
jolla-settings-screenmonitor

Hmm, that’s really strange. You haven’t modified anything else than the .spec-file, right?
And you are building on an aarch64-Device?

No, plain git clone with the one change. I build it on PC linux workstation using Sailfish SDK.

That’s really strange since I also haven’t done anything else if I recall correctly

The problem is not with the RPM spec file but with the .pro file. It’s written in such a way that qmake will not generate install rules for screenmonitor-executable unless ScreenMonitor already exists. Which means that if you run sfdk build twice it will succeed.

Easy fix would be adding screenmonitor-executable.CONFIG += no_check_exist to the .pro file.

6 Likes

Thanks! That actually fixed the problem. But now I’m getting these errors:

Installing jolla-settings-screenmonitor-1.0.5-1.aarch64.rpm
Please confirm installation on device.
jolla-settings-screenmonitor: Subprocess failed. Error: RPM failed: /var/tmp/rpm-tmp.oHXpV5: line 2: /bin/systemctl: not found
warning: %post(jolla-settings-screenmonitor-1.0.5-1.aarch64) scriptlet failed, exit status 127
/var/tmp/rpm-tmp.zZCjh5: line 2: /bin/systemctl: not found
error: %preun(jolla-settings-screenmonitor-1.0.4-1.aarch64) scriptlet failed, exit status 127
error: jolla-settings-screenmonitor-1.0.4-1.aarch64: erase failed
/var/tmp/rpm-tmp.reubr4: line 2: /bin/systemctl: not found
error: %preun(jolla-settings-screenmonitor-1.0.4-1.aarch64) scriptlet failed, exit status 127
error: jolla-settings-screenmonitor-1.0.4-1.aarch64: erase failed
 (code: 58)
Installation failed
Deploy failed

I guess installing the RPM from @kan_ibal before messed up something

systemctl is now in /usr/bin.

But the spec really should use the systemd rpm macros instead:

1 Like

Hmm, I might look into that, if I find the time. For now, I have modified it to use /usr/bin/systemctl which now complains that Unit file ScreenMonitor.service does not exist., which leads me to believe that it might not get bundled/installed with the RPM correctly?

Wrong/old-style path used again. This is now also /usr/lib/systemd/system. Again, use a macro in the .spec file For example %_unitdir/*.service. (Side note: an RPM file should also not own that directory, so /lib/systemd/system is doubly wrong.)

And check the .pro file so that it installs to the correct place.


%files
...
- /lib/systemd/system
+ %{_unitdir}/system/*.service
screenmonitor-systemd.path = $$PREFIX/lib/systemd/system

Another side note: some might argue that one should use /etc/systemd instead of $PREFIX/lib/systemd with 3rd party packages, because $PREFIX/lib is supposed to be managed by the OS distribution, while /etc is for the local system administrator.
I can see why, but do not completely agree this applies to 3rd party packages.