Bug 389473 - Clang plugin error with latest versions
Summary: Clang plugin error with latest versions
Status: REOPENED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-26 17:17 UTC by Jeff Trull
Modified: 2019-01-04 19:15 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
attachment-26738-0.html (1.73 KB, text/html)
2018-01-28 17:56 UTC, Jeff Trull
Details
Compile process output (1.64 MB, text/plain)
2018-04-02 04:09 UTC, Tam HANNA
Details
LLVM build one (1.64 MB, text/plain)
2018-04-03 19:35 UTC, Tam HANNA
Details
Second LLVM build attempt (1.65 MB, text/plain)
2018-04-03 22:22 UTC, Tam HANNA
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Trull 2018-01-26 17:17:55 UTC
Clazy 1.3 with Clang 7.0 produces a plugin-related error when I try to run using the non-standalone (i.e. QMAKE_CXX=clazy) version:

clazy -c -pipe -O2 -std=c++1y -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/home/jet/Qt5.5.1.clang/include -I/home/jet/Qt5.5.1.clang/include/QtGui -I/home/jet/Qt5.5.1.clang/include/QtCore -I. -I/home/jet/Qt5.5.1.clang/mkspecs/linux-clang -o foo.o ../../foo.cpp

: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-7.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)

Clang runs fine on its own.
Comment 1 Sergio Martins 2018-01-28 12:55:47 UTC
Which distro ?
Comment 2 Jeff Trull 2018-01-28 16:10:26 UTC
   This is a full source build...
Comment 3 Sergio Martins 2018-01-28 17:05:50 UTC
which cmake configure line ?
Comment 4 Jeff Trull 2018-01-28 17:56:01 UTC
Created attachment 110184 [details]
attachment-26738-0.html

cmake -DLLVM_ROOT=/home/jet/oss/llvm/build

where /home/jet/oss/llvm is svn head as of a week ago. 

    On Sunday, January 28, 2018 9:05 AM, Sergio Martins <bugzilla_noreply@kde.org> wrote:
 

 https://bugs.kde.org/show_bug.cgi?id=389473

--- Comment #3 from Sergio Martins <smartins@kde.org> ---
which cmake configure line ?
Comment 5 Jeff Trull 2018-01-28 18:12:00 UTC
Perhaps it is a simple matter of testing the libTooling version in CMake, since the API is unstable (assuming you are expecting a particular LLVM release)...
Comment 6 Tam HANNA 2018-01-28 22:22:16 UTC
Hello,
sitting here on Ubuntu 14.04, want to confirm problem.

Clang built from Git tonight:
t@T14:~/clazyspace/llvm$ sudo apt-get remove clang llvm
t@T14:~/clazyspace/llvm$ mkdir build
t@T14:~/clazyspace/llvm/build$ cmake -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release ..
t@T14:~/clazyspace/llvm/build$ make -j 10
t@T14:~/clazyspace/llvm/build$ sudo make install


Same for clazy:
tamhan@TAMHAN14:~/clazyspace/$ git clone https://github.com/KDE/clazy
tamhan@TAMHAN14:~/clazyspace/clazy$ git checkout -b 1.3
Switched to a new branch '1.3'
tamhan@TAMHAN14:~/clazyspace/clazy$ cmake -DCMAKE_BUILD_TYPE=Release
tamhan@TAMHAN14:~/clazyspace/clazy$ make -j 10
tamhan@TAMHAN14:~/clazyspace/clazy$ sudo make install

Same error as the reporter
Comment 7 Tam HANNA 2018-01-28 22:25:17 UTC
Forgot to add that changing the cmake command for clazy does not help:
tamhan@TAMHAN14:~/clazyspace/clazy$ cmake -DCMAKE_BUILD_TYPE=Release -DCLAZY_BUILD_WITH_CLANG=true
Looking for std::regex support...
old-style-connect check is disabled due to missing std::regex support
Suppressions are disabled due to missing std::regex support
CMake Error at CMakeLists.txt:271 (add_clang_library):
  Unknown CMake command "add_clang_library".


