kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.42k stars 979 forks source link

fast_data_types.so: undefined symbol: XCreateIC #176

Closed wtjcn closed 6 years ago

wtjcn commented 6 years ago

on ubuntu 16.04 , x86-64bit OS, after build, run then error: /kitty-0.5.0$ python3 . Traceback (most recent call last): File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "./main.py", line 14, in from kitty.main import main File "./kitty/main.py", line 13, in from .boss import Boss File "./kitty/boss.py", line 8, in from .config import MINIMUM_FONT_SIZE File "./kitty/config.py", line 14, in from . import fast_data_types as defines ImportError: ./kitty/fast_data_types.so: undefined symbol: XCreateIC

kovidgoyal commented 6 years ago

You are missing the x11 xim library (dont remember what it is called exectly) which is one of the dependencies of glfw. Install it and you should be fine.

kovidgoyal commented 6 years ago

Actually that symbol is in libx11 itself, so you appear to be missing that entirely.

readelf --syms /usr/lib/libX11.so| grep XCreateIC                                                   
   716: 000000000004eed0   339 FUNC    GLOBAL DEFAULT   12 XCreateIC
wtjcn commented 6 years ago

I of cause have libX11.so,and see XCreateIC in it with readelf, and have other program use glfw library, and have input function in such as nanogui(it use glfw), they run without error. I installed uim-xim package, but the error is still there.

kovidgoyal commented 6 years ago

Then I am out of ideas, sorry. You can try using LD_DEBUG to get more information.

wtjcn commented 6 years ago

LD_DEBUG show: 31550: binding file ./kitty/fast_data_types.so [0] to python3 [0]: normal symbol `PyModule_AddObject' 31550: symbol=XCreateIC; lookup in file=python3 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libpthread.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libdl.so.2 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libutil.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libexpat.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libz.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libm.so.6 [0] 31550: symbol=XCreateIC; lookup in file=/lib64/ld-linux-x86-64.so.2 [0] 31550: symbol=XCreateIC; lookup in file=./kitty/fast_data_types.so [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/librt.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libc.so.6 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libpthread.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libdl.so.2 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libm.so.6 [0] 31550: symbol=XCreateIC; lookup in file=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 [0] 31550: symbol=XCreateIC; lookup in file=/usr/lib/x86_64-linux-gnu/libfontconfig.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/usr/lib/x86_64-linux-gnu/libfreetype.so.6 [0] 31550: symbol=XCreateIC; lookup in file=/usr/local/lib/libharfbuzz.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libpng12.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/usr/lib/x86_64-linux-gnu/libunistring.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libz.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib64/ld-linux-x86-64.so.2 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libexpat.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libutil.so.1 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libglib-2.0.so.0 [0] 31550: symbol=XCreateIC; lookup in file=/lib/x86_64-linux-gnu/libpcre.so.3 [0] 31550: ./kitty/fast_data_types.so: error: symbol lookup error: undefined symbol: XCreateIC (fatal)

is this because there is not '-lX11' in setup.py? I add ldflags.append('-lX11') in setup.py, and see gcc use it in last link step, but the error is still there.

kovidgoyal commented 6 years ago

XCreateIC is not used in kitty code anywhere. The only place it is used that I know of is in glfw. Why ld on your system is trying to resolve it when loading fast_data_types.so I have no idea. For instance doing

readelf --syms kitty/fast_data_types.so | grep XCreate

has no matches

wtjcn commented 6 years ago

I have matches: $ readelf --syms fast_data_types.so | grep XCreate 3: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateIC 14: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateFontCursor 106: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateWindow 116: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateColormap 2030: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateIC 2046: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateFontCursor 2194: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateWindow 2208: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND XCreateColormap

wtjcn commented 6 years ago

I have a warning in the last link step, I don't know if this have some relation with the problem inlined from ‘io_loop’ at /home/wtj/src/kitty-0.5.0/kitty/child-monitor.c:785:13: /usr/include/x86_64-linux-gnu/bits/poll2.h:41:9: warning: call to ‘poll_chk_warn’ declared with attribute warning: poll called with fds buffer too small file nfds entries return poll_chk (fds, nfds, timeout, bos (__fds)); ^

kovidgoyal commented 6 years ago

No it does not. And if you are getting symbol linkages in fast_data_types then some pkg-config file on your system is specifying -lX11 in the libs. Probably glfw or gl.

wtjcn commented 6 years ago

I use 'readelf' test on every fast_data_types-*.c.o , not find any XCreate

wtjcn commented 6 years ago

I fixed it by change setup.py at line 195: ldpaths = pylib + font_libs + glfw_ldflags + libpng + [ '-lunistring','-lX11', '-lXrandr','-lXinerama','-lXxf86vm','-lXcursor' ]

I copy this librarys from glfw example's make file

kovidgoyal commented 6 years ago

That's just weird, there should be absolutely no need to linka gainst X11 libraries, as kitty code does not use anything from X11 libraries.