<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
p
        {margin-top:0;
        margin-bottom:0}
p
        {margin-top:0;
        margin-bottom:0}
p
        {margin-top:0;
        margin-bottom:0}
-->
P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hurray! It works now. For anyone curious, I am using LLVM 3.2 (svn, tags/release 3.2). If this is a bug, it may have been fixed since then.<br>
<br>
The infrastructure is there in the llvm cmake modules, but the command that adds the "-fno-rtti" flag is skipped over. In LLVMProcessSources.cmake,<br>
<br>
  if( NOT LLVM_REQUIRES_RTTI )<br>
    if( LLVM_COMPILER_IS_GCC_COMPATIBLE )<br>
      llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")<br>
    elseif( MSVC )<br>
      llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")<br>
    endif()<br>
  endif()<br>
<br>
is skipped because my config has LLVM_COMPILER_IS_GCC_COMPATIBLE unset when I try to build out of source. However, I confirmed that this -is- set when I run a fresh cmake configuration. (I confirmed that I'm not accidentally using the original cmake modules
 in the src directory.)<br>
<br>
Also, in case anyone has a similar problem as mine (I noticed a few online), I found it helpful to build llvm with autotools, and then build the pass with VERBOSE=1 so I could see the compiler flags, and try a manual build until it worked.<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF713559"><font face="Tahoma" size="2" color="#000000"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen@utah.edu]<br>
<b>Sent:</b> Friday, June 14, 2013 2:36 PM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt"><font face="Tahoma" size="2" color="black"><span dir="ltr" style="font-size:10pt">Ah! Think I figured it out -- it's rtti. When I build with -fno-rtti, the spurious symbol disappears.
 Blargh, that was complicated. I'm going to try an out-of-source cmake build now. So far this has been a soliloquy, hope it helps someone else.<br>
<br>
</span></font>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF138077" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen@utah.edu]<br>
<b>Sent:</b> Friday, June 14, 2013 11:34 AM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Still no go. I'm going to experiment building out of source manually with the cmake build and autotools build. I should've mentioned that I'm attempting this with the hello world
 pass example.<br>
<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF601447" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen@utah.edu]<br>
<b>Sent:</b> Friday, June 14, 2013 8:25 AM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hmmm, I just thought of something. Perhaps I need to set the MODULE cmake flag (via -DMODULE=ON)? I will try this today. (I remembered the LOADABLE_MODULE=1 flag in the makefile,
 and the if ( MODULE ) check in the AddLLVM cmake module.)<br>
<br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF225154" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> llvmdev-bounces@cs.uiuc.edu [llvmdev-bounces@cs.uiuc.edu] on behalf of Charles Jacobsen [charlie.jacobsen@utah.edu]<br>
<b>Sent:</b> Friday, June 14, 2013 7:55 AM<br>
<b>To:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> [LLVMdev] Building pass out of source with cmake: undefined symbol error<br>
</font><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">
<div>After building the pass out of source with cmake, when I load it with opt, I get an undefined symbol error: _ZTIN4llvm12FunctionPassE undefined in the .so.
<br>
<br>
(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)<br>
<br>
Platform: ubuntu 12.10 LTS, x86 64<br>
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3<br>
<br>
Build: LLVM 3.2 (svn), tried debug and release<br>
</div>
<div>Test suite builds and runs without error<br>
No other versions of llvm or clang are present<br>
</div>
<div><br>
I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.<br>
<br>
</div>
<div>I don't see this symbol in any of the llvm libraries, so I have no idea how it is being introduced into the pass .so.<br>
<br>
</div>
Interestingly, when I build llvm in source with autotools, and build the pass in source with the provided makefile template, it works, and _ZTIN4llvm12FunctionPassE is not in the pass .so. (Also, _ZTVN4llvm12FunctionPassE is now "B" when I run nm.).
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>