I’m sorry this has been giving you trouble @hsjpekka and thanks for sharing clear details of how you have things configured; that helps a lot. It looks like you’re missing amberwebauthorization from the PkgConfigBR section of your yaml file; see the last line here:
PkgConfigBR:
- sailfishapp >= 1.0.2
- Qt5Core
- Qt5Qml
- Qt5Quick
- amberwebauthorization
Hopefully adding this will allow your app to build correctly.
It might be helpful to have a bit of explanation in case you or others experience similar issues in the future.
The Requires section of the yaml file deals only with packages that are needed for your app to run on the device (i.e. it’ll install those packages on your phone if they’re not already there when you install your app). However, it doesn’t help with build-time dependencies that are installed into your SDK when your app is built.
For build-time dependencies, you need to add things to either the PkgConfigBR or PkgBR sections. The line you have to add isn’t always the same in both cases and the actual way to know what to add can be a bit arcane. Usually the best way to find out is from the documentation.
In this case, this requirement is stated in the documentation like this:
To use the C++ API, the client application should use the “amberwebauthorization.pc” pkgconfig file.
Admittedly it seems to me that it could be stated a bit more clearly.
So, just to walk through what I did to check this:
- Created a new Sailfish app using the Sailfish IDE.
- Copied over the contents of the example amberwebauthcppexample/main.cpp into the main.cpp file of my new project.
- At this point I attempted to build the project using the “Build project for manual deployment” option in the IDE (Ctrl-B). This generated the error “Project ERROR: amberwebauthorization development package not found”.
- To fix this I added the
amberwebauthorizationentry to thePkgConfigBRsection of my project’s yaml file. - I then re-ran
qmakeby selecting “Build > Run qmake” in the IDE. This step is essential, otherwise the package won’t get installed. During this step I was able to see the package being installed in the console output. - Now building the project (Ctrl-B) completes without error.
As an aside, if you’re just using Amber WebAuth in your QML then you don’t need to install the build-time packages, they’re only needed if you’re going to compile and link against them (e.g. for use with C++ code).
Just finally, this didn’t fix the errors appearing in the main.cpp file in the IDE. These shouldn’t affect the build, but it would be helpful if the syntax highlighting picked them up, so I’ve created an internal issue in case there’s a way to fix it.