I thought it would, but it seems to be missing the CloneModule symbol (which isn't called from anywhere in the LLVM codebase). On Fri, Jul 15, 2011 at 7:43 AM, John Criswell <criswell at illinois.edu>wrote:> On 7/14/11 7:36 PM, Gregory Malecha wrote: > > Hello, > > I have a question about how to set up a Makefile that generate a .so that I > can load into opt without getting duplicate symbols. Here's what I have > right now: > > > Have you tried removing LINK_COMPONENTS below? I suspect that the opt > binary already contains everying in the transformUtils library. > > -- John T. > > > LIBRARYNAME=previrt > SHARED_LIBRARY=previrt > LINK_COMPONENTS := transformUtils > LINK_LIBS_IN_SHARED=1 > > include $(LEVEL)/Makefile.common > > LIBS += -lprotobuf > > CPPFLAGS += -I${HOME}/.root/usr/include -DGOOGLE_PROTOBUF_NO_RTTI > LDFLAGS += -Wl,-L${HOME}/.root/usr/lib/ > PROTOC=${HOME}/.root/usr/bin/protoc > > I'm pretty sure the problem comes from LINK_LIBS_IN_SHARED, but my code > depends on the google protobuf library so I need to link against that > otherwise I get undefined symbols. > > Does anyone know how to solve this problem with LLVM makefiles? > > Thank you. > > -- > gregory malecha > http://www.people.fas.harvard.edu/~gmalecha/ > > > > _______________________________________________ > LLVM Developers mailing listLLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- gregory malecha http://www.people.fas.harvard.edu/~gmalecha/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110715/b5b40520/attachment.html>
Hi Gregory, I had a similar problem a while back, see: http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032508.html for my solution to this problem. Basically I ended up linking in the *.o files needed to get exactly what I needed (in your case, the file defining CloneModule and whatever else you need), without pulling in too much (causing duplicate symbol issues with opt). Hopefully this helps, and good luck! ~Will On Fri, Jul 15, 2011 at 10:56 AM, Gregory Malecha <gmalecha at eecs.harvard.edu> wrote:> I thought it would, but it seems to be missing the CloneModule symbol (which > isn't called from anywhere in the LLVM codebase). > > On Fri, Jul 15, 2011 at 7:43 AM, John Criswell <criswell at illinois.edu> > wrote: >> >> On 7/14/11 7:36 PM, Gregory Malecha wrote: >> >> Hello, >> >> I have a question about how to set up a Makefile that generate a .so that >> I can load into opt without getting duplicate symbols. Here's what I have >> right now: >> >> Have you tried removing LINK_COMPONENTS below? I suspect that the opt >> binary already contains everying in the transformUtils library. >> >> -- John T. >> >> >> LIBRARYNAME=previrt >> SHARED_LIBRARY=previrt >> LINK_COMPONENTS := transformUtils >> LINK_LIBS_IN_SHARED=1 >> >> include $(LEVEL)/Makefile.common >> >> LIBS += -lprotobuf >> >> CPPFLAGS += -I${HOME}/.root/usr/include -DGOOGLE_PROTOBUF_NO_RTTI >> LDFLAGS += -Wl,-L${HOME}/.root/usr/lib/ >> PROTOC=${HOME}/.root/usr/bin/protoc >> >> I'm pretty sure the problem comes from LINK_LIBS_IN_SHARED, but my code >> depends on the google protobuf library so I need to link against that >> otherwise I get undefined symbols. >> >> Does anyone know how to solve this problem with LLVM makefiles? >> >> Thank you. >> >> -- >> gregory malecha >> http://www.people.fas.harvard.edu/~gmalecha/ >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > > > > -- > gregory malecha > http://www.people.fas.harvard.edu/~gmalecha/ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Thanks Will. It seems like somewhat of a hack to me and might not be compatible across versions. In terms of a more stable solution, is it possible to break the passes and static declarations into their own library so to avoid this problem entirely? That way we end up with one library that contains the passes that opt includes, and another that includes only the utility functions? On Fri, Jul 15, 2011 at 1:26 PM, Will Dietz <willdtz at gmail.com> wrote:> Hi Gregory, > > I had a similar problem a while back, see: > http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032508.html for > my solution to this problem. > > Basically I ended up linking in the *.o files needed to get exactly > what I needed (in your case, the file defining CloneModule and > whatever else you need), without pulling in too much (causing > duplicate symbol issues with opt). > > Hopefully this helps, and good luck! > > ~Will > > On Fri, Jul 15, 2011 at 10:56 AM, Gregory Malecha > <gmalecha at eecs.harvard.edu> wrote: > > I thought it would, but it seems to be missing the CloneModule symbol > (which > > isn't called from anywhere in the LLVM codebase). > > > > On Fri, Jul 15, 2011 at 7:43 AM, John Criswell <criswell at illinois.edu> > > wrote: > >> > >> On 7/14/11 7:36 PM, Gregory Malecha wrote: > >> > >> Hello, > >> > >> I have a question about how to set up a Makefile that generate a .so > that > >> I can load into opt without getting duplicate symbols. Here's what I > have > >> right now: > >> > >> Have you tried removing LINK_COMPONENTS below? I suspect that the opt > >> binary already contains everying in the transformUtils library. > >> > >> -- John T. > >> > >> > >> LIBRARYNAME=previrt > >> SHARED_LIBRARY=previrt > >> LINK_COMPONENTS := transformUtils > >> LINK_LIBS_IN_SHARED=1 > >> > >> include $(LEVEL)/Makefile.common > >> > >> LIBS += -lprotobuf > >> > >> CPPFLAGS += -I${HOME}/.root/usr/include -DGOOGLE_PROTOBUF_NO_RTTI > >> LDFLAGS += -Wl,-L${HOME}/.root/usr/lib/ > >> PROTOC=${HOME}/.root/usr/bin/protoc > >> > >> I'm pretty sure the problem comes from LINK_LIBS_IN_SHARED, but my code > >> depends on the google protobuf library so I need to link against that > >> otherwise I get undefined symbols. > >> > >> Does anyone know how to solve this problem with LLVM makefiles? > >> > >> Thank you. > >> > >> -- > >> gregory malecha > >> http://www.people.fas.harvard.edu/~gmalecha/ > >> > >> > >> _______________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >> > >> > >> _______________________________________________ > >> LLVM Developers mailing list > >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >> > > > > > > > > -- > > gregory malecha > > http://www.people.fas.harvard.edu/~gmalecha/ > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- gregory malecha http://www.people.fas.harvard.edu/~gmalecha/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110715/d14fec71/attachment.html>