[PATCH] D33299: [Polly][CMake] Use the CMake Package instead of llvm-config in out-of-tree builds

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 02:55:41 PDT 2017


Meinersbur added a comment.

This works for me with and without `-DBUILD_SHARED=ON`. However, with LLVM configured `-DLLVM_BUILD_LLVM_DYLIB=ON`, `-DLLVM_LINK_LLVM_DYLIB=ON` things don't work as smoothly.

When Polly is configured to LLVM's build directory, `LLVM_LINK_LLVM_DYLIB` is ignored. OK, I can live with that.

When Polly is configured to LLVM's install directory (`CMAKE_INSTALL_PREFIX`), I get errors:

  llvm-lit: /root/src/llvm/utils/lit/lit/formats/googletest.py:41: warning: unable to discover google-tests in '/root/build/polly/release_findbuild_dylib/unittests/DeLICM/DeLICMTests': Command '['/root/build/polly/release_findbuild_dylib/unittests/DeLICM/DeLICMTests', '--gtest_list_tests']' returned non-zero exit status 1. Process output:
  : CommandLine Error: Option 'debug' registered more than once!
  LLVM ERROR: inconsistency in registered CommandLine options
  
  llvm-lit: /root/src/llvm/utils/lit/lit/formats/googletest.py:41: warning: unable to discover google-tests in '/root/build/polly/release_findbuild_dylib/unittests/Flatten/FlattenTests': Command '['/root/build/polly/release_findbuild_dylib/unittests/Flatten/FlattenTests', '--gtest_list_tests']' returned non-zero exit status 1. Process output:
  : CommandLine Error: Option 'debug' registered more than once!
  LLVM ERROR: inconsistency in registered CommandLine options
  
  llvm-lit: /root/src/llvm/utils/lit/lit/formats/googletest.py:41: warning: unable to discover google-tests in '/root/build/polly/release_findbuild_dylib/unittests/Isl/IslTests': Command '['/root/build/polly/release_findbuild_dylib/unittests/Isl/IslTests', '--gtest_list_tests']' returned non-zero exit status 1. Process output:
  : CommandLine Error: Option 'debug' registered more than once!
  LLVM ERROR: inconsistency in registered CommandLine options
  
  llvm-lit: /root/src/llvm/utils/lit/lit/formats/googletest.py:41: warning: unable to discover google-tests in '/root/build/polly/release_findbuild_dylib/unittests/ScopPassManager/ScopPassManagerTests': Command '['/root/build/polly/release_findbuild_dylib/unittests/ScopPassManager/ScopPassManagerTests', '--gtest_list_tests']' returned non-zero exit status 1. Process output:
  : CommandLine Error: Option 'debug' registered more than once!
  LLVM ERROR: inconsistency in registered CommandLine options
  
  llvm-lit: /root/src/llvm/utils/lit/lit/discovery.py:190: warning: test suite 'Polly-Unit' contained no tests

The linking command reveals that, in addition to `libLLVM-5.0svn.so`, it also links to all of *.a from the build directory:

  /usr/bin/c++   -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -w -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -fno-exceptions -fno-rtti -O3  -Wl,-O3 -Wl,--gc-sections unittests/DeLICM/CMakeFiles/DeLICMTests.dir/DeLICMTest.cpp.o  -o unittests/DeLICM/DeLICMTests  /root/build/llvm/release_nopolly_dylib/lib/libLLVMSupport.a -lpthread /root/build/llvm/release_nopolly_dylib/lib/libgtest_main.a /root/build/llvm/release_nopolly_dylib/lib/libgtest.a -lpthread lib/libPolly.a -lpthread /root/build/llvm/release_nopolly_dylib/lib/libLLVM-5.0svn.so lib/External/libPollyPPCG.a lib/External/libPollyISL.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMPasses.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMNVPTXCodeGen.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMipo.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMIRReader.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMAsmParser.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMInstrumentation.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMLinker.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMAsmPrinter.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMDebugInfoCodeView.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMDebugInfoMSF.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMSelectionDAG.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMCodeGen.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMScalarOpts.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMInstCombine.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMBitWriter.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMNVPTXDesc.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMNVPTXAsmPrinter.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMNVPTXInfo.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMTarget.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMVectorize.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMTransformUtils.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMAnalysis.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMObject.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMBitReader.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMMCParser.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMMC.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMProfileData.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMCore.a /root/build/llvm/release_nopolly_dylib/lib/libLLVMSupport.a -lrt -ldl -ltinfo -lpthread -lz -lm /root/build/llvm/release_nopolly_dylib/lib/libLLVMDemangle.a -Wl,-rpath,/root/build/llvm/release_nopolly_dylib/lib

If you don't want to support `LLVM_LINK_LLVM_DYLIB` configurations, I suggest adding an error message notifying the user about it.

When I remove the llvm source directory and configure Polly to use LLVM's install path (Once installed, it should work without the source directory, right?), I get this error:

  [140/140] Running polly regression tests
  Traceback (most recent call last):
    File "/root/install/llvm/release_nopolly/bin/llvm-lit", line 53, in <module>
      from lit.main import main
  ImportError: No module named lit.main
  FAILED: cd /root/build/polly/release_findinstall/test && /root/install/llvm/release_nopolly/bin/llvm-lit --param polly_site_config=/root/build/polly/release_findinstall/test/lit.site.cfg --param polly_unit_site_config=/root/build/polly/release_findinstall/test/Unit/lit.site.cfg /root/build/polly/release_findinstall/test
  ninja: build stopped: subcommand failed.

I am not sure this even worked before. Why is an installed llvm-lit importing something from the source directory? Is it by design? Does this mean one cannot run `check-polly` from a distribution-supplied LLVM?


https://reviews.llvm.org/D33299





More information about the llvm-commits mailing list