[MDEV-19981] CMake with Ninja generator fails to create directory in support-files/ Created: 2019-07-08  Updated: 2022-11-25  Resolved: 2019-11-19

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.1.21, 10.4.6
Fix Version/s: 10.1.43

Type: Bug Priority: Minor
Reporter: Sebastian Mundry Assignee: Anel Husakovic
Resolution: Fixed Votes: 0
Labels: None
Environment:

uname: Linux-5.1.15-300.fc30.x86_64
CMake version: 3.14.5
Ninja version: 1.9.0



 Description   

When compiling the server with ninja, the step to create the SELinux module fails because of a missing directory (mariadb-pp.dir).
Leaving off the -G option and compiling with conventional make the missing directory gets created by cmake and the module gets created as expected. A directory listing is provided below.
When creating the directory before starting compilation with ninja, the SELinux module gets created without a problem.

Error

[1/1] Generating mariadb.pp
FAILED: mariadb.pp
cd /home/vmuser/mariadb/mariadb-10.4.6/support-files && /usr/bin/checkmodule -M -m /home/vmuser/mariadb/mariadb-10.4.6/support-files/policy/selinux/mariadb.te -o /home/vmuser/mariadb/mariadb-10.4.6/support-files/CMakeFiles/mariadb-pp.dir/mariadb.mod && /usr/bin/semodule_package -m /home/vmuser/mariadb/mariadb-10.4.6/support-files/CMakeFiles/mariadb-pp.dir/mariadb.mod -o /home/vmuser/mariadb/mariadb-10.4.6/support-files/mariadb.pp
/home/vmuser/mariadb/mariadb-10.4.6/support-files/CMakeFiles/mariadb-pp.dir/mariadb.mod: No such file or directory
ninja: build stopped: subcommand failed.

Reproduction

tar xf mariadb-10.4.6.tar.gz # (via https://downloads.mariadb.org/mariadb/10.4.6/#os_group=source)
cd ./mariadb-10.4.6/support-files
cmake . -Wno-dev \
        -DCMAKE_INSTALL_PREFIX=$HOME/.local/mariadb \
        -DINSTALL_SUPPORTFILESDIR=share/mariadb \
        -G Ninja
ninja

I noticed the problem first when I compiled mariadb-server. But I reduced the instructions to reproduce the error.
The error remains identical.

Bug History

The code in the CMakeLists.txt was first introduced in c1a23cd4e5f9.
The error was first introduced in mariadb-10.1.21.

Appendix

Listing of the mariadb-pp.dir directory created by cmake when using the default generator for conventional makefiles.

mariadb-10.4.6/support-files/CMakeFiles/mariadb-pp.dir/
├── build.make
├── cmake_clean.cmake
├── DependInfo.cmake
└── progress.make



 Comments   
Comment by Sebastian Mundry [ 2019-11-18 ]

This issue has been fixed in 10.1.43 (commit).
I've tested it successfully using my original instructions in version 10.1.43 and 10.4.10.

Comment by Anel Husakovic [ 2019-11-19 ]

Closed per reporters test.

Generated at Thu Feb 08 08:55:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.