-- Configuring incomplete, errors occurred!
See also "/home/tamhan/clazyspace/clazy/CMakeFiles/CMakeOutput.log".


Version info:

tamhan@TAMHAN14:~/clazyspace/clazy$ cmake -version
cmake version 3.4.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
Comment 8 Sergio Martins 2018-01-28 23:11:58 UTC
Can you try compiling clang/llvm with -DBUILD_SHARED_LIBS=ON ?
Comment 9 Jeff Trull 2018-01-29 06:01:26 UTC
Rebuilding clang with -DBUILD_SHARED_LIBS=ON and then rebuilding clazy results in a slightly different error message:

: CommandLine Error: Option 'help-list' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Comment 10 Tam HANNA 2018-01-29 18:18:39 UTC
Hello Folks,
do you think that using an older version of CLANG would work?

I am on an AMD octacore workstation, so recompiling code is not a big issue for me.

Tam
Comment 11 Sergio Martins 2018-01-29 18:27:21 UTC
Sure, I'm using clang 5.0.1.
Try to stick to released versions of clang, as sometimes stuff breaks with latest release
Comment 12 Jeff Trull 2018-01-29 19:09:02 UTC
IMO an acceptable resolution would be to add an LLVM version check ("clazy has  only been tested with versions X, Y, or Z") etc.
Comment 13 Tam HANNA 2018-01-30 08:43:37 UTC
Hello,
just started fighting Git to get the correct version. This makes me miss SourceSafe and CVS/SVN. But I will report in again...
Comment 14 Tam HANNA 2018-01-30 10:15:42 UTC
Hello,
sadly no change to the error. It now looks like this:
tamhan@TAMHAN14:~/Desktop/deadstuff/2018Jan/HeiseClazy/QtTypeGun2$ clazy main.cpp
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-5.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 5.0.1 (https://github.com/llvm-mirror/clang.git 9fc5dfce8e15fd7b3ffe657278c045ee5471d26f) (https://github.com/llvm-mirror/llvm.git 1368f4044e62cad4316da638d919a93fd3ac3fe6)
Comment 15 Sergio Martins 2018-03-28 21:59:59 UTC
I've tested clazy with llvm 5.0, 6.0 and 7.0 build from source and it's working fine when using shared libraries, my llvm cmake line is:

cmake -DCMAKE_INSTALL_PREFIX=/data/prefix/clang-7.0 -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..

When building clazy be sure to not build it with clang-7.0, but with gcc, or with clang < 7.0. It appears clang-7.0 is generating buggy code which crashes the compiler

Also investigated the static-build, what's happening is that too many libs are being linked, so some options are duplicated, which gives this error
Comment 16 Tam HANNA 2018-03-31 12:03:39 UTC
Hello,
thank you so much for talking back. Sadly, the program still fails:

tamhan@TAMHAN14:~/clazyspace/clazy$ clazy main.cpp 
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)


My command sequence for building is like this:

sudo apt-get remove cmake
wget http://www.cmake.org/files/v3.11/cmake-3.11.0.tar.gz 
tar -xvzf cmake-3.11.0.tar.gz 
cd cmake-3.11.0/ 
./configure 
make  -j 10
sudo make install 
cd ..


git clone https://github.com/llvm-mirror/llvm.git
cd llvm/
git checkout remotes/origin/release_60
cd tools
git clone https://github.com/llvm-mirror/clang.git
cd clang
git checkout remotes/origin/release_60
cd ..
cd ..
cd projects
git clone https://github.com/llvm-mirror/compiler-rt.git
cd ..
sudo apt-get remove clang llvm
mkdir build
cd build
cmake -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release ..
make -j 10
sudo make install
cd ..
cd ..



git clone https://github.com/KDE/clazy
cd clazy
cmake -DCMAKE_BUILD_TYPE=Release

OR

cmake -DCMAKE_INSTALL_PREFIX=/data/prefix/clang-6.0 -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install
Comment 17 Sergio Martins 2018-04-01 14:45:55 UTC
That error is when using the static one, what's the actual error when using -DBUILD_SHARED_LIBS=ON ?

