YCM-Generator
YCM-Generator copied to clipboard
Package not found via config_gen
CMake can find X11 package but not ycm-generator
I have a minimal X11 project using cmake. I can successfully the project using cmake followed by make. When ycm-generator does the same, it is unable to find X11 package.
command used for ycm-generator
~/.vim/bundle/YCM-Generator/config_gen.py --verbose --compiler /home/akshit/dotfiles/faaltu/clang+llvm/bin/clang .
Output from ycm-generator
$ cmake /home/akshit/Projects/016_X11_hello_world
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: /home/akshit/.vim/bundle/YCM-Generator/fake-toolchain/Unix/clang
-- Check for working C compiler: /home/akshit/.vim/bundle/YCM-Generator/fake-toolchain/Unix/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting C compile features
-- Detecting C compile features - failed
-- Check for working CXX compiler: /home/akshit/.vim/bundle/YCM-Generator/fake-toolchain/Unix/clang++
-- Check for working CXX compiler: /home/akshit/.vim/bundle/YCM-Generator/fake-toolchain/Unix/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Detecting CXX compile features
-- Detecting CXX compile features - failed
CMake Error at /usr/share/cmake-3.5/Modules/FindX11.cmake:439 (message):
Could not find X11
Call Stack (most recent call first):
CMakeLists.txt:9 (find_package)
-- Configuring incomplete, errors occurred!
See also "/tmp/tmpPJmZJt/CMakeFiles/CMakeOutput.log".
See also "/tmp/tmpPJmZJt/CMakeFiles/CMakeError.log".
Running make...
$ make -i -j12
make: *** No targets specified and no makefile found. Stop.
Cleaning up...
Build completed in 0.38 sec
Collected 0 relevant entries for C compilation (0 discarded).
Collected 0 relevant entries for C++ compilation (0 discarded).
ERROR: No commands were logged to the build logs (C: /tmp/tmpBUv4Kz, C++: /tmp/tmp4rRmyb).
Your build system may not be compatible.
Output from cmake for building project
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/akshit/Projects/016_X11_hello_world/build
Currently my cmake file contains
cmake_minimum_required(VERSION 3.2)
project(x11_world)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(X11 REQUIRED)
include_directories(${X11_INCLUDE_DIR})
add_executable(x11_world main.cpp)
target_link_libraries(x11_world ${X11_LIBRARIES} )
Can you help me generating the ycm files for the project ?
Thanks
Running config_gen.py in that repository works for me. Are you using the latest stable version? Also, are you relying on any environment variables to enable cmake to determine the path to X11?
I have the latest stable version. My CMakeLists.txt file does not depend on any environment (from my side) for determining X11. Can you please confirm command used for running config_gen.py?
- Is it just
config_gen.py --verbose .from the parent directory of the project? - I updated the project CMakeLists.txt, can you please tell me the output cmake file created when ran through config_gen.py?
Thank you
Is it just config_gen.py --verbose . from the parent directory of the project?
Yep, that command is executed from the same directory containing CMakeLists.txt
I updated the project CMakeLists.txt, can you please tell me the output cmake file created when ran through config_gen.py?
YCM-Gen will run cmake in a (randomly named) temporary directory, which is cleaned up upon completion. In the example above, it was /tmp/tmpPJmZJt
Currently, I am able to understand why it is giving me an error.
For some reason when I run through config_gen.py, The FindX11 does not search for library inside /usr/lib/x86_64-linux-gnu/ but when I run cmake from terminal or from subprocess (in python), the same FindX11 file can find X11 libraries in /usr/lib/x86_64-linux-gnu/.
Do you have any clue as to why this may happen?