CodeLite 12.0 install clang

CodeLite installation/troubleshooting forum
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

CodeLite 12.0 install clang

Post by intord »

Hi all, this question was probably discussed, but all suggestions so far did not work.

So i install a 12.0 tar.gz on Gentoo.
clang with lldb is installed as a dependency:

Code: Select all

gentoo@gentoo ~ $ sudo emerge -s clang
  
[ Results for search key : clang ]
Searching...

*  sys-devel/clang
      Latest version available: 6.0.0-r1
      Latest version installed: 6.0.0-r1
      Size of files: 12,520 KiB
      Homepage:      https://llvm.org/
      Description:   C language family frontend for LLVM
      License:       UoI-NCSA

located at

Code: Select all

gentoo@gentoo ~ $ sudo find /usr/ -name libclang.so
/usr/lib64/llvm/6/lib64/libclang.so
sasha@gentoo ~ $ 
same are for lldb:

Code: Select all

gentoo@gentoo ~ $ sudo emerge -s lldb
                                                                                                                                     
[ Results for search key : lldb ]                                                                                                    
Searching...                                                                                                                         
                                                                                                                                     
*  dev-util/lldb                                                                                                                     
      Latest version available: 6.0.0                                                                                                
      Latest version installed: 6.0.0                                                                                                
      Size of files: 18,866 KiB                                                                                                      
      Homepage:      https://llvm.org/                                                                                               
      Description:   The LLVM debugger
      License:       UoI-NCSA

however when the package is unpacked and ready to build, the following lines come up:

Code: Select all

-- OS_CODENAME is set to 
-- ARCH 64
-- ARCH_NAME x86_64
-- *** NOTICE ***: clang code completion support is disabled
-- *** NOTICE ***: On Ubuntu / Debian you might want to install libclang-3.4-dev package
-- USE_SFTP is set to 1
-- Found wxWidgets: -L/usr/lib64;-pthread;;;-lwx_gtk2u_core-3.0;-lwx_baseu-3.0 (found version "3.0.3") 
--
when package is built Clang tab in settings is disabled.
may be clang should be built some special flags?

also http://codelite.org/Developers/BuildingClang it said:

Code: Select all

When the compilation is over, locate libclang.so and copy it to its proper location /path/to/codelite/sdk/clang
however there is no folder '/sdk/clang' after install.

my cmake params look like this:

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG=1 -DWITH_MYSQL=1 -DCL_PREFIX=/opt/${P} .. -DCOPY_WX_LIBS=1
basically i want it to install to /opt/codelite-12.0/

any other suggestions?
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: CodeLite 12.0 install clang

Post by DavidGH »

Hi,

I think you'll find this is fixed in git by commit 5c2eb47b2 which added llvm versions 5 and 6 support to the cmake module that searches for libclang.so. So either build the latest version, or hack in its cmake/Modules/FindLibClang.cmake to your 12.0 install.

Regards,

David
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: CodeLite 12.0 install clang

Post by intord »

OK will try the new build as I tried to add "/usr/lib64/llvm/6/lib64/" to FindLibClang.cmake (after 2 lines marked for Fedora), however still same thing.
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: CodeLite 12.0 install clang

Post by intord »

well downloaded zip from github, extracted and tried to compile - same thing.
added explicit direction of this library which is /usr/lib64/llvm/6/lib64/

Code: Select all

 2     macro( FIND_LIBCLANG_OFFICIAL )
 3         find_library(LIBCLANG_T
 4                      NAMES libclang.so
 5                      HINTS
 6                      /usr/lib
 7                      /usr/local/lib
 8                      /usr/lib/llvm-6.0/lib
 9                      /usr/lib/llvm-5.0/lib
10                      /usr/lib/llvm-4.2/lib
11                      /usr/lib/llvm-4.1/lib
12                      /usr/lib/llvm-4.0/lib
13                      /usr/lib/llvm-3.8/lib
14                      /usr/lib/llvm-3.9/lib
15                      /usr/lib/llvm-3.7/lib
16                      /usr/lib/llvm-3.6/lib
17                      /usr/lib/llvm-3.5/lib
18                      /usr/lib/llvm-3.4/lib
19                      /usr/lib/llvm-3.3/lib
20                      # For fedora
21                      /usr/lib/llvm
22                      /usr/lib64/llvm
23                      /usr/lib64/llvm/6/lib64/
24                      ${CMAKE_INSTALL_LIBDIR})

