<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>To answer myself:</p>
    <p>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:</p>
    <p>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.<br>
    </p>
    <p>2) Run the entire build as root.</p>
    <p>Since you should be doing as little as possible as root, I would
      strongly suggest option 1.<br>
    </p>
    <div class="moz-cite-prefix">Am 23.05.19 um 11:28 schrieb Eric
      Doenges:<br>
    </div>
    <blockquote type="cite"
      cite="mid:179ad972-3802-c464-33a6-62ab029531a8@mvtec.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hi Steven,</p>
      <p>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</p>
      <p><tt>ExternalProject_Add(xxx</tt><tt><br>
        </tt><tt>  ...</tt><tt><br>
        </tt><tt>  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<where to
          install LLVM to></tt><tt><br>
        </tt><tt>  ...</tt><br>
      </p>
      <p><br>
      </p>
      Am 23.05.19 um 10:40 schrieb Steven Truppe:<br>
      <blockquote type="cite"
        cite="mid:06d122b3-f734-6acf-dc06-5ecbf03bfaa5@gmx.at">Hi
        everyone, <br>
        <br>
        i'm trying to compile llvm with ExternalProject_Add and get the
        <br>
        following error: <br>
        <br>
        -- Installing: /usr/lib/ocaml/llvm/llvm.mli <br>
        CMake Error at bindings/ocaml/llvm/cmake_install.cmake:49
        (file): <br>
          file INSTALL cannot copy file <br>
"/home/stuv/linux-projects/programming/bsEdit/build_files/Release/llvm/src/external_llvm-build/bindings/ocaml/llvm/llvm.mli"
        <br>
          to "/usr/lib/ocaml/llvm/llvm.mli". <br>
        Call Stack (most recent call first): <br>
          bindings/ocaml/cmake_install.cmake:42 (include) <br>
          cmake_install.cmake:64 (include) <br>
        <br>
        <br>
        Makefile:128: die Regel für Ziel „install“ scheiterte <br>
        make[3]: *** [install] Fehler 1 <br>
        CMakeFiles/external_llvm.dir/build.make:73: die Regel für Ziel <br>
„../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install“
        <br>
        scheiterte <br>
        make[2]: *** <br>
[../build_files/Release/llvm/src/external_llvm-stamp/external_llvm-install]
        <br>
        Fehler 2 <br>
        CMakeFiles/Makefile2:72: die Regel für Ziel <br>
        „CMakeFiles/external_llvm.dir/all“ scheiterte <br>
        make[1]: *** [CMakeFiles/external_llvm.dir/all] Fehler 2 <br>
        Makefile:83: die Regel für Ziel „all“ scheiterte <br>
        make: *** [all] Fehler 2 <br>
        <br>
        set(LLVM_EXTRA_ARGS <br>
            -DLLVM_USE_CRT_RELEASE=MT <br>
            -DLLVM_USE_CRT_DEBUG=MTd <br>
            -DLLVM_INCLUDE_TESTS=OFF <br>
            -DLLVM_TARGETS_TO_BUILD=X86 <br>
            -DLLVM_INCLUDE_EXAMPLES=OFF <br>
            -DLLVM_ENABLE_TERMINFO=OFF <br>
            -DLLVM_BUILD_EXAMPLES=ON <br>
        ) <br>
        <br>
        set(LLVM_GENERATOR "Unix Makefiles") <br>
        <br>
        <br>
        ExternalProject_Add(external_llvm <br>
            URL ${LLVM_URL} <br>
            DOWNLOAD_DIR download/llvm <br>
            URL_HASH MD5=${LLVM_HASH} <br>
            CMAKE_GENERATOR ${LLVM_GENERATOR} <br>
            PREFIX ${OUTPUT_PATH}/llvm <br>
            CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${OUTPUT_PATH}/llvm <br>
        ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS} <br>
            INSTALL_DIR ${OUTPUT_PATH}/llvm <br>
        ) <br>
        <br>
        I followed the instructions from llvm.org but i still get this
        error <br>
        during installation (the build process works fine but during
        install i <br>
        get this error). <br>
        <br>
        <br>
        best regards! <br>
        <br>
      </blockquote>
      <div class="moz-signature">-- <br>
        <div style="width:480px; text-align: left; font-family: Arial,
          Helvetica, sans-serif;">
          <p style="color: #062d64; font-size: 14px; text-align: left;
            font-family: Arial, Helvetica, sans-serif;"><b> Dr. Eric
              Dönges </b><br>
            Senior Software Engineer </p>
          <p style="color: #062d64; font-size: 12px; text-align: left;
            font-family: Arial, Helvetica, sans-serif;">MVTec Software
            GmbH | Arnulfstr. 205 | 80634 Munich | Germany<br>
            <a style="font-size: 12px; font-family: Arial, Helvetica,
              sans-serif; color: #062d64;"
              href="mailto:doenges@mvtec.com" moz-do-not-send="true">doenges@mvtec.com</a>
            | Tel: +49 89 457 695-0 | <a style="font-size: 12px;
              font-family: Arial, Helvetica, sans-serif; color:
              #062d64;" href="http://www.mvtec.com"
              moz-do-not-send="true">www.mvtec.com</a> </p>
          <p style="color: #062d64; font-size: 12px; text-align: left;
            font-family: Arial, Helvetica, sans-serif;"><img
