[llvm-dev] Issue with BUILD_SHARED_LIBS=ON

Roger Ferrer Ibanez via llvm-dev llvm-dev at lists.llvm.org
Fri Dec 8 01:37:41 PST 2017


Dear all,

while trying to build llvm with shared libraries using GCC (tested both in
Ubuntu 14.04 and Ubuntu 16.04) as in

  cmake -G Ninja -DBUILD_SHARED_LIBS=ON

I run into the following link error

   lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/PartialInlining.cpp.o: In function `llvm::ForwardDominanceFrontierBase<llvm::BasicBlock>::ForwardDominanceFrontierBase()':
   <path>/llvm/include/llvm/Analysis/DominanceFrontier.h:122: undefined reference to `llvm::DominanceFrontierBase<llvm::BasicBlock, false>::DominanceFrontierBase()'

This change

   diff --git a/include/llvm/Analysis/DominanceFrontier.h b/include/llvm/Analysis/DominanceFrontier.h
   index a304dff..e743d2d 100644
   --- a/include/llvm/Analysis/DominanceFrontier.h
   +++ b/include/llvm/Analysis/DominanceFrontier.h
   @@ -52,7 +52,7 @@ protected:
      static constexpr bool IsPostDominators = IsPostDom;

    public:
   -  DominanceFrontierBase() = default;
   +  DominanceFrontierBase() { }

      /// getRoots - Return the root blocks of the current CFG.  This may include
      /// multiple blocks if we are computing post dominators.  For forward

seems to fix the problem and I think is related to this GCC defect

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57728

I'm unsure about the level of interest in the community when it comes to builds
using shared libraries.  I personally use them because for debug builds, at
link time, they are less demanding in memory. However that alone might not be
enough to justify this change as there are valid workarounds (like not using
shared libraries, building clang with clang, using lld, etc).

Thoughts? If this is reasonable I will create a Phabricator.

Kind regards,
Roger


More information about the llvm-dev mailing list