Also please paste the cmake output when building clazy itself with the dynamically linked llvm
Comment 18 Tam HANNA 2018-04-02 04:09:20 UTC
Created attachment 111778 [details]
Compile process output
Comment 19 Tam HANNA 2018-04-02 04:10:00 UTC
Hello,
thank you so much for your swift reply.

I tried both compile variants and got the same error. The compile process log is attached as a Attachment!

Tam
Comment 20 Sergio Martins 2018-04-02 09:24:11 UTC
Interesting, looks like your LLVM is dynamic, but your clang is static:

 LLVM libraries: -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMFuzzMutate -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMLineEditor -lLLVMOrcJIT -lLLVMCoverage -lLLVMMIRParser -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle
--   LLVM System libraries: -lz -lrt -ldl -ltinfo -lpthread -lm
-- Found Clang (LLVM version: 6.0.0)
--   Include dirs:       /usr/local/include
--   Clang libraries:    /usr/local/lib/libclangFrontend.a;/usr/local/lib/libclangDriver.a;/usr/local/lib/libclangCodeGen.a;/usr/local/lib/libclangSema.a;/usr/local/lib/libclangAnalysis.a;/usr/local/lib/libclangRewriteFrontend.a;

Both must be dynamic
Comment 21 Tam HANNA 2018-04-03 10:09:18 UTC
Hello Sergio,
thank you so much for your swift reply and the continuous willingness to help me.

This is the build sequence I use:
echo "Now working on LLVM"
git clone https://github.com/llvm-mirror/llvm.git
cd llvm/
git checkout remotes/origin/release_60
cd tools
git clone https://github.com/llvm-mirror/clang.git
cd clang
git checkout remotes/origin/release_60
cd ..
cd ..
cd projects
git clone https://github.com/llvm-mirror/compiler-rt.git
cd ..
sudo apt-get remove clang llvm
mkdir build
cd build
cmake -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_BUILD_TYPE=Release .. 
make -j 10
sudo make install
cd ..
cd ..


Can you please tell me what to change? I am sorry, but I am a bit at my wit's end here at the moment.
Comment 22 Tam HANNA 2018-04-03 10:25:29 UTC
Hello Sergio,
just to let you know - I am now running two compiles as per the following instructions:
BUILD_SHARED_LIBS:BOOL

    Flag indicating if each LLVM component (e.g. Support) is built as a shared library (ON) or as a static library (OFF). Its default value is OFF. On Windows, shared libraries may be used when building with MinGW, including mingw-w64, but not when building with the Microsoft toolchain.

    Note

    BUILD_SHARED_LIBS is only recommended for use by LLVM developers. If you want to build LLVM as a shared library, you should use the LLVM_BUILD_LLVM_DYLIB optio

I expect to know more in a few hours...octacore AMD CPU hard at work.
Comment 23 Tam HANNA 2018-04-03 19:35:40 UTC
Hello,
first, I tried this:
. . .
cd build
cmake -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_LLVM_DYLIB=ON -DCMAKE_BUILD_TYPE=Release .. 
make -j 10
. . .

To get the build result in the file llvmbuildllvmdylib.txt 

And it still didnt work out:
tamhan@TAMHAN14:~/clazyspace$ clazy main.cpp 
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Comment 24 Tam HANNA 2018-04-03 19:35:57 UTC
Created attachment 111805 [details]
LLVM build one
Comment 25 Sergio Martins 2018-04-03 19:51:50 UTC
Hi, This last attachment still shows that clang is built statically:
Clang libraries:    /usr/local/lib/libclangFrontend.a;

note the .a file, instead of .so.

Using -DBUILD_SHARED_LIBS=ON should make both llvm and clang use .so files
Comment 26 Tam HANNA 2018-04-03 22:22:02 UTC
Hello Sergio,
thank you so much. Sadly, this still does not do it. Now I used the following configuration:
cd build
cmake -DLLVM_TARGETS_TO_BUILD=X86 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. 
make -j 10

Sadly, the error remains. I will upload the build log in a second.
Comment 27 Tam HANNA 2018-04-03 22:22:20 UTC
Created attachment 111807 [details]
Second LLVM build attempt
Comment 28 Sergio Martins 2018-04-03 22:47:54 UTC
That's almost perfect, I would just suggest that you install clazy to LLVM's prefix, instead of /data/prefix/clang-6.0/. Seems to be /usr/local/

Now, when running clazy it just needs to find it's ClangLazy.so library, you can do it via export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH, or wherever it is
Comment 29 Tam HANNA 2018-04-10 18:40:26 UTC
Hello Sergio,
thank you so much for your swift response, and sorry for being slow - I was overworked. 

But you now you catch me out of my league. Should I modify the compile, or simply sent the environment variable before invoking clazy?

Tam
Comment 30 Sergio Martins 2018-04-10 19:06:07 UTC
Before invoking clazy, it seems to be a runtime problem now
Comment 31 Tam HANNA 2018-04-21 11:23:10 UTC
Hello Sergio,
sorry for being away so long, and thank you for your help so far - I was held up by another customer. Now, I got back to the problem. 


Now, I tried this:
tamhan@TAMHAN14:~/clazyspace$ export LD_LIBRARY_PATH=/data/prefix/clang-6.0/lib/:$LD_LIBRARY_PATH
tamhan@TAMHAN14:~/clazyspace$ clazy main.cpp 
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)

Very oddly, the library is right there:
tamhan@TAMHAN14:/data/prefix/clang-6.0/lib$ ls
ClangLazy.so

And the variable points at it:
tamhan@TAMHAN14:/data/prefix/clang-6.0/lib$ echo $LD_LIBRARY_PATH 
/data/prefix/clang-6.0/lib/:
Comment 32 Sergio Martins 2018-09-20 17:49:58 UTC
These commits fix the "CommandLine Error: Option 'help-list' registered more than once!"

commit c650de49e3bdcb6f2116c0a0f76e1924615f48f6 (origin/1.3, 1.3)
Author: Sergio Martins <iamsergio@gmail.com>
Date:   Thu Sep 20 15:05:33 2018 +0100

    Require cmake 3.3 as minimum
    
    This amends the previous commit.
    Linking full path needs 3.3 as minimum, probably so CMP0060 is enabled.

commit 53317a88b3930ad6b3a26b8e0df021a485fef802
Author: Sergio Martins <smartins@kde.org>
Date:   Wed Sep 19 23:07:07 2018 +0100

    Link against full paths instead of -lfoo
    
    Fixes clazy linking against system libraries when it was told to use
    a LLVM from prefix
