<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Allen,<div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks for reporting this.</div><div class=""><br class=""></div><div class="">I sent a patch for review:</div><div class=""><a href="https://reviews.llvm.org/D59808" class="">https://reviews.llvm.org/D59808</a> [clangd][xpc][cmake] Respect explicit value of CLANGD_BUILD_XPC</div><div class=""><div><br class=""></div><div>I will look into the support for multiple build configurations.</div><div><br class=""></div><div>Thanks.</div><div><br class=""></div><div>Jan</div><div><br class=""><blockquote type="cite" class=""><div class="">On Mar 25, 2019, at 2:33 AM, Haojian Wu <<a href="mailto:hokein@google.com" class="">hokein@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">+jkorous<span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class="">,  <a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:clangd-dev@lists.llvm.org" tabindex="-1">+via clangd-dev</a> </span><div class=""><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class="">It seems that the flag </span>CLANGD_BUILD_XPC is <span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class="">enforced to on for Mac, not sure the motivation, but I think making it optional on Mac is reasonable.</span></div><div class=""><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class=""><br class=""></span></div><div class=""><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:12.8px" class="">Currently, you could work around it by removing the cmake <a href="https://github.com/llvm-mirror/clang-tools-extra/blob/master/CMakeLists.txt#L2-L4" class="">configs</a>. </span></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 23, 2019 at 12:11 AM Allen Cronce via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br class="">
<br class="">
I’m new to this list, so apologies if this is the wrong place to post clang/CMake build issues.<br class="">
<br class="">
I'm trying to build the LLVM 8.0.0 final release on macOS High Sierra 10.13.6 using Xcode 9.4.1. But I'm seeing an error while creating the ClangdXPC Framework. It appears to be trying to copy the dylib from the wrong location (not where it was built):<br class="">
<br class="">
--snip--<br class="">
Creating ClangdXPC framework<br class="">
/Applications/CMake.app/Contents/bin/cmake -E copy llvm/llvmorg-8.0.0/src/LLVM-build/tools/clang/tools/extra/clangd/xpc/ClangdXPC.Info.plist llvm/llvmorg-8.0.0/src/LLVM-build/lib/ClangdXPC.framework/Versions/A/Resources/Info.plist<br class="">
/Applications/CMake.app/Contents/bin/cmake -E copy llvm/llvmorg-8.0.0/src/LLVM-build/lib/libClangdXPCLib.dylib llvm/llvmorg-8.0.0/src/LLVM-build/lib/ClangdXPC.framework/Versions/A/ClangdXPC<br class="">
Error copying file "llvm/llvmorg-8.0.0/src/LLVM-build/lib/libClangdXPCLib.dylib" to "llvm/llvmorg-8.0.0/src/LLVM-build/lib/ClangdXPC.framework/Versions/A/ClangdXPC".<br class="">
make[1]: *** [llvm/llvmorg-8.0.0/src/LLVM-build/lib/ClangdXPC.framework] Error 1<br class="">
Command /bin/sh failed with exit code 2<br class="">
--snip--<br class="">
<br class="">
But my actual build location is here:<br class="">
<br class="">
llvm/llvmorg-8.0.0/src/LLVM-build/Debug/lib/libClangdXPCLib.dylib<br class="">
<br class="">
Note the Debug config in the path. I’ve set up the generated project such that I can build both the Debug and Release into separate directories. That way both can coexist.<br class="">
<br class="">
I don't need XPC, so I tried disabling it by passing CLANGD_BUILD_XPC as off. But it looks like it gets forced to on at CMake config time when the platform is Darwin. We’re pulling in LLVM as an ExternalProject, so this results in a build error the first time we build our own project.<br class="">
<br class="">
Popping up a layer, I tried disabling the clang build tools via CLANG_BUILD_TOOLS (since there doesn't seem to be build granularity for disabling the clang extra tools), but that resulted in a different build error.<br class="">
<br class="">
At this point I had already spent too much time on work arounds, so I started digging into the actual issue. The problem is that CreateClangdXPCFramework.cmake seems to be using the wrong directory, both for where it’s creating the framework and where the built deliverables are located.<br class="">
<br class="">
I worked around the copy error by replacing the CreateClangdXPCFramework.cmake script's a priory knowledge of the built binary paths with a target file generator pattern:<br class="">
<br class="">
--snip--<br class="">
    # Copy the framework binary.<br class="">
    COMMAND ${CMAKE_COMMAND} -E copy<br class="">
       # PAC 2019-03-22: Work around build error on Mac<br class="">
       #"${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${target}.dylib"<br class="">
       "$<TARGET_FILE:ClangdXPCLib>"<br class="">
       "${CLANGD_FRAMEWORK_OUT_LOCATION}/${name}"<br class="">
--snip--<br class="">
<br class="">
 - and -<br class="">
<br class="">
--snip--<br class="">
    # Copy the Clangd binary.<br class="">
    COMMAND ${CMAKE_COMMAND} -E copy<br class="">
      # PAC 2019-03-22: Work around build error on Mac<br class="">
      #"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/clangd"<br class="">
      "$<TARGET_FILE:clangd>"<br class="">
      "${CLANGD_XPC_SERVICE_OUT_LOCATION}/MacOS/clangd"<br class="">
--snip--<br class="">
<br class="">
But while this works around the build failure, I still think that the framework is being built in the wrong place. It’s here:<br class="">
<br class="">
llvm_org/build/lib/ClangdXPC.framework<br class="">
<br class="">
Instead of here:<br class="">
<br class="">
llvm_org/build/Debug/lib/ClangdXPC.framework<br class="">
<br class="">
I tried fixing that basic problem, but LLVM is a huge project and I’m new to CMake, so I wasn’t successful. But since we don’t use the ClangdXPC.framework anyway, it wasn’t critical for me to fix this the correct way.<br class="">
<br class="">
Maybe someone else can take this the rest of the way and fix it properly.<br class="">
<br class="">
Best,<br class="">
<br class="">
Allen Cronce<br class="">
<br class="">
_______________________________________________<br class="">
cfe-dev mailing list<br class="">
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>