Cmake error the current cmakecache txt directory is different than the directory

If CMake is re-executed after the source directory is moved, an error like this is given: CMake Error: The current CMakeCache.txt directory /new-path/CMakeCache.txt is different than the directo...

If CMake is re-executed after the source directory is moved, an error like this is given:

CMake Error: The current CMakeCache.txt directory /new-path/CMakeCache.txt is different than the directory /old-path where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt

What is the best approach to deal with this? It seems that deleting the cache works. Why might I want to edit CMakeCache.txt, rather than just delete it?

asked Jan 22, 2013 at 12:41

Drew Noakes's user avatar

Drew NoakesDrew Noakes

295k162 gold badges671 silver badges736 bronze badges

1

I think your best bet is indeed to delete the cache and re-create it. In fact, I tend to go further and remove the entire build tree if I need to move the source, but this is probably overkill.

The CMakeCache.txt file can be edited via the CMake GUI or by hand if you’re sure what you’re doing, but I find it’s not usually worth the effort compared to re-running cmake from scratch. I guess if running CMake takes a significant amount of time (e.g. if you use ExternalProject_Add which could involve downloading and building a third-party resource), it may be preferable to modify the CMakeCache.txt.

This article provides a bit more detail about the CMakeCache.txt file and editing it. In particular it says:

The main reason for editing the cache would be to give CMake the location of a native library such as JPEG, or to stop it from using a native library and use a version of the library in your source tree.

CMake will not alter an existing entry in the cache file itself. If your CMakeLists.txt files change significantly, you will need to remove the relevant entries from the cache file. If you have not already hand-edited the cache file, you could just delete it before re-running CMake.

Community's user avatar

answered Jan 22, 2013 at 13:04

Fraser's user avatar

1

I applied below two command and worked for me.

flutter clean

flutter pub get

answered Jul 6, 2022 at 16:51

AL-IMRAN's user avatar

flutter clean + flutter pub get is the easiest solution

answered Oct 7, 2022 at 1:36

P1not's user avatar

P1notP1not

113 bronze badges

I ran into same error while running a CGAL code (which I had already compiled sometime ago) . All I did was create a new directory and copy the «.cpp» file there and run » CGAL_create_CMakelists » and then run cmake command.It worked this way. I don’t exactly know but I think the error comes when you run the code which was already compiled and has its build files already in the folder(due to previous compiling).

answered Aug 25, 2015 at 10:59

shane's user avatar

shaneshane

4494 silver badges17 bronze badges

I’m trying to compile the source code for Shrewsoft VPN. The instructions say to compile the source on step 4. However… I get this error:

user@ubuntu:~/Ubuntu One/Programs/ShrewSoft VPN$ sudo cmake –DQTGUI=YES –DETCDIR=/etc –DNATT=YES
CMake Error: The current CMakeCache.txt directory /home/user/Ubuntu One/Programs/ShrewSoft VPN/CMakeCache.txt is different than the directory /home/user/Programs/ShrewSoft VPN where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source directory "/home/user/Ubuntu One/Programs/ShrewSoft VPN/–DNATT=YES" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

Instructions:

Compile the Source Code for the Shrew Soft VPN Client
1.  $> cd ~/Downloads

2.  $> tar –xzvf shrewsoft-client.tgz

Change to Download directory
$> cd ~/Downloads
Unpack the Source files.
$> tar –xzvf shrewsoft-client.tgz
3.   Change to the source directory.
     $> cd ~/Downloads/ike
4.   Run cmake.
     For GUI Installation (recommended):

$> cmake –DQTGUI=YES –DETCDIR=/etc –DNATT=YES
     For non-GUI Installation:

$> cmake -DNATT=YES
5.   Run make.
     $> make
6.   Run make install. NOTE: Run 

Содержание

  1. Wrong CMakeCache.txt directory #12
  2. Comments
  3. Editing versus deleting CMakeCache.txt after moving directory
  4. 4 Answers 4
  5. Thread: CMakeCache.txt problems—stuck in my Windows partition
  6. CMakeCache.txt problems—stuck in my Windows partition
  7. Re: CMakeCache.txt problems—stuck in my Windows partition
  8. Cmake error the current cmakecache txt directory is different than the directory
  9. Re: ESP-IDF VSCode Extension — CMake error
  10. Re: ESP-IDF VSCode Extension — CMake error
  11. Re: ESP-IDF VSCode Extension — CMake error
  12. cmakelist error 1 #19
  13. Comments

