On Wed, Dec 2, 2009 at 7:20 PM, Chandler Carruth <[email protected]> wrote: > On Wed, Dec 2, 2009 at 7:14 PM, Daniel Dunbar <[email protected]> wrote: >> Great, sorry about the breakage. We really need to move to explicit >> dependencies... :/ > > +1 I'm interested in looking at this, as I've had to build up explicit > dependencies for our internal build system. It should be pretty > straight forward to bring them across, and our builds even enforce > #includes across the boundaries. What's your preference for how to > encode them and where to put it?
What I have in mind is some kind of LibDeps.txt file inside each library directory which defines the libraries that library depends on. The CMakeFiles and Makefiles would parse those files to generate what is the current USEDLIBS variables. We can retain LINK_COMPONENTS, but it should not be inferred by scanning symbols, instead a component should map to some list of libraries which gets expanded to the transitive closure of its dependency list. Bonus points if llvm/utils also gets a nice .py script which pops out a pretty graph of the dependencies, although if someone else doesn't add this I will. :) Note that one problem here is that there are quite a few places where we depend on the fact that, given: foo.a: a.o b.o bar.a: ... baz.a: where a.o depends on bar.a and b.o depends on baz.a That linking some app against foo.a, but which doesn't use b.o, doesn't need to link against baz.a. This tends not to work well on Windows, I think. For example, libFrontend.a includes the action which compiles code. Technically, that means that anything which links against libFrontend.a depends on the entire LLVM code generator, targets, etc. We should fix this, depending on the nature of .a files is very fragile. > FWIW, I can build Clang with perfect explicit dependencies and there > are no layering violations by #includes. LLVM isn't as clean > currently. =/ Personally, I would rather over-link and treat that as something to be fixed, than deal with the hassle of futzing with link lines. The one major exception (for me personally, YMMV) is an unneeded dependency on the LLVM code generator and backend, just because of the volume of stuff this pulls in. - Daniel >> On Wed, Dec 2, 2009 at 6:56 PM, Zhongxing Xu <[email protected]> wrote: >>> Thanks. c-test-index now builds. >>> >>> 2009/12/3 Daniel Dunbar <[email protected]>: >>>> Author: ddunbar >>>> Date: Wed Dec 2 15:47:55 2009 >>>> New Revision: 90350 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=90350&view=rev >>>> Log: >>>> Normalize CIndex/c-index-test/index-test link lines in the hopes it will >>>> fix >>>> *something*. >>>> - We really need to fix how LLVM's build systems manage >>>> linking. Pretty-please-someone-else-do-this? :) >>>> >>>> Modified: >>>> cfe/trunk/tools/CIndex/CMakeLists.txt >>>> cfe/trunk/tools/CIndex/Makefile >>>> cfe/trunk/tools/c-index-test/CMakeLists.txt >>>> cfe/trunk/tools/c-index-test/Makefile >>>> cfe/trunk/tools/index-test/CMakeLists.txt >>>> cfe/trunk/tools/index-test/Makefile >>>> >>>> Modified: cfe/trunk/tools/CIndex/CMakeLists.txt >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CMakeLists.txt?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/CIndex/CMakeLists.txt (original) >>>> +++ cfe/trunk/tools/CIndex/CMakeLists.txt Wed Dec 2 15:47:55 2009 >>>> @@ -3,11 +3,20 @@ >>>> set(LLVM_NO_RTTI 1) >>>> >>>> set(LLVM_USED_LIBS >>>> - clangFrontend clangIndex clangSema clangAnalysis clangAST clangParse >>>> clangLex clangBasic) >>>> + clangIndex >>>> + clangFrontend >>>> + clangDriver >>>> + clangSema >>>> + clangAnalysis >>>> + clangAST >>>> + clangParse >>>> + clangLex >>>> + clangBasic) >>>> >>>> set( LLVM_LINK_COMPONENTS >>>> - MC >>>> - support >>>> + bitreader >>>> + mc >>>> + core >>>> ) >>>> >>>> add_clang_library(CIndex CIndex.cpp) >>>> >>>> Modified: cfe/trunk/tools/CIndex/Makefile >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/Makefile?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/CIndex/Makefile (original) >>>> +++ cfe/trunk/tools/CIndex/Makefile Wed Dec 2 15:47:55 2009 >>>> @@ -21,8 +21,9 @@ >>>> LINK_LIBS_IN_SHARED = 1 >>>> SHARED_LIBRARY = 1 >>>> >>>> -LINK_COMPONENTS := MC support >>>> -USEDLIBS = clangFrontend.a clangDriver.a clangIndex.a clangSema.a >>>> clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a >>>> +LINK_COMPONENTS := bitreader mc core >>>> +USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \ >>>> + clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a >>>> >>>> include $(LEVEL)/Makefile.common >>>> >>>> >>>> Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/c-index-test/CMakeLists.txt (original) >>>> +++ cfe/trunk/tools/c-index-test/CMakeLists.txt Wed Dec 2 15:47:55 2009 >>>> @@ -16,6 +16,7 @@ >>>> set( LLVM_LINK_COMPONENTS >>>> bitreader >>>> mc >>>> + core >>>> ) >>>> >>>> add_clang_executable(c-index-test >>>> >>>> Modified: cfe/trunk/tools/c-index-test/Makefile >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/Makefile?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/c-index-test/Makefile (original) >>>> +++ cfe/trunk/tools/c-index-test/Makefile Wed Dec 2 15:47:55 2009 >>>> @@ -18,7 +18,7 @@ >>>> >>>> include $(LEVEL)/Makefile.config >>>> >>>> -LINK_COMPONENTS := bitreader mc >>>> +LINK_COMPONENTS := bitreader mc core >>>> USEDLIBS = CIndex.a clangIndex.a clangFrontend.a clangDriver.a >>>> clangSema.a \ >>>> clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a >>>> >>>> >>>> Modified: cfe/trunk/tools/index-test/CMakeLists.txt >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/index-test/CMakeLists.txt?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/index-test/CMakeLists.txt (original) >>>> +++ cfe/trunk/tools/index-test/CMakeLists.txt Wed Dec 2 15:47:55 2009 >>>> @@ -3,6 +3,7 @@ >>>> set( LLVM_USED_LIBS >>>> clangIndex >>>> clangFrontend >>>> + clangDriver >>>> clangSema >>>> clangAnalysis >>>> clangAST >>>> @@ -14,6 +15,7 @@ >>>> set( LLVM_LINK_COMPONENTS >>>> bitreader >>>> mc >>>> + core >>>> ) >>>> >>>> add_clang_executable(index-test >>>> >>>> Modified: cfe/trunk/tools/index-test/Makefile >>>> URL: >>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/index-test/Makefile?rev=90350&r1=90349&r2=90350&view=diff >>>> >>>> ============================================================================== >>>> --- cfe/trunk/tools/index-test/Makefile (original) >>>> +++ cfe/trunk/tools/index-test/Makefile Wed Dec 2 15:47:55 2009 >>>> @@ -18,8 +18,8 @@ >>>> >>>> include $(LEVEL)/Makefile.config >>>> >>>> -LINK_COMPONENTS := bitreader mc >>>> -USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a >>>> clangAnalysis.a \ >>>> - clangAST.a clangParse.a clangLex.a clangBasic.a >>>> +LINK_COMPONENTS := bitreader mc core >>>> +USEDLIBS = clangIndex.a clangFrontend.a clangDriver.a clangSema.a \ >>>> + clangAnalysis.a clangAST.a clangParse.a clangLex.a clangBasic.a >>>> >>>> include $(LLVM_SRC_ROOT)/Makefile.rules >>>> >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> [email protected] >>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >>>> >>> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >> > _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
