[llvm] r361280 - [cmake] Add custom command to touch archives on Darwin so ninja won't rebuild them.

Don Hinton via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 10:18:06 PDT 2019


On Fri, May 24, 2019 at 8:57 AM Shoaib Meenai <smeenai at fb.com> wrote:

> That would only matter if the path keeps changing even on a single
> machine, right? Having different paths on different machines should be
> fine, as long as the path on a single machine stays consistent.
>

My understanding was that in his case, he's using NFS, or something like
it, so the machines actually share the same build tree.  In any case, it's
fixed, so this case continues to work.


>
>
> *From: *Don Hinton <hintonda at gmail.com>
> *Date: *Friday, May 24, 2019 at 8:53 AM
> *To: *Shoaib Meenai <smeenai at fb.com>
> *Cc: *Mikael Holmén <mikael.holmen at ericsson.com>, "
> llvm-commits at lists.llvm.org" <llvm-commits at lists.llvm.org>
> *Subject: *Re: [llvm] r361280 - [cmake] Add custom command to touch
> archives on Darwin so ninja won't rebuild them.
>
>
>
>
>
>
>
> On Fri, May 24, 2019 at 8:41 AM Shoaib Meenai <smeenai at fb.com> wrote:
>
> Yup, just passing `-G Ninja` to CMake should make it pick up on whatever
> Ninja is on your path ... you shouldn't need the explicit
> `-DCMAKE_MAKE_PROGRAM=ninja`.
>
>
>
> Actually, his use case requires passing it without a path.  Otherwise,
> cmake with save the path and use it, which as he states, may be different
> on different machines that share that say build tree.
>
>
>
>
> On 5/24/19, 12:03 AM, "llvm-commits on behalf of Mikael Holmén via
> llvm-commits" <llvm-commits-bounces at lists.llvm.org on behalf of
> llvm-commits at lists.llvm.org> wrote:
>
>     Hi,
>
>     On 5/23/19 5:02 PM, Don Hinton wrote:
>     > Hi Mikael:
>     >
>     > Thanks for reporting this.
>     >
>     > Looks like the call to `include(CMakeNinjaFindMake OPTIONAL)` is the
>     > problem since it's using find_program and overwrites it if it isn't
> a
>     > full path.  Since the generator already set it, there's no reason
> for an
>     > additional find_program call, so I'll remove it.
>     >
>     > Fixed in r361501.
>     >
>
>     Thanks!
>
>     > Btw, why were you setting CMAKE_MAKE_PROGRAM to a value without a
> path?
>     > Is this so you can test alternative versions of ninja without
> rerunning
>     > cmake?
>     >
>
>     We're using several different machines with ninja installed at
> different
>     places, so I think we just set CMAKE_MAKE_PROGRAM to ninja (without
>     path) to use whatever ninja version we have in the PATH on that
> machine.
>
>     Perhaps we don't actually need to set CMAKE_MAKE_PROGRAM at all then?
>
>     Anyway, your patch made it work with just "ninja" again.
>
>     Thanks,
>     Mikael
>
>     > thanks again...
>     > don
>     >
>     > On Thu, May 23, 2019 at 2:30 AM Mikael Holmén
>     > <mikael.holmen at ericsson.com <mailto:mikael.holmen at ericsson.com>>
> wrote:
>     >
>     >     Hi Don,
>     >
>     >     I noticed that if I run cmake and configure with
>     >     -DCMAKE_MAKE_PROGRAM=ninja, so I'm not including the full path to
>     >     ninja,
>     >     then I get errors with this commit when it tries to do "ninja
>     >     --version".
>     >
>     >     It then tries to do
>     >
>     >
>     >
>  '/local/repo/bbiswjenk/fem023-eiffel003/workspace/llvm/llvm-dev-kielx2/build-ccache/ninja'
>     >
>     >     '--version'
>     >
>     >     If I instead configure with -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja
> it
>     >     works
>     >     as it should.
>     >
>     >     /usr/bin/ is included in the PATH, but still it tries to run
> ninja from
>     >     the local build directory when I've cofigured with just "ninja".
>     >
>     >     Is this expected?
>     >
>     >     Regards,
>     >     Mikael
>     >
>     >     On 5/21/19 7:56 PM, Don Hinton via llvm-commits wrote:
>     >      > Author: dhinton
>     >      > Date: Tue May 21 10:56:45 2019
>     >      > New Revision: 361280
>     >      >
>     >      > URL:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D361280-26view-3Drev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=1eOl5C4BmOsaH73pUE2CuP0LY6sw1Ibh1SdA4Md_IZE&e=
>     >      > Log:
>     >      > [cmake] Add custom command to touch archives on Darwin so
> ninja
>     >     won't rebuild them.
>     >      >
>     >      > Summary:
>     >      > clang and newer versions of ninja use high-resolutions
>     >     timestamps, but
>     >      > older versions of libtool on Darwin don't, so the archive
> will often
>     >      > get an older timestamp than the last object that was added or
>     >     updated.
>     >      > To fix this, we add a custom command to touch the archive
> after it's
>     >      > been built so that ninja won't rebuild it unnecessarily the
> next time
>     >      > it's run.
>     >      >
>     >      > Reviewed By: beanz
>     >      >
>     >      > Tags: #llvm
>     >      >
>     >      > Differential Revision:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D62172&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=q7mkc41SyCVHOSaXDTrV4au_qB6ljYSEagRmo5NPxns&e=
>     >      >
>     >      > Modified:
>     >      >      llvm/trunk/cmake/config-ix.cmake
>     >      >      llvm/trunk/cmake/modules/AddLLVM.cmake
>     >      >
>     >      > Modified: llvm/trunk/cmake/config-ix.cmake
>     >      > URL:
>     >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_config-2Dix.cmake-3Frev-3D361280-26r1-3D361279-26r2-3D361280-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=KhAFSUB3GQ9iUyo13QjW6oigXazyWHCRLwror8QxA0k&e=
>     >      >
>     >
>  ==============================================================================
>     >      > --- llvm/trunk/cmake/config-ix.cmake (original)
>     >      > +++ llvm/trunk/cmake/config-ix.cmake Tue May 21 10:56:45 2019
>     >      > @@ -554,6 +554,22 @@ find_program(GOLD_EXECUTABLE NAMES ${LLV
>     >      >   set(LLVM_BINUTILS_INCDIR "" CACHE PATH
>     >      >       "PATH to binutils/include containing plugin-api.h for
> gold
>     >     plugin.")
>     >      >
>     >      > +if(CMAKE_GENERATOR STREQUAL "Ninja")
>     >      > +  include(CMakeNInjaFindMake)
>     >      > +  if(CMAKE_MAKE_PROGRAM)
>     >      > +    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version
>     >      > +      OUTPUT_VARIABLE NINJA_VERSION
>     >      > +      OUTPUT_STRIP_TRAILING_WHITESPACE)
>     >      > +    set(NINJA_VERSION ${NINJA_VERSION} CACHE STRING "Ninja
>     >     version number" FORCE)
>     >      > +  endif()
>     >      > +endif()
>     >      > +
>     >      > +if(CMAKE_GENERATOR STREQUAL "Ninja" AND
>     >      > +    NINJA_VERSION VERSION_GREATER_EQUAL "1.9.0" AND
>     >      > +    CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION
>     >     VERSION_GREATER "15.6.0")
>     >      > +  set(LLVM_TOUCH_STATIC_LIBRARIES ON)
>     >      > +endif()
>     >      > +
>     >      >   if(CMAKE_HOST_APPLE AND APPLE)
>     >      >     if(NOT CMAKE_XCRUN)
>     >      >       find_program(CMAKE_XCRUN NAMES xcrun)
>     >      >
>     >      > Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
>     >      > URL:
>     >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_cmake_modules_AddLLVM.cmake-3Frev-3D361280-26r1-3D361279-26r2-3D361280-26view-3Ddiff&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=5Q0wz4FpwyhhgdEiCCD_VhDUsWgiJtNYbfwjnIAtq7o&e=
>     >      >
>     >
>  ==============================================================================
>     >      > --- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
>     >      > +++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue May 21
> 10:56:45 2019
>     >      > @@ -596,6 +596,18 @@ function(llvm_add_library name)
>     >      >       llvm_externalize_debuginfo(${name})
>     >      >       llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS})
>     >      >     endif()
>     >      > +  # clang and newer versions of ninja use high-resolutions
>     >     timestamps,
>     >      > +  # but older versions of libtool on Darwin don't, so the
>     >     archive will
>     >      > +  # often get an older timestamp than the last object that
> was added
>     >      > +  # or updated.  To fix this, we add a custom command to
> touch
>     >     archive
>     >      > +  # after it's been built so that ninja won't rebuild it
>     >     unnecessarily
>     >      > +  # the next time it's run.
>     >      > +  if(ARG_STATIC AND LLVM_TOUCH_STATIC_LIBRARIES)
>     >      > +    add_custom_command(TARGET ${name}
>     >      > +      POST_BUILD
>     >      > +      COMMAND touch
>     >
>  ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${name}${CMAKE_STATIC_LIBRARY_SUFFIX}
>     >      > +      )
>     >      > +  endif()
>     >      >   endfunction()
>     >      >
>     >      >   function(add_llvm_install_targets target)
>     >      >
>     >      >
>     >      > _______________________________________________
>     >      > llvm-commits mailing list
>     >      > llvm-commits at lists.llvm.org <mailto:
> llvm-commits at lists.llvm.org>
>     >      >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=btGrNIyNTgucno_4eyTPO6Txeqc41GZpUBT3K1Ok3gA&e=
>     >      >
>     >
>
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at lists.llvm.org
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_llvm-2Dcommits&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=rA1dpiQ5BP19dSBWl_-62q5HoYRz-RZJ3dPBh30g_uQ&s=btGrNIyNTgucno_4eyTPO6Txeqc41GZpUBT3K1Ok3gA&e=
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190524/aa990c2f/attachment.html>


More information about the llvm-commits mailing list