src="https://mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/newsletter-icon.png"
              valign="bottom" moz-do-not-send="true" width="16"
              height="16"> <a style="font-size: 12px; font-family:
              Arial, Helvetica, sans-serif; color: #062d64; font-weight:
              bold;" href="http://www.mvtec.com/newsletter"
              moz-do-not-send="true">Sign up</a> for our MVTec
            Newsletter!</p>
          <p style="margin: 0px; color: #666; font-size: 12px;
            text-align: left; font-family: Arial, Helvetica,
            sans-serif;">Geschäftsführer: Dr. Wolfgang Eckstein, Dr.
            Olaf Munkelt<br>
            Amtsgericht München HRB 114695</p>
          <p style="margin: 0px; color: #666; font-size: 12px;
            text-align: left; font-family: Arial, Helvetica,
            sans-serif;"> </p>
          <img
src="https://www.mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/mvtec-logo-line.png"
            alt="MVTec Software GmbH Logo" moz-do-not-send="true"></div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
    </blockquote>
    <div class="moz-signature">-- <br>
      <div style="width:480px; text-align: left; font-family: Arial,
        Helvetica, sans-serif;">
        <p style="color: #062d64; font-size: 14px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;"><b>
            Dr. Eric Dönges
          </b><br>
          Senior Software Engineer
        </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;">MVTec Software
          GmbH | Arnulfstr. 205 | 80634 Munich | Germany<br>
          <a style="font-size: 12px; font-family: Arial, Helvetica,
            sans-serif; color: #062d64;" href="mailto:doenges@mvtec.com">doenges@mvtec.com</a>
          | Tel: +49 89 457 695-0 | <a style="font-size: 12px;
            font-family: Arial, Helvetica, sans-serif; color: #062d64;"
            href="http://www.mvtec.com">www.mvtec.com</a>
        </p>
        <p style="color: #062d64; font-size: 12px; text-align: left;
          font-family: Arial, Helvetica, sans-serif;"><img
src="https://mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/newsletter-icon.png"
            valign="bottom" width="16" height="16"> <a style="font-size:
            12px; font-family: Arial, Helvetica, sans-serif; color:
            #062d64; font-weight: bold;"
            href="http://www.mvtec.com/newsletter">Sign up</a> for our
          MVTec Newsletter!</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;">Geschäftsführer:
          Dr. Wolfgang Eckstein, Dr. Olaf Munkelt<br>
          Amtsgericht München HRB 114695</p>
        <p style="margin: 0px; color: #666; font-size: 12px; text-align:
          left; font-family: Arial, Helvetica, sans-serif;"> </p>
        <img
src="https://www.mvtec.com/fileadmin/Redaktion/newsletter/mail-signature/mvtec-logo-line.png"
          alt="MVTec Software GmbH Logo"></div>
    </div>
  </body>
</html>