[cfe-dev] How to build a clang-tool out of the build tree?

Laurent Thévenoux via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 16 04:49:42 PST 2019


Hi,

  thanks everyone for you help!

Kim, your solution looks hopeful, unfortunately it seems to not work anymore, since it fails on travis with the following message:

```
$ cmake -GNinja -DCMAKE_PREFIX_PATH=$ROOT_PATH -DCMAKE_C_COMPILER=$BIN_PATH/clang -DCMAKE_CXX_COMPILER=$BIN_PATH/clang++ -DCMAKE_INSTALL_PREFIX=./ ../
295-- IWYU: out-of-tree configuration
296-- The C compiler identification is Clang 10.0.0
297-- The CXX compiler identification is Clang 10.0.0
298-- Check for working C compiler: /usr/lib/llvm-10/bin/clang
299-- Check for working C compiler: /usr/lib/llvm-10/bin/clang -- works
300-- Detecting C compiler ABI info
301-- Detecting C compiler ABI info - done
302-- Detecting C compile features
303-- Detecting C compile features - done
304-- Check for working CXX compiler: /usr/lib/llvm-10/bin/clang++
305-- Check for working CXX compiler: /usr/lib/llvm-10/bin/clang++ -- works
306-- Detecting CXX compiler ABI info
307-- Detecting CXX compiler ABI info - done
308-- Detecting CXX compile features
309-- Detecting CXX compile features - done
316CMake Error at /usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake:1344 (message):
317  The imported target "ExampleIRTransforms" references the file
318
319     "/usr/lib/llvm-10/lib/libExampleIRTransforms.a"
320
321  but this file does not exist.  Possible reasons include:
322
323  * The file was deleted, renamed, or moved to another location.
324
325  * An install or uninstall procedure did not complete successfully.
326
327  * The installation package was faulty and contained
328
329     "/usr/lib/llvm-10/lib/cmake/llvm/LLVMExports.cmake"
330
331  but not all the files it references.
332
333Call Stack (most recent call first):
334  /usr/lib/llvm-10/cmake/LLVMConfig.cmake:256 (include)
335  CMakeLists.txt:15 (find_package)
336
337
338-- Configuring incomplete, errors occurred!
339See also "/home/travis/build/thvnx/clang-fco/build/CMakeFiles/CMakeOutput.log".
340The command "cmake -GNinja -DCMAKE_PREFIX_PATH=$ROOT_PATH -DCMAKE_C_COMPILER=$BIN_PATH/clang -DCMAKE_CXX_COMPILER=$BIN_PATH/clang++ -DCMAKE_INSTALL_PREFIX=./ ../" exited with 1.
```

(I’ve double-checked with a clone of your repo) Any idea?

Laurent 

> Le 16 nov. 2019 à 11:40, Kim Gräsman <kim.grasman at gmail.com> a écrit :
> 
> If the straight line tutorials end up not working, you may be able to find some inspiration for workarounds in IWYU:
> https://github.com/include-what-you-use/include-what-you-use/blob/master/CMakeLists.txt
> 
> And:
> https://github.com/include-what-you-use/include-what-you-use/blob/master/.travis.yml
> 
> - Kim 
> 
> On Wed, Nov 13, 2019, 17:26 Laurent Thévenoux via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> Hi,
> 
> I’m trying to develop a clang-tool, following such kind of tutorial : https://clang.llvm.org/docs/LibASTMatchersTutorial.html.
> 
> I’m using GitHub with Travis-CI and I can’t build clang/llvm on Travis because of the free-plan constraints. I’m wondering if it is possible to build such a tool without having to build clang/llvm, i.e., is there a way to simply install clang (from any package manager) with its LibTooling and LibASTMatchers, to which I could link my tool with?
> 
> Regards,
> Laurent
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list