CMake v3.3.0 Configuration and Build File Path issues

Using Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux
Using Docker Current version: 4.32.0 (157355)
Using VSCode v 1.92.2
Using CMake v3.30

I’m including a copy of the CMake output during configuration and build.

[proc] Executing command: /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake --version

[proc] Executing command: /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake -E capabilities

[presetController] Reading and validating the presets “file /workspaces/Api/CMakePresets.json”

[presetController] Successfully validated /workspaces/Api/CMakePresets.json against presets schema

[presetController] Expanding presets file /workspaces/Api/CMakePresets.json

[proc] Executing command: uname -s

[presetController] Successfully expanded presets file /workspaces/Api/CMakePresets.json

[main] Configuring project: Api

[proc] Executing command: /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake “-DCMAKE_INSTALL_PREFIX=/workspaces/Api/out/install/GCC 12.2.0 aarch64-linux-gnu” -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ -DCMAKE_BUILD_TYPE=Debug -S/workspaces/Api “-B/workspaces/Api/out/build/GCC 12.2.0 aarch64-linux-gnu”

[cmake] CMake Error: Unable to (re)create the private pkgRedirects directory:

[cmake] /workspaces/Api/out/build/GCC 12.2.0 aarch64-linux-gnu/CMakeFiles/pkgRedirects

[cmake] This may be caused by not having read/write access to the build directory.

[cmake] Try specifying a location with read/write access like:

[cmake] cmake -B build

[cmake] If using a CMake presets file, ensure that preset parameter

[cmake] ‘binaryDir’ expands to a writable directory.

[cmake]

[proc] The command: /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake “-DCMAKE_INSTALL_PREFIX=/workspaces/Api/out/install/GCC 12.2.0 aarch64-linux-gnu” -DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++ -DCMAKE_BUILD_TYPE=Debug -S/workspaces/Api “-B/workspaces/Api/out/build/GCC 12.2.0 aarch64-linux-gnu” exited with code: 1

The problem is that I have whitespace in the path name; GCC 12.2.0 aarch64-linux-gnu (see above). The pathname gets truncated to /workspaces/Api/out/build/GCC.

In the documentation there is no mention of -DSTRING_CONTEXT=“text with whitespace” that others have mentioned. CMake v 3.29 worked fine.

Spaces in paths are known to work in general, and we have nightly builds that verify that. Please show the exact command line you’re using to run CMake. Some of the early output looks like the command line wasn’t valid to begin with. I suspect you’ve got some wrong quoting going on in your command line.

Thank you for your help.

Again, I’m using the Debian OS with VSCode and a Docker devcontainer.
I agree with your assessment of a quatation issue, but I have come to think otherwise.

The error with truncating the whitespace pathname disappeared when I switched back to cmake v 3.29.3.

The CMake commandline is automatically generated when I start VSCode and the project is loaded. The presets are properly “path to file” quoted. The command line is:

Running CMake Configure within VSCode…

[proc] Executing command: /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake

“-DCMAKE_INSTALL_PREFIX=/workspaces/Api/out/install/GCC 12.2.0 aarch64-linux-gnu”

-DCMAKE_C_COMPILER=/usr/bin/aarch64-linux-gnu-gcc

-DCMAKE_CXX_COMPILER=/usr/bin/aarch64-linux-gnu-g++

-DCMAKE_BUILD_TYPE=Debug -S/workspaces/Api “-B/workspaces/Api/out/build/GCC 12.2.0 aarch64-linux-gnu”

The reported error:

[cmake] CMake Error: Unable to (re)create the private pkgRedirects directory:

[cmake] /workspaces/Api/out/build/GCC 12.2.0 aarch64-linux-gnu/CMakeFiles/pkgRedirects

[cmake] This may be caused by not having read/write access to the build directory.

[cmake] Try specifying a location with read/write access like:

[cmake] cmake -B build

[cmake] If using a CMake presets file, ensure that preset parameter

[cmake] ‘binaryDir’ expands to a writable directory.

But it begs a bigger question I posted awhile back that nobody responded to.

I’m using VSCode. My question is version agnostic. I could not find a Microsoft extension for the Kitware version of CMake. Does it exist and I just missed it? I couldn’t find any instructions for usage other then download.

Here is what I did to get CMake to work in VSCode.

1.) I downloaded the current version from the website.

2.) I extracted it to /usr/local/share

2a.) I changed to symbolic link in/usr/bin for cli purposes. Not used with VSCode.
3.) The twxs CMake version IS available as a VSCode extension so I brought it in.

4.) In the twxs extension I pointed to the Kitware Cmake executable.

5.) Works fine standalone without a devcontainer.

6.) To run CMake available when VSCode is operating with a docker container I had to

bind mount /usr/local/share/cmake-3.30.0-linux-x86_64/bin/cmake

The end result is that cmake is running on the local machine and everything else is running in the container. I believe that with cmake running locally it can’t access the container file system (Probably good guess). I would prefer that access to the Kitware cmake be part of the container and that means I need a VSCode Extension for the Kitware version of CMake or a work around.

I want to conclude with thanks and gratitude for the Kitware Cmake, the website and the documentation. I’m a true believer…

Thanks!

cmake has to run inside the container, just like everything else. You can’t run it from your host machine.

If you want to make cmake available inside your container, you need to mount the whole install, not just the share directory. I wouldn’t generally recommend mounting it in though, typically you’d install it into your container just like any other package. You would do that in your Dockerfile.

Yes, I understand. So when I run the shell script I can specify the container as the target?

I don’t know what shell script you’re referring to. You should be doing everything inside the container. If you’re running a script directly on your host machine, the only thing it should be doing is things like docker compose run, or whatever way you’re managing your container. I think you’re probably trying to do too much on the host machine, by the sound of it.

Hello,
Thank you again for your patience and support. I really do appreciate it.

I was referring to the installation shell cmake-3.30.3-linux-x86_64.sh. Since my last post I decided to abandon the container setup. I went back to my original workspace and everything is fine. Again, I want to say that after the learning curve for CMake I completely understood why it is such an important tool. I will use it for all my project management. Many thanks!

Now about a feature request for a VSCode extension…please :grinning: