Thanks for the tips, but the problem remains. I tried it also with a fresh intall in freshly installed Ubuntu 22.04, but similar results.
The editor does not recognize OAuth2- or Redirectlistener-classes, so there’s no autocompletion of function names etc. So the editor is showing error
\oauth2\main.cpp:40: error: use of undeclared identifier ‘OAuth2’
already before I press the build-button.
I assume that adding Requires in the spec-file could solve the problems in compiling the code, but not the problems with the editor.
I did not try sb2, because I don’t know where to get it. I found the source code in git, but don’t want to start compiling it, if it does what Requires field does.
In qtCreator Tools->Options->SailfishOs->Manage build targets opened a dialog where I could add amber-web-authorization and libamberwebauthorization in targets SailfishOS-4.4.0.58-i486, -armv7hl, and -aarch64, but doing that did not help either. I assume this does the same as sb2-tip does.
Here’s my spec file:
#
# Do NOT Edit the Auto-generated Part!
# Generated by: spectacle version 0.32
#
Name: oauth2
# >> macros
# << macros
%{!?qtc_qmake:%define qtc_qmake %qmake}
%{!?qtc_qmake5:%define qtc_qmake5 %qmake5}
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: oauthentication component
Version: 1.0
Release: 1
Group: Qt/Qt
License: LICENSE
URL: http://example.org/
Source0: %{name}-%{version}.tar.bz2
Source100: oauth2.yaml
Requires: sailfishsilica-qt5 >= 0.10.9
Requires: qml(org.freedesktop.contextkit)
Requires: amber-web-authorization
Requires: libamberwebauthorization
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Qml)
BuildRequires: pkgconfig(Qt5Quick)
BuildRequires: desktop-file-utils
%description
oauthentication component
%prep
%setup -q -n %{name}-%{version}
# >> setup
# << setup
%build
# >> build pre
# << build pre
%qtc_qmake5
%qtc_make %{?_smp_mflags}
# >> build post
# << build post
%install
rm -rf %{buildroot}
# >> install pre
# << install pre
%qmake5_install
# >> install post
# << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
%files
%defattr(-,root,root,-)
%{_bindir}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/%{name}/translations
# >> files
# << files
and here’s the output
$ sfdk build ../amberwebauthcppexample/
NOTICE: Using the 'SailfishOS-4.4.0.58-i486.default' snapshot of the build target
NOTICE: Files with CRLF line endings found. Consult the Sailfish SDK FAQ to learn why to avoid that and how.
Loading repository data...
Reading installed packages...
'pkgconfig(sailfishapp) >= 1.0.2' not found in package names. Trying capabilities.
'libsailfishapp-devel' providing 'pkgconfig(sailfishapp) >= 1.0.2' is already installed.
'pkgconfig(Qt5Core)' not found in package names. Trying capabilities.
'qt5-qtcore-devel' providing 'pkgconfig(Qt5Core)' is already installed.
'pkgconfig(Qt5Qml)' not found in package names. Trying capabilities.
'qt5-qtdeclarative-devel' providing 'pkgconfig(Qt5Qml)' is already installed.
'pkgconfig(Qt5Quick)' not found in package names. Trying capabilities.
'qt5-qtdeclarative-qtquick-devel' providing 'pkgconfig(Qt5Quick)' is already installed.
'desktop-file-utils' is already installed.
No update candidate for 'desktop-file-utils-0.26+git3-1.7.1.jolla.i486'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
Building target platforms: i486-meego-linux-gnu
Building for target i486-meego-linux-gnu
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.yU8PzL
+ umask 022
+ cd /home/pekka/koodi/testit/builds
+ LANG=C
+ export LANG
+ unset DISPLAY
+ CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables -I/usr/lib/gfortran/modules'
+ export FFLAGS
+ LD_AS_NEEDED=1
+ export LD_AS_NEEDED
+ export QT_SELECT=5
+ QT_SELECT=5
+ qmake -qt=5 -makefile 'QMAKE_CFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CXXFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CXXFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' QMAKE_STRIP=: PREFIX=/usr LIBDIR=/usr/lib
/home/mersdk/.mb2/wrappers/testit/builds/qmake: Executing real qmake:
+ /usr/bin/qmake -qt=5 -makefile 'QMAKE_CFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CXXFLAGS_RELEASE=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' 'QMAKE_CXXFLAGS_DEBUG=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables' QMAKE_STRIP=: PREFIX=/usr LIBDIR=/usr/lib /home/pekka/koodi/testit/amberwebauthcppexample
+ make -j4
g++ -c -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -m32 -msse -msse2 -march=i686 -mfpmath=sse -mtune=generic -fno-omit-frame-pointer -fasynchronous-unwind-tables -D_REENTRANT -Wall -W -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../amberwebauthcppexample -I. -I../amberwebauthcppexample -I../../lib -isystem /home/pekka/koodi/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-i486.default/usr/include/qt5 -isystem /home/pekka/koodi/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-i486.default/usr/include/qt5/QtGui -isystem /home/pekka/koodi/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-i486.default/usr/include/qt5/QtNetwork -isystem /home/pekka/koodi/SailfishOS/mersdk/targets/SailfishOS-4.4.0.58-i486.default/usr/include/qt5/QtCore -I. -I/usr/share/qt5/mkspecs/linux-g++ -o main.o ../amberwebauthcppexample/main.cpp
../amberwebauthcppexample/main.cpp:9:11: fatal error: oauth2.h: No such file or directory
#include <oauth2.h>
^~~~~~~~~~
compilation terminated.
make: *** [Makefile:401: main.o] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.yU8PzL (%build)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.yU8PzL (%build)