also saw somewhere in internet that library name must be actually without lib so should be

Code: Select all

 2     macro( FIND_LIBCLANG_OFFICIAL )
 3         find_library(LIBCLANG_T
 4                      NAMES clang.so

but no effect

tried to add PATHS before /usr/lib64/llvm/6/lib64/ same thing

actually commit you mention about new 5/6 version was done 2 weeks ago so i initially used it
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: CodeLite 12.0 install clang

Post by DavidGH »

That's disappointing. Unfortunately I don't use gentoo or have a gentoo Guest, so I can't test here.

One thing you could try is adding extra diagnostic 'message' statements to FindLibClang.cmake and/or the toplevel CMakeLists.txt.
Another is to hack harder: make FindLibClang.cmake return the correct results. Or hard-code them into CMakeLists.txt, though that would need to be done in several places.

BTW, from your initial post:
also http://codelite.org/Developers/BuildingClang it said:
When the compilation is over, locate libclang.so and copy it to its proper location /path/to/codelite/sdk/clang
however there is no folder '/sdk/clang' after install.
I think that page refers to the situation where a distro's clang is incompatible and you're building a different version. It shouldn't relevant to your situation, where it's (presumably) compatible but 'just' not discovered.
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: CodeLite 12.0 install clang

Post by intord »

last thing i tried is created a symlink of libclang.so in /usr/lib64/llvm - this dir was initially there however still same result
seems like something wrong is going on
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: CodeLite 12.0 install clang

Post by DavidGH »

I've now created a virtualbox guest of Sabayon, which should be sufficiently similar to your Gentoo system to be useful. It's also different; despite emerging clang 6.0.0-r1 my libclang.so is in /usr/lib64/llvm/5/lib64/ and my clang-c/Index.h in /usr/lib64/llvm/5/include :/ Of course these weren't searched either, so detection failed.
last thing i tried is created a symlink of libclang.so in /usr/lib64/llvm - this dir was initially there however still same result
seems like something wrong is going on
Did you first delete your <builddir>/CMakeCache.txt? I was bitten by that at first; it caches the results of previous find_library calls.

For me, inserting the relevant paths into the module worked. However an easier fix is to add them to the cmake invocation. Here that meant adding the following: for you presumably s/5/6/g

Code: Select all

-DCMAKE_PREFIX_PATH="/usr/lib64/llvm/5/lib64;/usr/lib64/llvm/5/include/"
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: CodeLite 12.0 install clang

Post by intord »

well after clang install

Code: Select all

/usr/lib64/llvm/6
is added to the PATH so i do not see why you should add it twice

so can you post your working FindCLangLib.cmake ?
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: CodeLite 12.0 install clang

Post by DavidGH »

/usr/lib64/llvm/6 is added to the PATH so i do not see why you should add it twice
But your libclang.so is not in /usr/lib64/llvm/6/, it's in /usr/lib64/llvm/6/lib64/; and afaict find_library() doesn't recurse.
can you post your working FindCLangLib.cmake ?
In the end I didn't need to change it. The extra define suffices. So, assuming /usr/lib64/llvm/6/include/clang-c/Index.h exists, your compile line would be:

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CLANG=1 -DCMAKE_PREFIX_PATH="/usr/lib64/llvm/6/lib64;/usr/lib64/llvm/6/include/" -DWITH_MYSQL=1 -DCL_PREFIX=/opt/${P} .. -DCOPY_WX_LIBS=1
If you prefer to change the module, just add /usr/lib64/llvm/6/lib64/ to the find_library() HINTS and /usr/lib64/llvm/6/include/ to find_path.
intord
CodeLite Curious
Posts: 6
Joined: Mon May 21, 2018 3:11 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: CodeLite 12.0 install clang

Post by intord »

ok i see now thanks
Post Reply