[CMake] Troubles compiling llvm

Eric Doenges doenges at mvtec.com
Thu May 23 06:37:17 EDT 2019


To answer myself:

I just saw that you already set CMAKE_INSTALL_PREFIX, so ignore that 
part of my answer. Unfortunately, as far as I am aware it is not 
possible to split building with ExternalProject_Add into separate build 
and install steps, so your options essentially boil down to:

1) Give yourself write permissions for ${OUTPUT_PATH} and run the build. 
You should then probably remove write access for ${OUTPUT_PATH} again 
once you are done.

2) Run the entire build as root.

Since you should be doing as little as possible as root, I would 
strongly suggest option 1.

Am 23.05.19 um 11:28 schrieb Eric Doenges:
>
> Hi Steven,
>
> I would assume the problem is that you do not have write permissions 
> for /usr/lib. You either need to give yourself the appropriate rights, 
> our run the build as root (which is probably a very bad idea). If you 
> don't want to actually install to /usr/lib, you can pass a different 
> CMAKE_INSTALL_PREFIX to the build via ExternalProject_Add's CMAKE_ARGS 
> argument, i.e. something like
>
> ExternalProject_Add(xxx
>   ...
>   CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<where to install LLVM to>
>   ...
>
>
> Am 23.05.19 um 10:40 schrieb Steven Truppe:
>> Hi everyone,
>>
>> i'm trying to compile llvm with ExternalProject_Add and get the
>> following error:
>>
>> -- Installing: /usr/lib/ocaml/llvm/llvm.mli
>> CMake Error at bindings/ocaml/llvm/cmake_install.cmake:49 (file):
>>   file INSTALL cannot copy file
>> "/home/stuv/linux-projects/programming/bsEdit/build_files/Release/llvm/src/external_llvm-build/bindings/ocaml/llvm/llvm.mli" 
>>
>>   to "/usr/lib/ocaml/llvm/llvm.mli".
>> Call Stack (most recent call first):
>>   bindings/ocaml/cmake_install.cmake:42 (include)
>>   cmake_install.cmake:64 (include)
>>
>>
>> Makefile:128: die Regel für Ziel „install“ scheiterte
>> make[3]: *** [install] Fehler 1
>> CMakeFiles/external_llvm.dir/build.make:73: die Regel für Ziel
>> „../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install“ 
>>
>> scheiterte
>> make[2]: ***
>> [../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install] 
>>
>> Fehler 2
>> CMakeFiles/Makefile2:72: die Regel für Ziel
>> „CMakeFiles/external_llvm.dir/all“ scheiterte
>> make[1]: *** [CMakeFiles/external_llvm.dir/all] Fehler 2
>> Makefile:83: die Regel für Ziel „all“ scheiterte
>> make: *** [all] Fehler 2
>>
>> set(LLVM_EXTRA_ARGS
>>     -DLLVM_USE_CRT_RELEASE=MT
>>     -DLLVM_USE_CRT_DEBUG=MTd
>>     -DLLVM_INCLUDE_TESTS=OFF
>>     -DLLVM_TARGETS_TO_BUILD=X86
>>     -DLLVM_INCLUDE_EXAMPLES=OFF
>>     -DLLVM_ENABLE_TERMINFO=OFF
>>     -DLLVM_BUILD_EXAMPLES=ON
>> )
>>
>> set(LLVM_GENERATOR "Unix Makefiles")
>>
>>
>> ExternalProject_Add(external_llvm
>>     URL ${LLVM_URL}
>>     DOWNLOAD_DIR download/llvm
>>     URL_HASH MD5=${LLVM_HASH}
>>     CMAKE_GENERATOR ${LLVM_GENERATOR}
>>     PREFIX ${OUTPUT_PATH}/llvm
>>     CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/llvm
>> ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS}
>>     INSTALL_DIR ${OUTPUT_PATH}/llvm
>> )
>>
>> I followed the instructions from llvm.org but i still get this error
>> during installation (the build process works fine but during install i
>> get this error).
>>
>>
>> best regards!
>>
> -- 
>
> *Dr. Eric Dönges *
> Senior Software Engineer
>
> MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
> doenges at mvtec.com <mailto:doenges at mvtec.com> | Tel: +49 89 457 695-0 | 
> www.mvtec.com <http://www.mvtec.com>
>
> Sign up <http://www.mvtec.com/newsletter> for our MVTec Newsletter!
>
> Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
> Amtsgericht München HRB 114695
>
> MVTec Software GmbH Logo
>
-- 

*Dr. Eric Dönges *
Senior Software Engineer

MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doenges at mvtec.com <mailto:doenges at mvtec.com> | Tel: +49 89 457 695-0 | 
www.mvtec.com <http://www.mvtec.com>

Sign up <http://www.mvtec.com/newsletter> for our MVTec Newsletter!

Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695

MVTec Software GmbH Logo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190523/7c7ad68a/attachment.html>


More information about the CMake mailing list