I’m using Cmake to try to build a project for Eclipse. When I try running Cmake, I get the following error:
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
---- Time Elapsed: 3 secs ----
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
I’m completely stumped on what might be causing this. I know that I’m running Cmake in the correct directory and the CMakeCache.txt file is present. Could someone point me in the right direction to solve this?
asked May 1, 2013 at 13:46
robhasacamerarobhasacamera
2,7271 gold badge25 silver badges40 bronze badges
3
If you are using the CLion, you can use File—«Reload CMake Project».
I meet this problem after using git force pull, and Reload CMake Project solves it.
answered May 29, 2017 at 14:23
5
Remove the CMakeCache.txt and try again. You probably had a bad cmake setup.
answered Oct 15, 2014 at 20:13
amirkavyanamirkavyan
6817 silver badges10 bronze badges
3
I have faced the same problem and solved it using the terminal.
- Delete the cached/configurations files as we will get them again.
- To configure the project run
cmake .
- Build the project using
cmake --build .
answered Sep 27, 2021 at 0:05
Mostafa WaelMostafa Wael
2,2601 gold badge16 silver badges19 bronze badges
1
run cmake --configure .
it should generate required files.
answered Oct 9, 2020 at 11:40
rakesh.sahurakesh.sahu
4558 silver badges17 bronze badges
3
I ran into this recently using JetBrains CLion and the above instructions were helpful but not directly, I was able to reload the project using the «cog» drop down in the CMake
tab:
Nick
1,70418 silver badges31 bronze badges
answered May 17, 2020 at 15:58
1
If you are absolutely positive that you are running the build command from the binary directory, this error probably means that you have had an issue during the configuration/generation step that you should have ran before trying the build. You can try to configure again to check (cmake your-build-dir)
I would advise running the Gui and trying to load the cache to see if you get a more explicit error (although I doubt it).
Another possibility would be to try to create a new clean build directory and take it from there.
answered Feb 11, 2014 at 9:23
chaamichaami
1,2469 silver badges10 bronze badges
In your example Eclipse must run something like
cmake --build folder_name --target all
and I opt that the *folder_name* is bad in this case. You probably messed something up in Eclipse.
answered Dec 19, 2013 at 14:05
AdamAdam
3062 silver badges11 bronze badges
1
For me it helps to select CMake tab (next to Run, TODO) in CLion. Then click the Reload CMakeProject button.
answered May 24, 2017 at 14:08
Michał ZiobroMichał Ziobro
10.1k11 gold badges79 silver badges134 bronze badges
I got this error on Windows WSL with ubuntu
~/tmp/cmake$ cmake --build ./build
Error: could not load cache
I was able to fix the above error by running the following cmds in order:
% cmake -S . -B ./build
% cmake --build ./build
The above solution was derived from this post.
answered Nov 6, 2022 at 18:20
If you are using Visual Studio 2019, close Visual Studio, delete .vs
and out
folders then rebuild your project.
answered Aug 2, 2020 at 12:10
Behrouz.MBehrouz.M
3,3856 gold badges36 silver badges63 bronze badges
I removed the .cxx
and other ide-generated files to the recycle.bin, except app.iml
. Then I restarted Android Studio, and eventually it worked fine.
answered Nov 12, 2019 at 14:52
KYHSGeekCodeKYHSGeekCode
1,0182 gold badges13 silver badges29 bronze badges
The solution that worked for me using VisualStudio 2017 was choosing:
CMake —> Cache —> Generate (from the top menu)
answered Sep 3, 2020 at 6:09
Apart from the already given answers, it might be due to the wrong commands or in wrong order.
To be precise, for me, it was due to
cmake -B build -G Ninja
cmake --build .
The «cmake —build .» command will throw the Could Not Load Cache error.
The problem is the build directory is given as ‘.’ which doesn’t have the cache or whatever files cmake generates, so correct command was ‘cmake —build build’… and fixed !
There maybe trillion other ways but my solution was this.
For eg, it happened with the repo -> https://github.com/adi-g15/worldlinesim, though may show the same for other repos too.
answered Jul 23, 2021 at 20:31
AdityaG15AdityaG15
1903 silver badges12 bronze badges
For Ubuntu users, provide the source code open-pose path in the CMake-GUI.
P.S I had this issue and my path was not set there.
answered Aug 13, 2021 at 11:05
HKayHKay
1882 silver badges5 bronze badges
Most probably the issue is you have not wrote the correct name of the Visual Studio version you have installed during the build file preparation:
cmake .. -G «Visual Studio 16 2019» (note if you have VS 2016 you should change in in there)
answered Jan 26, 2022 at 23:34
The most realistic answer and personal experienced answer is
- If you are using Clion and building files with IDE
- And getting the error Cmake Error: could not load cache
- Because you have accidentally deleted the cache file (like me: permanently and cant get back) or there is other problems or other problems
Then do this:
Run -> Clean
Run -> Build
And your project will be working all fine
answered Jan 10, 2018 at 17:47
- cmake -B ./build(dest dir)
- cmake —build ./build(
vimuth
4,61124 gold badges72 silver badges112 bronze badges
answered Aug 20, 2022 at 2:48
1
I am trying to build Dlib 19.0 examples. I did
cd examples
mkdir build
cd build
cmake ..
cmake --build
to get exe now,
cmake --build
from the examples directory.
CMake throws: Error: could not load cache
Screenshot:
rene
40.8k78 gold badges118 silver badges149 bronze badges
asked Aug 11, 2016 at 5:56
4
I guess you didn’t configure your project.
-
You first need to run
cmake .
at the project root to generate build files. You can also run it from an empty directory to separate source and build files. -
Then you can use
cmake --build ./
in the build dir.
Or, if you prefer code-only:
cd [root-directory-of-your-project]
cmake .
cmake --build ./
answered Aug 11, 2016 at 7:03
3
You could try:
- Make sure you have enough space / correct permissions etc for the generated files to be created
- Remove all generated files e.g.
CmakeCache.txt
and re-runcmake ..
; check the output carefully for potential issues during this step, missing libraries etc.
answered Aug 11, 2016 at 9:50
paul-gpaul-g
3,7292 gold badges21 silver badges33 bronze badges
cmake —build . is needed when building from your build directory
answered Dec 24, 2020 at 10:45
0
Those who encountered this issue while using Eclipse for ESP-IDF, the solution is go to: Window > Preferences > C/C++ > Build > Environment
, and set IDF_CCACHE_ENABLE
to 0.
answered Jul 6, 2021 at 9:11
I’m using Cmake to try to build a project for Eclipse. When I try running Cmake, I get the following error:
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
---- Time Elapsed: 3 secs ----
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
I’m completely stumped on what might be causing this. I know that I’m running Cmake in the correct directory and the CMakeCache.txt file is present. Could someone point me in the right direction to solve this?
13 Answers
If you are using the CLion, you can use File—«Reload CMake Project».
I meet this problem after using git force pull, and Reload CMake Project solves it.
Remove the CMakeCache.txt and try again. You probably had a bad cmake setup.
I ran into this recently using JetBrains CLion and the above instructions were helpful but not directly, I was able to reload the project using the «cog» drop down in the CMake
tab:
run cmake --configure .
it should generate required files.
If you are absolutely positive that you are running the build command from the binary directory, this error probably means that you have had an issue during the configuration/generation step that you should have ran before trying the build. You can try to configure again to check (cmake your-build-dir)
I would advise running the Gui and trying to load the cache to see if you get a more explicit error (although I doubt it).
Another possibility would be to try to create a new clean build directory and take it from there.
In your example Eclipse must run something like
cmake --build folder_name --target all
and I opt that the *folder_name* is bad in this case. You probably messed something up in Eclipse.
For me it helps to select CMake tab (next to Run, TODO) in CLion. Then click the Reload CMakeProject button.
If you are using Visual Studio 2019, close Visual Studio, delete .vs
and out
folders then rebuild your project.
I removed the .cxx
and other ide-generated files to the recycle.bin, except app.iml
. Then I restarted Android Studio, and eventually it worked fine.
The solution that worked for me using VisualStudio 2017 was choosing:
CMake —> Cache —> Generate (from the top menu)
Apart from the already given answers, it might be due to the wrong commands or in wrong order.
To be precise, for me, it was due to
cmake -B build -G Ninja
cmake --build .
The «cmake —build .» command will throw the Could Not Load Cache error.
The problem is the build directory is given as ‘.’ which doesn’t have the cache or whatever files cmake generates, so correct command was ‘cmake —build build’… and fixed !
There maybe trillion other ways but my solution was this.
For eg, it happened with the repo -> https://github.com/adi-g15/worldlinesim, though may show the same for other repos too.
For Ubuntu users, provide the source code open-pose path in the CMake-GUI.
P.S I had this issue and my path was not set there.
The most realistic answer and personal experienced answer is
- If you are using Clion and building files with IDE
- And getting the error Cmake Error: could not load cache
- Because you have accidentally deleted the cache file (like me: permanently and cant get back) or there is other problems or other problems
Then do this:
Run -> Clean
Run -> Build
And your project will be working all fine
I have fully build the system by the Installation document, but when I run the following command:
cmake —build build —target run_simulte-cars
I got a problem, the command line terminal output this:
could not load cache
I tried to solve this but failed,is there anyone meeting the same problem?
Thanks for your help
Hi Luge,
Are you sure that you ran cmake --build .
before running cmake --build build --target run_simulte-cars
?
Unfortunately, I don’t have enough information to go on with what you have explained. Maybe if this doesn’t help tell me some more about your system i.e. what OS you have, OMNeT++ version and SUMO versions, they shouldn’t impact on cMake but it’s more to go on.
Here is my building environment list:
_
- Ubuntu 18.04
- SUMO 1.3.1
- CMake 3.16.0
- GNU GCC 7.4
- OMNeT++ 5.5
- Boost 1.65.1
_
I have successfully make all the necessary submodules by command make all and run command cmake —build before running cmake —build build —target run_simulte-cars .Then it throws the error, could not load cache, I tried to google it, but the methods did not work….
Thanks a lot for your reply.
Я использую Cmake, чтобы попытаться создать проект для Eclipse. Когда я пытаюсь запустить Cmake, я получаю следующую ошибку:
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
---- Time Elapsed: 3 secs ----
Error: could not load cache
Error: Batch build stopped due to Eclipse CDT4 - Unix Makefiles error.
Я совершенно озадачен тем, что может быть причиной этого. Я знаю, что запускаю Cmake в правильном каталоге и файл CMakeCache.txt присутствует. Может ли кто-нибудь указать мне в правильном направлении, чтобы решить эту проблему?
16 ответы
Если вы используете CLion, вы можете использовать File—«Reload CMake Project».
Я сталкиваюсь с этой проблемой после использования git force pull, и Reload CMake Project решает ее.
ответ дан 29 мая ’17, 15:05
Удалите файл CMakeCache.txt и повторите попытку. Вероятно, у вас была плохая настройка cmake.
ответ дан 15 окт ’14, 21:10
пробег cmake --configure .
он должен генерировать необходимые файлы.
ответ дан 09 окт ’20, 12:10
Я столкнулся с той же проблемой и решил ее с помощью терминала.
- Удалите кэшированные/конфигурационные файлы, так как мы получим их снова.
- Чтобы настроить запуск проекта
cmake .
- Соберите проект, используя
cmake --build .
Создан 27 сен.
Я столкнулся с этим недавно, используя JetBrains CLion, и приведенные выше инструкции были полезны, но не напрямую, я смог перезагрузить проект, используя раскрывающийся список «cog» в CMake
Вкладка:
ответ дан 07 окт ’20, 13:10
Если вы абсолютно уверены, что запускаете команду сборки из двоичного каталога, эта ошибка, вероятно, означает, что у вас возникла проблема на этапе настройки/генерации, которую вы должны были выполнить перед попыткой сборки. Вы можете попробовать настроить еще раз, чтобы проверить (cmake your-build-dir)
Я бы посоветовал запустить графический интерфейс и попытаться загрузить кеш, чтобы увидеть, не появится ли более явная ошибка (хотя я в этом сомневаюсь).
Другая возможность — попытаться создать новый чистый каталог сборки и взять его оттуда.
Создан 11 фев.
В вашем примере Eclipse должен запускать что-то вроде
cmake --build folder_name --target all
и я полагаю, что *folder_name* в этом случае не подходит. Вы, вероятно, что-то напутали в Eclipse.
ответ дан 19 дек ’13, 14:12
Для меня это помогает выбрать вкладку CMake (рядом с Run, TODO) в CLion. Затем нажмите кнопку «Перезагрузить CMakeProject».
ответ дан 24 мая ’17, 15:05
Если вы используете Visual Studio 2019, закройте Visual Studio, удалите .vs
и out
папки, затем перестройте свой проект.
ответ дан 02 авг.
Я удалил .cxx
и другие сгенерированные ide файлы в recycle.bin, кроме app.iml
. Затем я перезапустил Android Studio, и в итоге все заработало.
Создан 12 ноя.
Решение, которое сработало для меня с использованием VisualStudio 2017, выбирало: CMake -> Cache -> Generate (из верхнего меню)
Создан 03 сен.
Помимо уже данных ответов, это может быть связано с неправильными командами или неправильным порядком.
Если быть точным, для меня это было связано с
cmake -B build -G Ninja
cmake --build .
«cmake —build». Команда выдаст ошибку «Не удалось загрузить кэш».
Проблема в том, что каталог сборки указан как ‘.’ у которого нет кеша или каких-либо файлов, которые cmake генерирует, поэтому правильной командой было «cmake —build build» … и исправлено!
Там может быть триллион других способов, но мое решение было таким.
Например, это произошло с репо -> https://github.com/adi-g15/worldlinesim, хотя может показать то же самое и для других репозиториев.
Создан 23 июля ’21, 21:07
Для пользователей Ubuntu укажите путь к исходному коду с открытым исходным кодом в CMake-GUI.
PS У меня была эта проблема, и мой путь там не был указан.
ответ дан 13 авг.
Скорее всего, проблема в том, что вы не указали правильное имя версии Visual Studio, которую вы установили во время подготовки файла сборки:
cmake .. -G «Visual Studio 16 2019» (обратите внимание, если у вас VS 2016, вы должны изменить его там)
Создан 26 янв.
- cmake -B ./build(целевой каталог)
- cmake —сборка ./сборка(
ответ дан 24 авг.
Самый реалистичный ответ и личный опытный ответ:
- Если вы используете Clion и создаете файлы с помощью IDE
- И получаю ошибку Ошибка Cmake: не удалось загрузить кеш
- Потому что вы случайно удалили файл кеша (как я: навсегда и не могу вернуться) или есть другие проблемы или другие проблемы
Затем сделайте следующее:
Выполнить -> Очистить
Выполнить -> Построить
И ваш проект будет работать нормально
Создан 20 июн.
Не тот ответ, который вы ищете? Просмотрите другие вопросы с метками
cmake
or задайте свой вопрос.