polybar / xpp

xpp - A C++11 RAII wrapper for XCB
Other
7 stars 11 forks source link

Unable to build if xcbgen is part of python 3 #2

Closed patrick96 closed 8 years ago

patrick96 commented 8 years ago

As I have already mentioned in https://github.com/jaagr/lemonbuddy/issues/58, xpp fails to build when xcbgen is part of python 3 and not python 2 (e.g. on arch). I have tracked down the issue to 1f1da8de30acd575e906dc731cc3337ab4e5d3f8. The reason that this commit breaks the build on arch is because before the location of xcbgen was hardcoded and arch users just had to change the path to work on their system by simply replacing python2.7 with python3.5 in the path, after that commit is that not possible anymore because of the python script that searches for the path using the python 2 executable, which will not yield any results if xcbgen is only available in python3. But we can also not change the line

find_package(PythonInterp 2.7 REQUIRED)

to

find_package(PythonInterp 3.5 REQUIRED)

because xpp needs python 2.

As I see it, there are three ways to resolve this:

  1. Revert back to hardcoding the path (not a very good idea)
  2. Hardcode a list of python executables, run the script to search for xcbgen with each of the executables and use the path the first successful execution gives us (slightly better idea)
  3. Somehow retrieve a list of all python executables in a system and run the script against each of them like in 2. (this is probably the best solution but I don't know how you would go about that in cmake)

I'm gonna try to go for the second option and just hardcoding the python, python2 and python3 executables which should be symlinked to the actual python executables (python2.7 etc) on most systems. I can't make any promises though, since I have never done anything with cmake.

For completion's sake, here is the log of running cmake ..; make after I had replaced

find_package(PythonInterp 2.7 REQUIRED)

with

find_package(PythonInterp 3.5 REQUIRED)

in the CMakeLists.txt:

-- The C compiler identification is GNU 6.1.1
-- The CXX compiler identification is GNU 6.1.1
-- 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
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'xcb-proto'
--   Found xcb-proto, version 1.12
-- Found PythonInterp: /usr/bin/python3.5 (found suitable version "3.5.2", minimum required is "3.5") 
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/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
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib64/libX11.so
-- Found X11_XCB: /usr/lib64/libX11-xcb.so  
-- XCB[XCB]: Found component XCB
-- Found XCB_XCB: /usr/lib64/libxcb.so  
-- XCB[COMPOSITE]: Found component COMPOSITE
-- Found XCB_COMPOSITE: /usr/lib64/libxcb-composite.so  
-- XCB[DAMAGE]: Found component DAMAGE
-- Found XCB_DAMAGE: /usr/lib64/libxcb-damage.so  
-- XCB[DRI2]: Found component DRI2
-- Found XCB_DRI2: /usr/lib64/libxcb-dri2.so  
-- XCB[EWMH]: Found component EWMH
-- Found XCB_EWMH: /usr/lib64/libxcb-ewmh.so  
-- XCB[GLX]: Found component GLX
-- Found XCB_GLX: /usr/lib64/libxcb-glx.so  
-- XCB[ICCCM]: Found component ICCCM
-- Found XCB_ICCCM: /usr/lib64/libxcb-icccm.so  
-- XCB[IMAGE]: Found component IMAGE
-- Found XCB_IMAGE: /usr/lib64/libxcb-image.so  
-- XCB[KEYSYMS]: Found component KEYSYMS
-- Found XCB_KEYSYMS: /usr/lib64/libxcb-keysyms.so  
-- XCB[RANDR]: Found component RANDR
-- Found XCB_RANDR: /usr/lib64/libxcb-randr.so  
-- XCB[RENDER]: Found component RENDER
-- Found XCB_RENDER: /usr/lib64/libxcb-render.so  
-- XCB[RENDERUTIL]: Found component RENDERUTIL
-- Found XCB_RENDERUTIL: /usr/lib64/libxcb-render-util.so  
-- XCB[SHAPE]: Found component SHAPE
-- Found XCB_SHAPE: /usr/lib64/libxcb-shape.so  
-- XCB[SHM]: Found component SHM
-- Found XCB_SHM: /usr/lib64/libxcb-shm.so  
-- XCB[SYNC]: Found component SYNC
-- Found XCB_SYNC: /usr/lib64/libxcb-sync.so  
-- XCB[UTIL]: Found component UTIL
-- Found XCB_UTIL: /usr/lib64/libxcb-util.so  
-- XCB[XFIXES]: Found component XFIXES
-- Found XCB_XFIXES: /usr/lib64/libxcb-xfixes.so  
-- XCB[XTEST]: Found component XTEST
-- Found XCB_XTEST: /usr/lib64/libxcb-xtest.so  
-- XCB[XV]: Found component XV
-- Found XCB_XV: /usr/lib64/libxcb-xv.so  
-- XCB[XINERAMA]: Found component XINERAMA
-- Found XCB_XINERAMA: /usr/lib64/libxcb-xinerama.so  
-- Found XCB: /usr/lib64/libxcb.so;/usr/lib64/libxcb-composite.so;/usr/lib64/libxcb-damage.so;/usr/lib64/libxcb-dri2.so;/usr/lib64/libxcb-ewmh.so;/usr/lib64/libxcb-glx.so;/usr/lib64/libxcb-icccm.so;/usr/lib64/libxcb-image.so;/usr/lib64/libxcb-keysyms.so;/usr/lib64/libxcb-randr.so;/usr/lib64/libxcb-render.so;/usr/lib64/libxcb-render-util.so;/usr/lib64/libxcb-shape.so;/usr/lib64/libxcb-shm.so;/usr/lib64/libxcb-sync.so;/usr/lib64/libxcb-util.so;/usr/lib64/libxcb-xfixes.so;/usr/lib64/libxcb-xtest.so;/usr/lib64/libxcb-xv.so;/usr/lib64/libxcb-xinerama.so  
-- xpp: including xcb proto bigreq.xml
-- xpp: including xcb proto composite.xml
-- xpp: including xcb proto damage.xml
-- xpp: including xcb proto dpms.xml
-- xpp: including xcb proto dri2.xml
-- xpp: including xcb proto dri3.xml
-- xpp: including xcb proto glx.xml
-- xpp: including xcb proto present.xml
-- xpp: including xcb proto randr.xml
-- xpp: including xcb proto record.xml
-- xpp: including xcb proto render.xml
-- xpp: including xcb proto res.xml
-- xpp: including xcb proto screensaver.xml
-- xpp: including xcb proto shape.xml
-- xpp: including xcb proto shm.xml
-- xpp: including xcb proto sync.xml
-- xpp: including xcb proto xc_misc.xml
-- xpp: including xcb proto xevie.xml
-- xpp: including xcb proto xf86dri.xml
-- xpp: including xcb proto xfixes.xml
-- xpp: including xcb proto xinerama.xml
-- xpp: including xcb proto xinput.xml
-- xpp: including xcb proto xkb.xml
-- xpp: including xcb proto xprint.xml
-- xpp: including xcb proto xproto.xml
-- xpp: including xcb proto xselinux.xml
-- xpp: including xcb proto xtest.xml
-- xpp: including xcb proto xv.xml
-- xpp: including xcb proto xvmc.xml
-- Configuring done
-- Generating done
-- Build files have been written to: /home/patrick96/Projects/github.com/jaagr/xpp/build
Scanning dependencies of target xpp
[100%] Linking CXX static library libxpp.a
Traceback (most recent call last):
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cpp_client.py", line 3191, in <module>
    module.generate()
  File "/usr/lib/python3.5/site-packages/xcbgen/state.py", line 108, in generate
    self.close()
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cpp_client.py", line 250, in c_close
    _h("%s", _cpp_request_objects[name].make_class())
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cpprequest.py", line 185, in make_class
    return cppreply.make() + "\n\n" + _reply_request_function(self.request_name)
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cppreply.py", line 137, in make
    self.cookie, "\n".join(accessors))
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cppreply.py", line 66, in _reply_class
    , cookie.make_static_getter()
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cppcookie.py", line 138, in make_static_getter
    default = self.static_reply_methods(self.protos(False, False), self.calls(False))
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/cppcookie.py", line 81, in protos
    return self.parameter_list.protos(sort, defaults)
  File "/home/patrick96/Projects/github.com/jaagr/xpp/generators/parameter.py", line 66, in protos
    return "" if len(protos) == 0 else ", ".join(protos)
TypeError: object of type 'map' has no len()
make[2]: *** [CMakeFiles/xpp.dir/build.make:70: libxpp.a] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/xpp.dir/all] Error 2
make: *** [Makefile:84: all] Error 2