How to add openssl in SailfishSDK

I am writing a Sailfish application with QML/QT and C++, and want to use the ssl library.

#include <openssl/ssl.h>

But this does not work out. I tried using chatgpt but getting an error. Are there other methods to get this done?

sfdk engine exec bash
sb2 -t SailfishOS-latest-aarch64 bash
zypper in openssl openssl-devel

I’m getting Root privileges are required to run this command.

In the end you will want to declare it as a dependency (“Requires”) in your rpm spec.
The easiest is probably to just do it like that from the beginning.

My environment seems to have rotted - but i also seem to recall it has passwordless sudo somewhere.

That would be sfdk build-shell --maintain

3 Likes
sb2 -t SailfishOS-latest-aarch64 -R zypper in openssl openssl-devel
1 Like

The maintain option now gives errors to me. I was able to again include openssl via

sfdk engine exec bash

sb2 -t SailfishOS-5.0.0.62-aarch64 -R zypper --non-interactive in openssl openssl-deve

What’s the error message?

The correct way to install packages to build targets is via sfdk tools package-install command.

In your case it would be sfdk tools package-install SailfishOS-5.0.0.62-aarch64 openssl-devel.

I would suggest reading at least the output of sfdk tools --help.

2 Likes

Thank you, the error I got was [D] SOFT ASSERT: “!targetHasSnapshots” in file ../../../../sailfish-qtcreator/src/libs/sfdk/buildengine.cpp, line 792

I read the sfdk tools --help and listed the snapshots via sfdk tools list --snapshots

This gave

SailfishOS-5.0.0.62 sdk-provided,latest
├── SailfishOS-5.0.0.62-aarch64 sdk-provided,latest
│ └── SailfishOS-5.0.0.62-aarch64.default snapshot
├── SailfishOS-5.0.0.62-armv7hl sdk-provided,latest
│ └── SailfishOS-5.0.0.62-armv7hl.default snapshot
└── SailfishOS-5.0.0.62-i486 sdk-provided,latest
└── SailfishOS-5.0.0.62-i486.default snapshot
└── SailfishOS-5.0.0.62-i486.default.default snapshot

Via sfdk tools remove --snapshots-of SailfishOS-5.0.0.62-i486 I was able to delete all snapshots under SailfishOS-5.0.0.62-i486. Launching the command sfdk build-shell --maintain again created a new SailfishOS-5.0.0.62-i486.default snapshot, and didn’t gave any errors anymore, so problem solved. Tx for helping!

1 Like