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?<br>

<br><div class="gmail_quote">On Fri, Jul 15, 2011 at 1:26 PM, Will Dietz <span dir="ltr"><<a href="mailto:willdtz@gmail.com">willdtz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi Gregory,<br>
<br>
I had a similar problem a while back, see:<br>
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032508.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-June/032508.html</a> for<br>
my solution to this problem.<br>
<br>
Basically I ended up linking in the *.o files needed to get exactly<br>
what I needed (in your case, the file defining CloneModule and<br>
whatever else you need), without pulling in too much (causing<br>
duplicate symbol issues with opt).<br>
<br>
Hopefully this helps, and good luck!<br>
<font color="#888888"><br>
~Will<br>
</font><div><div></div><div class="h5"><br>
On Fri, Jul 15, 2011 at 10:56 AM, Gregory Malecha<br>
<<a href="mailto:gmalecha@eecs.harvard.edu">gmalecha@eecs.harvard.edu</a>> wrote:<br>
> I thought it would, but it seems to be missing the CloneModule symbol (which<br>
> isn't called from anywhere in the LLVM codebase).<br>
><br>
> On Fri, Jul 15, 2011 at 7:43 AM, John Criswell <<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>><br>
> wrote:<br>
>><br>
>> On 7/14/11 7:36 PM, Gregory Malecha wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I have a question about how to set up a Makefile that generate a .so that<br>
>> I can load into opt without getting duplicate symbols. Here's what I have<br>
>> right now:<br>
>><br>
>> Have you tried removing LINK_COMPONENTS below?  I suspect that the opt<br>
>> binary already contains everying in the transformUtils library.<br>
>><br>
>> -- John T.<br>
>><br>
>><br>
>> LIBRARYNAME=previrt<br>
>> SHARED_LIBRARY=previrt<br>
>> LINK_COMPONENTS := transformUtils<br>
>> LINK_LIBS_IN_SHARED=1<br>
>><br>
>> include $(LEVEL)/Makefile.common<br>
>><br>
>> LIBS += -lprotobuf<br>
>><br>
>> CPPFLAGS += -I${HOME}/.root/usr/include -DGOOGLE_PROTOBUF_NO_RTTI<br>
>> LDFLAGS += -Wl,-L${HOME}/.root/usr/lib/<br>
>> PROTOC=${HOME}/.root/usr/bin/protoc<br>
>><br>
>> I'm pretty sure the problem comes from LINK_LIBS_IN_SHARED, but my code<br>
>> depends on the google protobuf library so I need to link against that<br>
>> otherwise I get undefined symbols.<br>
>><br>
>> Does anyone know how to solve this problem with LLVM makefiles?<br>
>><br>
>> Thank you.<br>
>><br>
>> --<br>
>> gregory malecha<br>
>> <a href="http://www.people.fas.harvard.edu/%7Egmalecha/" target="_blank">http://www.people.fas.harvard.edu/~gmalecha/</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> gregory malecha<br>
> <a href="http://www.people.fas.harvard.edu/%7Egmalecha/" target="_blank">http://www.people.fas.harvard.edu/~gmalecha/</a><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>gregory malecha<br><div><a href="http://www.people.fas.harvard.edu/%7Egmalecha/" target="_blank">http://www.people.fas.harvard.edu/~gmalecha/</a></div><br>