Wrong CMakeCache.txt directory #12

After it runs the sudo ./LCD5-show command, it throws an error:
CMake Error: The current CMakeCache.txt directory /home/pi/downloads/LCD-show/rpi-fbcp/build/CMakeCache.txt is different than the directory /home/pi/LCD-show/rpi-fbcp/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt CMake Error: The source «/home/pi/downloads/LCD-show/rpi-fbcp/CMakeLists.txt» does not match the source «/home/pi/LCD-show/rpi-fbcp/CMakeLists.txt» used to generate cache. Re-run cmake with a different source directory. CMake Error: The source directory «/home/pi/LCD-show/rpi-fbcp» does not exist. Specify —help for usage, or press the help button on the CMake GUI. Makefile:176: recipe for target ‘cmake_check_build_system’ failed make: *** [cmake_check_build_system] Error 1 LCD configrue 0

The text was updated successfully, but these errors were encountered:

nothing on this one? I’m getting this one too.

You have the LCD-show folder in downloads folder /home/pi/downloads/LCD-show/ must be on /home/pi/LCD-show/ solved moving the directory to home path

who the hell is using raspbian default user pi for doing anything else than booting the os creating an individual admin account?

For me it is best security practice to not use pi as user.

I ran into this issue after running a c++ program on a new computer than the one I had originally ran it on.

The program used a CMakeLists.txt to do the build initially and then created a CMakeCache.txt file.

When I deleted the CMakeCache.txt and ran cmake again it worked as expected. 👍

I ran into this issue after running a c++ program on a new computer than the one I had originally ran it on.

The program used a CMakeLists.txt to do the build initially and then created a CMakeCache.txt file.

When I deleted the CMakeCache.txt and ran cmake again it worked as expected. 👍

Thank you. THIS WORKED. I have been stuck at this spot for 3 days now.

Источник

Editing versus deleting CMakeCache.txt after moving directory

If CMake is re-executed after the source directory is moved, an error like this is given:

CMake Error: The current CMakeCache.txt directory /new-path/CMakeCache.txt is different than the directory /old-path where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt

What is the best approach to deal with this? It seems that deleting the cache works. Why might I want to edit CMakeCache.txt , rather than just delete it?

4 Answers 4

I think your best bet is indeed to delete the cache and re-create it. In fact, I tend to go further and remove the entire build tree if I need to move the source, but this is probably overkill.

The CMakeCache.txt file can be edited via the CMake GUI or by hand if you’re sure what you’re doing, but I find it’s not usually worth the effort compared to re-running cmake from scratch. I guess if running CMake takes a significant amount of time (e.g. if you use ExternalProject_Add which could involve downloading and building a third-party resource), it may be preferable to modify the CMakeCache.txt.

This article provides a bit more detail about the CMakeCache.txt file and editing it. In particular it says:

The main reason for editing the cache would be to give CMake the location of a native library such as JPEG, or to stop it from using a native library and use a version of the library in your source tree.

Источник

Thread: CMakeCache.txt problems—stuck in my Windows partition

Thread Tools
Display

CMakeCache.txt problems—stuck in my Windows partition

I’m trying to install OpenCV in my Ubuntu box. The thing is, I was in my Vista partition when I downloaded OpenCV for Ubuntu.

I’m following this tutorial*. The first step, a sudo apt-get install to various programs, among them cmake, was executed on my home folder. However, I untarred OpenCV in my Windows partition and cmaked it there.

The installation was successful. However, I realized that I may not be able to use OpenCV without my Windows drive mounted. So, I moved my OpenCV folder to usr/include and then tried to cmake there again. It failed with the following error:

How do I «refresh» my CMakeCache.txt ? Why is it stuck in my Windows partition?

Thanks for any guides.

*An extra question to prevent myself from shooting my foot in the future: is it alright to follow a tutorial for OpenCV 2.2 when I’m installing 2.3? I heard that there were significant changes from 2.0 to 2.1 that somehow affected the installation process. Is there such case here?

Re: CMakeCache.txt problems—stuck in my Windows partition

