Unable to build CMake project from QtCreator

Hey,

I’m unable to build any CMake project from QtCreator, for example the official cmakesample. Configurating CMake project in QtCreator succeeds:

Führe /home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/cmake -S /home/richard/src/cmakesample -B /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug -GNinja -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_SYSROOT:PATH=/home/richard/SailfishOS/mersdk/targets/SailfishOS-4.3.0.12-armv7hl.default -DCMAKE_C_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi -DCMAKE_CXX_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi -DCMAKE_CXX_COMPILER:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/gcc -DCMAKE_C_COMPILER:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/gcc -DCMAKE_PREFIX_PATH:STRING=/home/richard/SailfishOS/mersdk/targets/SailfishOS-4.3.0.12-armv7hl.default/usr -DQT_QMAKE_EXECUTABLE:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/qmake in /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug aus.
+ /home/richard/SailfishOS/bin/sfdk cmake /home/richard/src/cmakesample -- -GNinja -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_SYSROOT:PATH=/home/richard/SailfishOS/mersdk/targets/SailfishOS-4.3.0.12-armv7hl.default -DCMAKE_C_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi -DCMAKE_CXX_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi -DCMAKE_CXX_COMPILER:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/gcc -DCMAKE_C_COMPILER:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/gcc -DCMAKE_PREFIX_PATH:STRING=/home/richard/SailfishOS/mersdk/targets/SailfishOS-4.3.0.12-armv7hl.default/usr -DQT_QMAKE_EXECUTABLE:STRING=/home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/qmake
sfdk: [I] Options from environment: -c target=SailfishOS-4.3.0.12-armv7hl
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.
'cmake' is already installed.
No update candidate for 'cmake-3.19.3+git4-1.9.2.jolla.armv7hl'. The highest available version 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.6.1.jolla.armv7hl'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.
Building target platforms: armv7hl-meego-linux
Building for target armv7hl-meego-linux
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.mBWJaG
+ umask 022
+ cd /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug
+ 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 -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi -I/usr/lib/gfortran/modules'
+ export FFLAGS
+ LD_AS_NEEDED=1
+ export LD_AS_NEEDED
+ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
/home/mersdk/.mb2/wrappers/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug/cmake: Executing real cmake:
+ /usr/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -GNinja -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi -DCMAKE_CXX_COMPILER_TARGET:STRING=armv7hl-meego-linux-gnueabi /home/richard/src/cmakesample
-- The CXX compiler identification is GNU 8.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Checking for one of the modules 'sailfishapp'
-- Configuring done
-- Generating done
-- Build files have been written to: /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug
+ make
/home/mersdk/.mb2/wrappers/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug/make: Ignoring make
+ RPM_EC=0
++ jobs -p
+ exit 0
Verstrichene Zeit: 00:10.
Führe /home/richard/.config/SailfishSDK/libsfdk/build-target-tools/sailfish-sdk-build-engine/SailfishOS-4.3.0.12-armv7hl.default/cmake -S /home/richard/src/cmakesample -B /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug in /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug aus.
+ /home/richard/SailfishOS/bin/sfdk cmake /home/richard/src/cmakesample --
sfdk: [I] Options from environment: -c target=SailfishOS-4.3.0.12-armv7hl
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.
'cmake' is already installed.
No update candidate for 'cmake-3.19.3+git4-1.9.2.jolla.armv7hl'. The highest available version 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.6.1.jolla.armv7hl'. The highest available version is already installed.
Resolving package dependencies...

Nothing to do.
Building target platforms: armv7hl-meego-linux
Building for target armv7hl-meego-linux
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.L8ohxG
+ umask 022
+ cd /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug
+ 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 -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -fmessage-length=0 -march=armv7-a -mfloat-abi=hard -mfpu=neon -mthumb -Wno-psabi -I/usr/lib/gfortran/modules'
+ export FFLAGS
+ LD_AS_NEEDED=1
+ export LD_AS_NEEDED
+ cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
/home/mersdk/.mb2/wrappers/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug/cmake: Executing real cmake:
+ /usr/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr /home/richard/src/cmakesample
-- Configuring done
-- Generating done
-- Build files have been written to: /home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug
+ make
/home/mersdk/.mb2/wrappers/src/build-cmakesample-SailfishOS_4_3_0_12_armv7hl_in_sailfish_sdk_build_engine-Debug/make: Ignoring make
+ RPM_EC=0
++ jobs -p
+ exit 0
Verstrichene Zeit: 00:09.

But then the build button stays gray:
grafik

And build configuration says that a CMake configuration is missing, what ever is means (for example CMakeCache.txt exists there):
grafik

Build for i486 fails with an other error, because of missing Ninja which is used by default (can be fixed with changing the Generator in CMake parameters, but after that the problem from above stays):

-- Configuring incomplete, errors occurred!
See also "/home/richard/src/build-cmakesample-SailfishOS_4_3_0_12_i486_in_sailfish_sdk_build_engine-Debug/CMakeFiles/CMakeOutput.log".
CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

A reinstallation did not fixed the problem. QMake projects work as expected. Building with sfdk also works.

Does anyone have an idea how to solve the problem?

Could you please try whether clearing the configuration would help? For that to do stop the IDE first, then back-up and remove ~/.config/SailfishSDK.

Unfortunately this does not change anything.

Side note: I had to deactivate snapshots (sfdk config --global no-snapshot=force) again after deleting because it fails for me (cp: failed to clone '/srv/mer/targets/SailfishOS-4.3.0.12-armv7hl.default/.sdk-manage.conf' from '/srv/mer/targets/SailfishOS-4.3.0.12-armv7hl/.sdk-manage.conf': Invalid cross-device link and analogue for many more files when snapshots are active). Maybe it is related.

This is very likely related. One consequence of the cp failure is that the IDE is not getting all the required data and disabling snapshots does not fix that part.

I am thinking whether there is anything special about your Docker installation that could cause the failure? Which storage driver is your Docker using? And what is the filesystem below that? See Docker storage drivers | Docker Documentation. (I am using overlay2 on btrfs.)

If you find no way to fix it, then you could disable the problematic code. Enter the build engine with sfdk engine exec and edit /usr/bin/sdk-manage there. Under the sudo_sync_trees function, locate the line where can_reflink is set and comment out the value assigned to it:

    local can_reflink= #$(is_reflink_possible "$src" "$dst" && echo 1)

Then do Build > Clean Project under the IDE (or sfdk build-requires reset under a build directory) to see the effect.

I would be very thankful if you could find out what is causing the cp to fail.

I also use Btrfs with Overlay2 for Docker.

The first insight is that copying new files via --reflink=always works (see is_reflink_possible). But not copying files that already existed when the container was started.

Maybe the read-only layer and the top read-write layer are on different filesystems? It looks like it is a problem with my Docker setup and not related to the SDK. If I find a solution I will add it here.

1 Like

After I changed the storage driver to btrfs and reinstalled the SDK, it now works.

Maybe the check in is_reflink_possible can be adjusted to use an existing file instead of a new file.

Great! Yes, is_reflink_possible definitely deserves a fix.

This has been fixed in Sailfish SDK 3.9, which was released to Early Access users today.