[LLVMdev] Shared library not building with any symbols

oyao at andrew.cmu.edu oyao at andrew.cmu.edu
Mon Mar 10 08:30:39 PDT 2014


Hi everyone,

I'm running into an issue when building a library that's shared by several
of our IR passes.  We have our project structured as directed on the llvm
projects documentation page (http://llvm.org/docs/Projects.html).  We have
our IR passes and the shared library, CFIUtil, under the project_src/lib
directory (project_src/lib/CFIUtil/).  Our shared library has the
following Makefile:

LEVEL = ../../

LIBRARYNAME=CFIUtil

BUILD_ARCHIVE := 1
SHARED_LIBRARY := 1

include $(LEVEL)/Makefile.common



Our build is in project_src/build, and we have configured it according to
documentation.  When running make in the build directory, we get the
following warning:

...
llvm[2]: Linking Release+Debug+Asserts Shared Library libCFIUtil.dylib
llvm[2]: Building Release+Debug+Asserts Archive Library libCFIUtil.a
ranlib: file:
/Users/oulinyao/Desktop/MSISTM/CFI/project/boeing-cfi/llvm-cfi/build/Release+Debug+Asserts/lib/libCFIUtil.a(CFILowering.o)
has no symbols
ranlib: warning for library:
/Users/oulinyao/Desktop/MSISTM/CFI/project/boeing-cfi/llvm-cfi/build/Release+Debug+Asserts/lib/libCFIUtil.a
the table of contents is empty (no object file members in the library
define global symbols)
llvm[2]: Compiling main.c for Release+Debug+Asserts build
...

Which leads to the following error when running our IR passes:

...
dyld: lazy symbol binding failed: Symbol not found:
__ZN3cfi11CFILoweringC1ERN4llvm6ModuleE
  Referenced from: ../build/Release+Debug+Asserts/lib/LLVMSuperGraph.dylib
  Expected in: flat namespace
...

We found the following discussion of a similar issue:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037465.html. 
However making the same changes to our makefiles didn't seem to do
anything.  Any help debugging this issue is greatly appreciated.  I'm
running on Mac OSX version 10.8.5, and I have no problems building/running
IR passes that do not use a shared library.

Thanks!
Oulin Yao





More information about the llvm-dev mailing list