I’ve never done what you are attempting, but my first instinct is to warn you against installing anything within /usr/include.

Typically applications developed for Linux can be built and then installed anywhere. Thus I would recommend that you build the OpenCV package in your home directory. As for the CMakeCache.txt, I would remove or rename it, so that you start off with a clean slate.

When you are done building (compiling/linking) the application, surely there will be a way to install it (perhaps using a Makefile) into the target area of your choice (note that this is optional!). This target area should be relative to /usr/local, or perhaps in /opt.

Last edited by dwhitney67; August 11th, 2011 at 11:46 AM .

Источник

Cmake error the current cmakecache txt directory is different than the directory

Post by martingcavallo » Fri May 21, 2021 8:35 pm

I am new with ESP-IDF. I am starting with VSCode and ESP-IDF Extension. I have watched severals tutorial but I still have problems to run the hello-world example.

First, I had the problem that the standard library was not found. I found and read a lot of issues in this forum and github issues but the problem was solved alone after attempt a lot of time, installing, uninstalling, and changing the ESP-IDF Extension Version. What I could see was that when the problem occurred, the

I do not know why at the beggining, this did not happen.

After that this problem was solved, I tried to build the project but got the follow error:

As you can see, ESP-IDF and ESP-IDF Tools are installed in «C:/», and the project created from example is saved in «D:/», that is a partition of the hard disk.

What is exactly what I have to do/modify.

I am using:
ESP-IDF V4.2
ESP-IDF VSCode Extension V1.0.3
Windows 10 Pro

Thanks in advance.

Re: ESP-IDF VSCode Extension — CMake error

Post by ESP_bignacio » Tue May 25, 2021 6:57 am

Can you try to run the project in a folder without spaces? It seems to be a known issue when building projects.

Re: ESP-IDF VSCode Extension — CMake error

Post by martingcavallo » Thu Jun 17, 2021 1:52 am

Hi @ESP_bignacio! Thanks for your replay and sorry for my delayed response.

A few days later after I wrote this post I tried what you suggested and I could build the examples. I remember that I still had problem with one example but do not worry.

I am sorry that I did not test this before writing the post, because it is common problem in several different platforms or environment in general.

Re: ESP-IDF VSCode Extension — CMake error

Post by orbitcoms » Thu Jun 17, 2021 8:57 pm

I have had no end of problems with the extension in vscode.
Almost every update breaks something else and the installer does not put into place all it needs to run.

There always seems to be issues with finding python and now since latest «update» I get cmake errors. Each time costs me several days in lost production so I decided not to use vscode or the extension any more. (Whish is a shame because when it does work it is a simple and reasonably fast ide). I love the esp32 hardware but the toolchain setup is cumbersome.

I switched to using Visual Studio and Visual GDB. It installed and ran immediately without any issues.

Источник

cmakelist error 1 #19

/Desktop/CONVSYS/MocapNET-master$ ./initialize.sh
Generating shortcut
CMU BVH datasets appear to have been downloaded..
mkdir: cannot create directory ‘combinedModel’: File exists
mkdir: cannot create directory ‘mode3’: File exists
mkdir: cannot create directory ‘mode5’: File exists
Downloading Models for mode 3/quality setting 1.0
mkdir: cannot create directory ‘1.0’: File exists
Downloading Models for mode 3/quality setting 2.0
mkdir: cannot create directory ‘2.0’: File exists
Downloading 2D Joint Estimator models
Found a local tensorflow installation, not altering anything
RGBDAcquisition appears to already exist ..
AmmarServer appears to already exist ..
Now to try and build MocapNET..
mkdir: cannot create directory ‘build’: File exists
CMake Error: The current CMakeCache.txt directory /home/nvidia/Desktop/CONVSYS/MocapNET-master/build/CMakeCache.txt is different than the directory /home/nvidia/Desktop/MocapNET-master/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
CMake Error: The source «/home/nvidia/Desktop/CONVSYS/MocapNET-master/CMakeLists.txt» does not match the source «/home/nvidia/Desktop/MocapNET-master/CMakeLists.txt» used to generate cache. Re-run cmake with a different source directory.
CMake Error: The source directory «/home/nvidia/Desktop/MocapNET-master» does not exist.
Specify —help for usage, or press the help button on the CMake GUI.
Makefile:272: recipe for target ‘cmake_check_build_system’ failed
make: *** [cmake_check_build_system] Error 1
#####################################################################
i am getting this error while running initialize.sh ,please recommend some solution

