kovidgoyal / kitty

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

Build Kitty from source on kubuntu 22.04 #5872

Closed pj-connect closed 1 year ago

pj-connect commented 1 year ago

Describe the bug Hi. I'm a newbie at compiling and this is "above my pay grade"

After typing, the command make, I get this error:

python3 setup.py 
CC: ['gcc'] (11, 0)
[18/18] Generating wayland-xdg-activation-v1-client-protocol.c ... done
[104/104] Compiling kitty/gl-wrapper.c ... done
[8/8] Linking launcher ... done
Linking launcher ...
gcc build/kitty-launcher-main.o -lcrypt -ldl -lm -lm -L/home/localuser/.pyenv/versions/3.10.5/lib -lpython3.10 -Xlinker -export-dynamic -o kitty/launcher/kitty
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(longobject.o): in function `PyLong_FromString':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/longobject.c:2286: undefined reference to `log'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(floatobject.o): in function `_float_div_mod':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:639: undefined reference to `fmod'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(floatobject.o): in function `float_rem':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:619: undefined reference to `fmod'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(floatobject.o): in function `float___round___impl':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:1054: undefined reference to `round'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:1057: undefined reference to `round'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(floatobject.o): in function `float_pow':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:752: undefined reference to `fmod'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:762: undefined reference to `fmod'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:811: undefined reference to `pow'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/floatobject.c:788: undefined reference to `fmod'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(pytime.o): in function `_PyTime_RoundHalfEven':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:106: undefined reference to `round'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:109: undefined reference to `round'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:106: undefined reference to `round'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:109: undefined reference to `round'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:106: undefined reference to `round'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(pytime.o):/tmp/python-build.20220626185449.55660/Python-3.10.5/Python/pytime.c:109: more undefined references to `round' follow
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(complexobject.o): in function `_Py_c_abs':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:206: undefined reference to `hypot'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(complexobject.o): in function `_Py_c_pow':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:142: undefined reference to `hypot'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:143: undefined reference to `pow'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:144: undefined reference to `atan2'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:146: undefined reference to `sincos'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:147: undefined reference to `exp'
/usr/bin/ld: /tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:148: undefined reference to `log'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(complexobject.o): in function `_Py_c_abs':
/tmp/python-build.20220626185449.55660/Python-3.10.5/Objects/complexobject.c:206: undefined reference to `hypot'
collect2: error: ld returned 1 exit status
make: *** [Makefile:13: all] Error 1

...And, also, I get this other error after executing the command make again:

python3 setup.py 
CC: ['gcc'] (11, 0)
[6/6] Linking launcher ... done
Linking kittens/transfer/rsync ...
gcc -Wextra -Wfloat-conversion -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11 -O3 -fwrapv -fstack-protector-strong -pipe -march=native -fvisibility=hidden -D_FORTIFY_SOURCE=2 -fPIC -flto -DKITTY_HAS_RS_SIG_ARGS -Ikitty -I/home/localuser/.pyenv/versions/3.10.5/include/python3.10 -Wall -O3 -shared -flto build/rsync-rsync.c.o -lrsync -lcrypt -ldl -lm -lm -L/home/localuser/.pyenv/versions/3.10.5/lib -lpython3.10 -Xlinker -export-dynamic -o build/kittens/transfer/rsync.so
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(object.o): warning: relocation against `PyDictKeys_Type' in read-only section `.text'
/usr/bin/ld: /home/localuser/.pyenv/versions/3.10.5/lib/libpython3.10.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile:13: all] Error 1

To Reproduce Steps to reproduce the behavior:

  1. Download the source code (kitty-0.26.5.tar.xz), and extract it.
  2. sudo apt install git gcc cmake pkg-config libdbus-1-dev libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libxkbcommon-x11-dev libfontconfig-dev libx11-xcb-dev liblcms2-dev libpython3-dev librsync-dev libharfbuzz-dev wayland-protocols libwayland-dev
  3. execute make command to get the 1rst error.
  4. execute make command again, to get the second error.

Screenshots If applicable, add screenshots to help explain your problem.

Environment details

Press Ctrl+Shift+F6 (cmd+option+comma on macOS) in kitty, to copy debug output about kitty and its
configuration to the clipboard and paste it here. 

On older versions of kitty, run kitty --debug-config instead

Additional context Try to reproduce the problem with kitty --config NONE if you cannot then post a minimal kitty.conf that reproduces the problem. If the problem involves interaction with some other terminal program post a minimal config for that program to reproduce the problem as well.

kovidgoyal commented 1 year ago

You are trying to link against a static version of libpython, dont do that. Indeed dont use pyenv at all. Just use your system python.

pj-connect commented 1 year ago

I executed the command pyenv local system and it worked. Thankx.