Comment 33 Tam HANNA 2018-10-23 11:16:48 UTC
Hello,
sadly, the error still occurs:
tamhan@TAMHAN14:~/clazyspace$ clazy main.cpp 
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 6.0.1 (https://github.com/llvm-mirror/clang.git 2f27999df400d17b33cdd412fdd606a88208dfcc) (https://github.com/llvm-mirror/llvm.git 5136df4d089a086b70d452160ad5451861269498)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-6.0: note: diagnostic msg: Error generating preprocessed source(s).
Comment 34 Tam HANNA 2018-10-23 11:17:53 UTC
Hello,
and here is the verbose output:
tamhan@TAMHAN14:~/clazyspace$ clazy  main.cpp -v
clang version 6.0.1 (https://github.com/llvm-mirror/clang.git 2f27999df400d17b33cdd412fdd606a88208dfcc) (https://github.com/llvm-mirror/llvm.git 5136df4d089a086b70d452160ad5451861269498)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/local/bin/clang-6.0" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/6.0.1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/x86_64-linux-gnu/c++/6.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/x86_64-linux-gnu/c++/6.4.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.4.0/../../../../include/c++/6.4.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/6.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/tamhan/clazyspace -ferror-limit 19 -fmessage-length 171 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -load ClangLazy.so -add-plugin clang-lazy -o /tmp/main-b2b500.o -x c++ main.cpp
: CommandLine Error: Option 'static-func-full-module-prefix' registered more than once!
fatal error: error in backend: inconsistency in registered CommandLine options
clang-6.0: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 6.0.1 (https://github.com/llvm-mirror/clang.git 2f27999df400d17b33cdd412fdd606a88208dfcc) (https://github.com/llvm-mirror/llvm.git 5136df4d089a086b70d452160ad5451861269498)
Comment 35 Sergio Martins 2018-11-16 12:42:24 UTC
Git commit 39005c8e2d844c234efa52fc20b350f5fb5812c3 by Sergio Martins.
Committed on 16/11/2018 at 12:42.
Pushed by smartins into branch '1.4'.

README: Mention how to workaround "option foo registered more than once"

M  +7    -1    README.md

https://commits.kde.org/clazy/39005c8e2d844c234efa52fc20b350f5fb5812c3
Comment 36 Sergio Martins 2018-11-16 12:44:06 UTC
This is now be fixed in latest 1.4 and master branches.

If your LLVM is static (*.a files instead of .so) you'll need to build clazy with  -DLINK_TO_LLVM=OFF , if that doesn't work for you then there's no other solution than using .so files (dynamically linked LLVM)
Comment 37 Tam HANNA 2019-01-04 19:14:36 UTC
Hello,
sadly, it still does not fully work. I ran the build script with the contents I will post soon, and got this:
root@TAMHAN14:~/clazyspace# touch x.cpp
root@TAMHAN14:~/clazyspace# clazy x.cpp -v
clang version 7.0.1 (https://github.com/llvm-mirror/clang.git 4519e2637fcc4bf6e3049a0a80e6a5e7b97667cb) (https://github.com/llvm-mirror/llvm.git cd98f42d0747826062fc3d2d2fad383aedf58dd6)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
 "/usr/local/bin/clang-7" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name x.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -v -resource-dir /usr/local/lib/clang/7.0.1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/x86_64-linux-gnu/c++/6.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/x86_64-linux-gnu/c++/6.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/7.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/tamhan/clazyspace -ferror-limit 19 -fmessage-length 205 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -load ClazyPlugin.so -add-plugin clazy -o /tmp/x-8ff6e6.o -x c++ x.cpp -faddrsig
clang -cc1 version 7.0.1 based upon LLVM 7.0.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/x86_64-linux-gnu/c++/6.5.0"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0
 /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/x86_64-linux-gnu/c++/6.5.0
 /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../../include/c++/6.5.0/backward
 /usr/local/include
 /usr/local/lib/clang/7.0.1/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
 "/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/6.5.0/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/6.5.0 -L/usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../.. -L/usr/local/bin/../lib -L/lib -L/usr/lib /tmp/x-8ff6e6.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/6.5.0/crtend.o /usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 21
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/6.5.0/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)



Oddly, it looks like the standalone version seems to work:
root@TAMHAN14:~/clazyspace# clazy-standalone main.cpp 
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "main.cpp"
No compilation database found in /home/tamhan/clazyspace or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
Comment 38 Tam HANNA 2019-01-04 19:15:01 UTC
Hello,
and here is the build script I used:

echo "Now working on CMAKE"
sudo apt-get remove cmake
wget http://www.cmake.org/files/v3.11/cmake-3.11.0.tar.gz 
tar -xvzf cmake-3.11.0.tar.gz 
cd cmake-3.11.0/ 
./configure 
make  -j 10
sudo make install 
cd ..


echo "Now working on LLVM"
git clone https://github.com/llvm-mirror/llvm.git
cd llvm/
git checkout remotes/origin/release_70
cd tools
git clone https://github.com/llvm-mirror/clang.git
cd clang
git checkout remotes/origin/release_70
cd ..
cd ..
cd projects
git clone https://github.com/llvm-mirror/compiler-rt.git
cd ..
sudo apt-get remove clang llvm
mkdir build
cd build
cmake -DLLVM_TARGETS_TO_BUILD=X86 -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. 
make -j 10
sudo make install
cd ..
cd ..


echo "Now working on CLAZY"

git clone https://github.com/KDE/clazy
cd clazy
cmake -DLLVM_INCLUDE_EXAMPLES=OFF -DLINK_CLAZY_TO_LLVM=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
make -j 10
sudo make install