The text was updated successfully, but these errors were encountered:

Hello due to the multiple «exists» prompts of the initialize script, I suppose that the initialize script has already run once and downloaded all required things, so the actual problem is the CMake building procedure..
Reading the CMake output
The source «/home/nvidia/Desktop/CONVSYS/MocapNET-master/CMakeLists.txt» does not match the source «/home/nvidia/Desktop/MocapNET-master/CMakeLists.txt» used to generate cache it appears that that you first did a build in the /home/nvidia/Desktop/MocapNET-master/CMakeLists.txt and then moved the project to the /home/nvidia/Desktop/CONVSYS/MocapNET-master/CMakeLists.txt and thats why CMake is complaining, because the new build has a mismatch with the directories it cached during its original run..

The solution is to create a new build directory so basically I think the following should work..

Also if you pull the latest master version the initialize script will automatically replace the build directory with a new one, probably solving your issue..

Источник

I have tried:

  rosmake --pre-clean

or

  rosmake --target=clean
  rosmake

But I also get error message like

    CMake Error: The current CMakeCache.txt directory /home/ira/code/ros/sam_pcl/perception_pcl_electric_unstable/pcl/msg/build/CMakeCache.txt is different than the directory /home/wei/ros/perception_pcl_electric_unstable/pcl/msg/build where CMackeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt
    CMake Error: The source "/home/ira/code/ros/sam_pcl/perception_pcl_electric_unstable/pcl/CMakeLists.txt" does not match the source "/home/wei/ros/perception_pcl_electric_unstable/pcl/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.

The Full message is:

  ira@ira-K42JP:~/code/ros/sam_pcl/perception_pcl_electric_unstable$ rosmake
  [ rosmake ] No package specified.  Building stack ['perception_pcl_electric_unstable']                   
  [ rosmake ] Packages requested are: ['perception_pcl_electric_unstable']                                 
  [ rosmake ] Logging to directory/home/ira/.ros/rosmake/rosmake_output-20120708-151720                    
  [ rosmake ] Expanded args ['perception_pcl_electric_unstable'] to:
  ['flann', 'cminpack', 'pcl_ros', 'pcl']
  [ rosmake ] Checking rosdeps compliance for packages perception_pcl_electric_unstable.  This may take a few seconds.
  [ rosmake ] rosdep check failed to find system dependencies: libvtk-qt                                   
  [rosmake-0] Starting >>> cpp_common [ make ]                                                             
  [rosmake-0] Finished <<< cpp_common ROS_NOBUILD in package cpp_common                                    
  [rosmake-1] Starting >>> roslib [ make ]                                                                 
  [rosmake-1] Finished <<< roslib ROS_NOBUILD in package roslib                                            
  [rosmake-2] Starting >>> rosbuild [ make ]                                                               
  [rosmake-2] Finished <<< rosbuild ROS_NOBUILD in package rosbuild
   No Makefile in package rosbuild       
  [rosmake-3] Starting >>> smclib [ make ]                                                                 
  [rosmake-1] Starting >>> rostime [ make ]                                                                
  [rosmake-0] Starting >>> std_msgs [ make ]                                                               
  [rosmake-2] Starting >>> roslang [ make ]                                                                
  [rosmake-1] Finished <<< rostime ROS_NOBUILD in package rostime                                          
  [rosmake-1] Starting >>> rosconsole [ make ]                                                             
  [rosmake-0] Finished <<< std_msgs ROS_NOBUILD in package std_msgs                                        
  [rosmake-0] Starting >>> rosgraph_msgs [ make ]                                                          
  [rosmake-2] Finished <<< roslang ROS_NOBUILD in package roslang
   No Makefile in package roslang          
  [rosmake-1] Finished <<< rosconsole ROS_NOBUILD in package rosconsole                                    
  [rosmake-2] Starting >>> rosclean [ make ]                                                               
  [rosmake-0] Finished <<< rosgraph_msgs ROS_NOBUILD in package rosgraph_msgs                              
  [rosmake-3] Finished <<< smclib ROS_NOBUILD in package smclib                                            
  [rosmake-3] Starting >>> rosgraph [ make ]                                                               
  [rosmake-1] Starting >>> rosparam [ make ]                                                               
  [rosmake-2] Finished <<< rosclean ROS_NOBUILD in package rosclean                                        
  [rosmake-1] Finished <<< rosparam ROS_NOBUILD in package rosparam                                        
  [rosmake-3] Finished <<< rosgraph ROS_NOBUILD in package rosgraph                                        
  [rosmake-1] Starting >>> roscpp_traits [ make ]                                                          
  [rosmake-2] Starting >>> rosmaster [ make ]                                                              
  [rosmake-3] Starting >>> rospy [ make ]                                                                  
  [rosmake-1] Finished <<< roscpp_traits ROS_NOBUILD in package roscpp_traits                              
  [rosmake-3] Finished <<< rospy ROS_NOBUILD in package rospy                                              
  [rosmake-0] Starting >>> xmlrpcpp [ make ]                                                               
  [rosmake-1] Starting >>> roscpp_serialization [ make ]                                                   
  [rosmake-2] Finished <<< rosmaster ROS_NOBUILD in package rosmaster                                      
  [rosmake-1] Finished <<< roscpp_serialization ROS_NOBUILD in package roscpp_serialization                
  [rosmake-2] Starting >>> rosunit [ make ]                                                                
  [rosmake-2] Finished <<< rosunit ROS_NOBUILD in package rosunit                                          
  [rosmake-1] Starting >>> pluginlib [ make ]                                                              
  [rosmake-0] Finished <<< xmlrpcpp ROS_NOBUILD in package xmlrpcpp                                        
  [rosmake-3] Starting >>> bond [ make ]                                                                   
  [rosmake-2] Starting >>> roscpp [ make ]                                                                 
  [rosmake-1] Finished <<< pluginlib ROS_NOBUILD in package pluginlib                                      
  [rosmake-2] Finished <<< roscpp ROS_NOBUILD in package roscpp                                            
  [rosmake-3] Finished <<< bond ROS_NOBUILD in package bond                                                
  [rosmake-0] Starting >>> cminpack [ make ]                                                               
  [rosmake-1] Starting >>> flann [ make ]                                                                  
  [rosmake-3] Starting >>> rosout [ make ]                                                                 
  [rosmake-2] Starting >>> bondcpp [ make ]                                                                
  [rosmake-0] Finished <<< cminpack [PASS] [ 3.78 seconds ]                                                
  [rosmake-3] Finished <<< rosout ROS_NOBUILD in package rosout                                            
  [rosmake-0] Starting >>> roslaunch [ make ]                                                              
  [rosmake-0] Finished <<< roslaunch ROS_NOBUILD in package roslaunch
   No Makefile in package roslaunch    
  [rosmake-2] Finished <<< bondcpp ROS_NOBUILD in package bondcpp                                          
  [rosmake-3] Starting >>> common_rosdeps [ make ]                                                         
  [rosmake-0] Starting >>> rostest [ make ]                                                                
  [rosmake-2] Starting >>> nodelet [ make ]                                                                
  [rosmake-3] Finished <<< common_rosdeps ROS_NOBUILD in package common_rosdeps                            
  [rosmake-0] Finished <<< rostest ROS_NOBUILD in package rostest                                          
  [rosmake-0] Starting >>> test_roslaunch [ make ]                                                         
  [rosmake-3] Starting >>> message_filters [ make ]                                                        
  [rosmake-2 ...

(more)

2 Answers

Delete the file:
/home/ira/code/ros/sam_pcl/perception_pcl_electric_unstable/pcl/msg/build/CMakeCache.txt

It ought to be deleted by rosmake —pre-clean, but apparently it is not.

Either your CMakeCache.txt file is still not deleted or your Makefile is corrupt. Check is the Makefile contains the following line exclusively:

include $(shell rospack find mk)/cmake.mk

Your Answer

Please start posting anonymously — your entry will be published after you log in or create a new account.

Question Tools

Related questions

Понравилась статья? Поделить с друзьями:
  • Cmake error target dependinfo cmake file not found clion
  • Cmake error does not match the source
  • Cmake error could not create named generator ninja
  • Cmake error could not create named generator mingw makefiles
  • Cmake error cmake was unable to find a build program corresponding to ninja