Building pass out of source with cmake: undefined symbol error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Building pass out of source with cmake: undefined symbol error

Charles Jacobsen
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.

(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)

Platform: ubuntu 12.10 LTS, x86 64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Build: LLVM 3.2 (svn), tried debug and release
Test suite builds and runs without error
No other versions of llvm or clang are present

I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.

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.

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.).

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Building pass out of source with cmake: undefined symbol error

Charles Jacobsen
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.)


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 7:55 AM
To: [hidden email]
Subject: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.

(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)

Platform: ubuntu 12.10 LTS, x86 64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Build: LLVM 3.2 (svn), tried debug and release
Test suite builds and runs without error
No other versions of llvm or clang are present

I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.

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.

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.).

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Building pass out of source with cmake: undefined symbol error

Charles Jacobsen
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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 8:25 AM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.)


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 7:55 AM
To: [hidden email]
Subject: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.

(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)

Platform: ubuntu 12.10 LTS, x86 64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Build: LLVM 3.2 (svn), tried debug and release
Test suite builds and runs without error
No other versions of llvm or clang are present

I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.

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.

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.).

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Building pass out of source with cmake: undefined symbol error

Charles Jacobsen
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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 11:34 AM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 8:25 AM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.)


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 7:55 AM
To: [hidden email]
Subject: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.

(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)

Platform: ubuntu 12.10 LTS, x86 64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Build: LLVM 3.2 (svn), tried debug and release
Test suite builds and runs without error
No other versions of llvm or clang are present

I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.

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.

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.).

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Building pass out of source with cmake: undefined symbol error

Charles Jacobsen
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.

The infrastructure is there in the llvm cmake modules, but the command that adds the "-fno-rtti" flag is skipped over. In LLVMProcessSources.cmake,

  if( NOT LLVM_REQUIRES_RTTI )
    if( LLVM_COMPILER_IS_GCC_COMPATIBLE )
      llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti")
    elseif( MSVC )
      llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-")
    endif()
  endif()

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.)

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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 2:36 PM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 11:34 AM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 8:25 AM
To: [hidden email]
Subject: Re: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.)


From: [hidden email] [[hidden email]] on behalf of Charles Jacobsen [[hidden email]]
Sent: Friday, June 14, 2013 7:55 AM
To: [hidden email]
Subject: [LLVMdev] Building pass out of source with cmake: undefined symbol error

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.

(_ZTVN4llvm12FunctionPassE is also undefined -- a "U" when I run nm. This symbol -is- in all of the llvm libraries.)

Platform: ubuntu 12.10 LTS, x86 64
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Build: LLVM 3.2 (svn), tried debug and release
Test suite builds and runs without error
No other versions of llvm or clang are present

I also tried building debug and release versions of the pass. No build errors or warnings when producing the pass .so.

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.

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.).

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev