[llvm-commits] [compiler-rt] r163412 - in /compiler-rt/trunk: Makefile make/lib_info.mk make/options.mk

Alexander Potapenko glider at google.com
Mon Sep 17 07:22:25 PDT 2012


I've fixed this problem in r164031 by running install_name_tool (it
turns out to be the correct thing to do after copying a dylib).

On Mon, Sep 17, 2012 at 5:31 PM, Alexander Potapenko <glider at google.com> wrote:
> Thanks a lot!
>
> There's another problem however:
> http://code.google.com/p/address-sanitizer/issues/detail?id=113
> It turns out that in the make build libclang_rt.asan_osx_dynamic.dylib
> depends on /Users/glider/src/asan/llvm/build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/i386/libcompiler_rt.dylib,
> which also contains the ASan library.
> Do you know how this can be fixed? The dependencies of the dylib
> should be rather simple, see
> http://code.google.com/p/address-sanitizer/issues/detail?id=113#c5
>
>
> On Sat, Sep 15, 2012 at 1:52 AM, Daniel Dunbar <daniel at zuster.org> wrote:
>> On Thu, Sep 13, 2012 at 1:29 AM, Alexander Potapenko <glider at google.com> wrote:
>>> Let us land this patch and stick to packaging the dynamic runtime with
>>> the compiler itself.
>>
>> Landed in r163941 (with an extra dependency fix).
>>
>>  - Daniel
>>
>>> I suppose that for a long time from now the users will have to
>>> distribute the runtime together with the applications they build,
>>> because:
>>> a) many machines just won't have the ASan dylib
>>> b) until our code is mature enough, version conflicts are possible.
>>> E.g. in Chrome we roll new Clang binaries every two weeks, so we'll
>>> also have to push the new dylib to all the computers running ASan
>>> unless it's shipped with the app itself.
>>>
>>> On Thu, Sep 13, 2012 at 2:22 AM, Daniel Dunbar <daniel at zuster.org> wrote:
>>>> On Wed, Sep 12, 2012 at 2:21 AM, Alexander Potapenko <glider at google.com> wrote:
>>>>> On Wed, Sep 12, 2012 at 2:42 AM, Daniel Dunbar <daniel at zuster.org> wrote:
>>>>>> On Tue, Sep 11, 2012 at 3:07 PM, Daniel Dunbar <daniel at zuster.org> wrote:
>>>>>>> On Mon, Sep 10, 2012 at 2:31 AM, Alexander Potapenko <glider at google.com> wrote:
>>>>>>>> BTW is libcompiler_rt.dylib intentionally placed under
>>>>>>>> llvm-build/tools/clang/... instead of llvm-build/lib/clang/... (the
>>>>>>>> place where libcompiler_rt.a resides)?
>>>>>>>
>>>>>>> The way the build works is the compiler-rt build is separate and then
>>>>>>> part of the Clang build handles copying the libraries over. I hadn't
>>>>>>> written the second part because I wasn't clear to me that you wanted
>>>>>>> it installed with Clang, but I guess the answer is yes? I'll add the
>>>>>>> Clang Makefile side if so.
>>>>>>
>>>>>> I realized I should elaborate on this more:
>>>>>>
>>>>>> Usually installing dynamic libraries with the compiler is "wrong". The
>>>>>> static runtime libraries make sense to be distributed with the
>>>>>> compiler, because they depend intimately on the same version of the
>>>>>> compiler and its code generation strategy, and the code is statically
>>>>>> linked in.
>>>>>>
>>>>>> Dynamic shared libraries, however, really need to be distributed by
>>>>>> the platform/OS not the compiler if you want applications that require
>>>>>> them to be distributable. And using dynamic shared libraries adds all
>>>>>> the versioning/API stability issues that we kind of relegate to the
>>>>>> package maintainer to understand/handle (e.g., Darwin has ended up
>>>>>> with things like /usr/bin/libgcc_s.10.5.dylib).
>>>>>
>>>>> Thank you for clarifying this!
>>>>>
>>>>>> Of course, for ASAN I presume that the target market for the time
>>>>>> being is that users are also building the software, so maybe this does
>>>>>> make sense.
>>>>> You're right. If someone (like Chromium developers) packages his own
>>>>> Clang, he'll need the ASan dylib as well as the static libraries,
>>>>> because it isn't provided by the system.
>>>>> I didn't realize this is kind of a special case.
>>>>
>>>> I attached the patch that updates Clang to bring in the dylib as part
>>>> of its runtime libraries, in case you want it. Do you think we should
>>>> go ahead and do this, or do you want to think more about what we
>>>> should (e.g., should we distribute the dylib separately in a package
>>>> that would drop it into /usr/lib)?
>>>>
>>>>  - Daniel
>>>>
>>>>>>
>>>>>>  - Daniel
>>>>>>
>>>>>>>
>>>>>>>  - Daniel
>>>>>>>
>>>>>>>>
>>>>>>>> On Sun, Sep 9, 2012 at 11:28 AM, Alexey Samsonov <samsonov at google.com> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Sep 7, 2012 at 11:57 PM, Daniel Dunbar <daniel at zuster.org> wrote:
>>>>>>>>>>
>>>>>>>>>> Author: ddunbar
>>>>>>>>>> Date: Fri Sep  7 14:57:23 2012
>>>>>>>>>> New Revision: 163412
>>>>>>>>>>
>>>>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=163412&view=rev
>>>>>>>>>> Log:
>>>>>>>>>> build: Add support for building dylibs.
>>>>>>>>>>
>>>>>>>>>> Modified:
>>>>>>>>>>     compiler-rt/trunk/Makefile
>>>>>>>>>>     compiler-rt/trunk/make/lib_info.mk
>>>>>>>>>>     compiler-rt/trunk/make/options.mk
>>>>>>>>>>
>>>>>>>>>> Modified: compiler-rt/trunk/Makefile
>>>>>>>>>> URL:
>>>>>>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/Makefile?rev=163412&r1=163411&r2=163412&view=diff
>>>>>>>>>>
>>>>>>>>>> ==============================================================================
>>>>>>>>>> --- compiler-rt/trunk/Makefile (original)
>>>>>>>>>> +++ compiler-rt/trunk/Makefile Fri Sep  7 14:57:23 2012
>>>>>>>>>> @@ -117,7 +117,7 @@
>>>>>>>>>>  $(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name))
>>>>>>>>>>
>>>>>>>>>>  # Top-Level Platform Target
>>>>>>>>>> -$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.ObjPath)/%/libcompiler_rt.a)
>>>>>>>>>> +$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.Name)-%)
>>>>>>>>>>  .PHONY: $(Tmp.Name)
>>>>>>>>>>
>>>>>>>>>>  clean::
>>>>>>>>>> @@ -131,6 +131,13 @@
>>>>>>>>>>  define PerPlatformConfig_template
>>>>>>>>>>  $(call Set,Tmp.Config,$(1))
>>>>>>>>>>  $(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config))
>>>>>>>>>> +$(call Set,Tmp.SHARED_LIBRARY,$(strip \
>>>>>>>>>> +  $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>> +
>>>>>>>>>> +# Compute the library suffix.
>>>>>>>>>> +$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),
>>>>>>>>>> +  $(call Set,Tmp.LibrarySuffix,dylib),
>>>>>>>>>> +  $(call Set,Tmp.LibrarySuffix,a))
>>>>>>>>>>
>>>>>>>>>>  # Compute the archs to build, depending on whether this is a universal
>>>>>>>>>> build or
>>>>>>>>>>  # not.
>>>>>>>>>> @@ -142,8 +149,8 @@
>>>>>>>>>>         $(call
>>>>>>>>>> VarOrDefault,$(Tmp.Key).Arch.$(Tmp.Config),$($(Tmp.Key).Arch))))
>>>>>>>>>>
>>>>>>>>>>  # Copy or lipo to create the per-config library.
>>>>>>>>>> -$(call
>>>>>>>>>> Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.a))
>>>>>>>>>> -$(Tmp.ObjPath)/libcompiler_rt.a: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
>>>>>>>>>> +$(call
>>>>>>>>>> Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.$(Tmp.LibrarySuffix)))
>>>>>>>>>> +$(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix): $(Tmp.Inputs)
>>>>>>>>>> $(Tmp.ObjPath)/.dir
>>>>>>>>>>         $(Summary) "  FINAL-ARCHIVE: $(Tmp.Name)/$(Tmp.Config): $$@"
>>>>>>>>>>         -$(Verb) $(RM) $$@
>>>>>>>>>>         $(if $(call streq,1,$(words $(Tmp.ArchsToBuild))), \
>>>>>>>>>> @@ -152,7 +159,7 @@
>>>>>>>>>>  .PRECIOUS: $(Tmp.ObjPath)/.dir
>>>>>>>>>>
>>>>>>>>>>  # Per-Config Targets
>>>>>>>>>> -$(Tmp.Name)-$(Tmp.Config):: $(Tmp.ObjPath)/libcompiler_rt.a
>>>>>>>>>> +$(Tmp.Name)-$(Tmp.Config)::
>>>>>>>>>> $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)
>>>>>>>>>>  .PHONY: $(Tmp.Name)-$(Tmp.Config)
>>>>>>>>>>
>>>>>>>>>>  # Per-Config-Arch Libraries
>>>>>>>>>> @@ -172,10 +179,21 @@
>>>>>>>>>>    $(call GetCNAVar,AR,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>>  $(call Set,Tmp.ARFLAGS,$(strip \
>>>>>>>>>>    $(call GetCNAVar,ARFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>> +$(call Set,Tmp.CC,$(strip \
>>>>>>>>>> +  $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>> +$(call Set,Tmp.LDFLAGS,$(strip \
>>>>>>>>>> +  $(call GetCNAVar,LDFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>>  $(call Set,Tmp.RANLIB,$(strip \
>>>>>>>>>>    $(call GetCNAVar,RANLIB,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>>  $(call Set,Tmp.RANLIBFLAGS,$(strip \
>>>>>>>>>>    $(call GetCNAVar,RANLIBFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>> +$(call Set,Tmp.SHARED_LIBRARY,$(strip \
>>>>>>>>>> +  $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
>>>>>>>>>> +
>>>>>>>>>> +# Compute the library suffix.
>>>>>>>>>> +$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),
>>>>>>>>>> +  $(call Set,Tmp.LibrarySuffix,dylib),
>>>>>>>>>> +  $(call Set,Tmp.LibrarySuffix,a))
>>>>>>>>>>
>>>>>>>>>>  # Compute the object inputs for this library.
>>>>>>>>>>  $(call Set,Tmp.Inputs,\
>>>>>>>>>> @@ -188,10 +206,14 @@
>>>>>>>>>>         -$(Verb) $(RM) $$@
>>>>>>>>>>         $(Verb) $(Tmp.AR) $(Tmp.ARFLAGS) $$@ $(Tmp.Inputs)
>>>>>>>>>>         $(Verb) $(Tmp.RANLIB) $(Tmp.RANLIBFLAGS) $$@
>>>>>>>>>> +$(Tmp.ObjPath)/libcompiler_rt.dylib: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
>>>>>>>>>> +       $(Summary) "  DYLIB:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"
>>>>>>>>>> +       $(Verb) $(Tmp.CC) -arch $(Tmp.Arch) -dynamiclib -o $$@ \
>>>>>>>>>> +         $(Tmp.Inputs) $(Tmp.LDFLAGS)
>>>>>>>>>>  .PRECIOUS: $(Tmp.ObjPath)/.dir
>>>>>>>>>>
>>>>>>>>>>  # Per-Config-Arch Targets
>>>>>>>>>> -$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.a
>>>>>>>>>> +$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch)::
>>>>>>>>>> $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)
>>>>>>>>>>  .PHONY: $(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch)
>>>>>>>>>>
>>>>>>>>>>  # Per-Config-Arch-SubDir Objects
>>>>>>>>>>
>>>>>>>>>> Modified: compiler-rt/trunk/make/lib_info.mk
>>>>>>>>>> URL:
>>>>>>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_info.mk?rev=163412&r1=163411&r2=163412&view=diff
>>>>>>>>>>
>>>>>>>>>> ==============================================================================
>>>>>>>>>> --- compiler-rt/trunk/make/lib_info.mk (original)
>>>>>>>>>> +++ compiler-rt/trunk/make/lib_info.mk Fri Sep  7 14:57:23 2012
>>>>>>>>>> @@ -53,8 +53,7 @@
>>>>>>>>>>
>>>>>>>>>>  # The names of all the available options.
>>>>>>>>>>  AvailableOptions := AR ARFLAGS \
>>>>>>>>>> -                    CC CFLAGS FUNCTIONS OPTIMIZED \
>>>>>>>>>> +                    CC CFLAGS LDFLAGS FUNCTIONS OPTIMIZED \
>>>>>>>>>>                      RANLIB RANLIBFLAGS \
>>>>>>>>>> -                    VISIBILITY_HIDDEN \
>>>>>>>>>> -                    KERNEL_USE \
>>>>>>>>>> -                    STRIP LIPO
>>>>>>>>>> +                    VISIBILITY_HIDDEN KERNEL_USE \
>>>>>>>>>> +                   SHARED_LIBRARY STRIP LIPO
>>>>>>>>>>
>>>>>>>>>> Modified: compiler-rt/trunk/make/options.mk
>>>>>>>>>> URL:
>>>>>>>>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/options.mk?rev=163412&r1=163411&r2=163412&view=diff
>>>>>>>>>>
>>>>>>>>>> ==============================================================================
>>>>>>>>>> --- compiler-rt/trunk/make/options.mk (original)
>>>>>>>>>> +++ compiler-rt/trunk/make/options.mk Fri Sep  7 14:57:23 2012
>>>>>>>>>> @@ -23,11 +23,20 @@
>>>>>>>>>>  # default.
>>>>>>>>>>  VISIBILITY_HIDDEN := 0
>>>>>>>>>>
>>>>>>>>>> +# Whether the library is being built for kernel use.
>>>>>>>>>> +KERNEL_USE := 0
>>>>>>>>>> +
>>>>>>>>>> +# Whether the library should be built as a shared object.
>>>>>>>>>> +SHARED_LIBRARY := 0
>>>>>>>>>> +
>>>>>>>>>>  # Miscellaneous tools.
>>>>>>>>>>
>>>>>>>>>>  AR := ar
>>>>>>>>>>  # FIXME: Remove these pipes once ranlib errors are fixed.
>>>>>>>>>>  ARFLAGS := cru 2> /dev/null
>>>>>>>>>> +
>>>>>>>>>> +LDFLAGS :=
>>>>>>>>>> +
>>>>>>>>>>  RANLIB := ranlib
>>>>>>>>>>  # FIXME: Remove these pipes once ranlib errors are fixed.
>>>>>>>>>>  RANLIBFLAGS := 2> /dev/null
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> llvm-commits mailing list
>>>>>>>>>> llvm-commits at cs.uiuc.edu
>>>>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> We get the following build error on our Mac 10.6 bot:
>>>>>>>>> <...>
>>>>>>>>>
>>>>>>>>> DYLIB:   clang_darwin/asan_osx_dynamic/i386:
>>>>>>>>> /Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/i386/libcompiler_rt.dylib
>>>>>>>>>   DYLIB:   clang_darwin/asan_osx_dynamic/x86_64:
>>>>>>>>> /Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/x86_64/libcompiler_rt.dylib
>>>>>>>>> ld: library not found for -lc++
>>>>>>>>> clang: error: linker command failed with exit code 1 (use -v to see
>>>>>>>>> invocation)
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Alexey Samsonov, MSK
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Alexander Potapenko
>>>>>>>> Software Engineer
>>>>>>>> Google Moscow
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Alexander Potapenko
>>>>> Software Engineer
>>>>> Google Moscow
>>>
>>>
>>>
>>> --
>>> Alexander Potapenko
>>> Software Engineer
>>> Google Moscow
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list