c++ubuntucmakemakefileantlr4

CMake Error : file INSTALL cannot set permissions on "/usr/local/include": Operation not permitted


I'm trying to run a transpiler project that converts alfa code to a solidity smart contracts, but after i run the final command make in order to generate an executable that'll convert the alfa to solidity, i get the following error:

CMake Error at _deps/googletest-build/googlemock/cmake_install.cmake:46 (file):
  file INSTALL cannot set permissions on "/usr/local/include": Operation not
  permitted.
Call Stack (most recent call first):
  _deps/googletest-build/cmake_install.cmake:47 (include)
  runtime/cmake_install.cmake:47 (include)
  cmake_install.cmake:47 (include)

although i have set the permissions on /usr/local/include to 777, i still get the error after running the command.

I tried running sudo make instead of make but then i get other errors related to the antlr4-runtime library, which is this, but it has no answers : some includes are broken after antlr4 c++ runtime setup on linux.

Any help is appreciated, thank you.

here is the full trace of the error:

Consolidate compiler generated dependencies of target antlr4_tests
make[5]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make  -f runtime/CMakeFiles/antlr4_tests.dir/build.make runtime/CMakeFiles/antlr4_tests.dir/build
make[5]: Entering directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make[5]: Nothing to be done for '_deps/googletest-build/googlemock/CMakeFiles/gmock_main.dir/build'.
make[5]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make[5]: Entering directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make[5]: Nothing to be done for 'runtime/CMakeFiles/antlr4_tests.dir/build'.
make[5]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
[ 99%] Built target gmock_main
[100%] Built target antlr4_tests
make[4]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
/usr/bin/cmake -E cmake_progress_start /home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build/CMakeFiles 0
make  -f CMakeFiles/Makefile2 preinstall
make[4]: Entering directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make[4]: Nothing to be done for 'preinstall'.
make[4]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
Install the project...
/usr/bin/cmake -P cmake_install.cmake
-- Install configuration: "Release"
-- Up-to-date: /usr/local/include
CMake Error at _deps/googletest-build/googlemock/cmake_install.cmake:46 (file):
  file INSTALL cannot set permissions on "/usr/local/include": Operation not
  permitted.
Call Stack (most recent call first):
  _deps/googletest-build/cmake_install.cmake:47 (include)
  runtime/cmake_install.cmake:47 (include)
  cmake_install.cmake:47 (include)


make[3]: *** [Makefile:130: install] Error 1
make[3]: Leaving directory '/home/ubuntu/new/transpiler/build6/antlr4cpp-prefix/src/antlr4cpp-build'
make[2]: *** [CMakeFiles/antlr4cpp.dir/build.make:102: antlr4cpp-prefix/src/antlr4cpp-stamp/antlr4cpp-install] Error 2
make[2]: Leaving directory '/home/ubuntu/new/transpiler/build6'
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/antlr4cpp.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/new/transpiler/build6'
make: *** [Makefile:91: all] Error 2

Solution

  • The error is that it wants to set the permissions of /usr/local/include itself, not add content to /usr/local/include. It doesn't matter what permissions you've given, only the owner of a file (or directory) can change the permissions of that file (or directory).