libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
410 stars 36 forks source link

Installing/upgrading TCOD 8.0.0 fails on Xubuntu 16.04 #56

Closed Wolfenswan closed 5 years ago

Wolfenswan commented 5 years ago

All required packages are installed. Python version is 3.6.4. Currently installed tcod version is 6.0.6.

I have tried installing the latest version of tcod using both pip install --upgrade and installing within a fresh virtual environment.

In both cases I receive this error message (pasting only the last lines, I can provide a full log if necessary):

    libtcod/src/libtcod/sdl2/sdl2_alias.cpp: In member function ‘void tcod::sdl2::SDL2InternalTilesetAlias_::sync_alias()’:
    libtcod/src/libtcod/sdl2/sdl2_alias.cpp:98:38: error: ‘SDL_PIXELFORMAT_RGBA32’ was not declared in this scope
             SDL_CreateTexture(renderer_, SDL_PIXELFORMAT_RGBA32,
                                          ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of tcod
Command "/usr/local/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-n92anhvf/tcod/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-2w986ex5/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-n92anhvf/tcod/
HexDecimal commented 5 years ago

I'm familiar with this problem. Currently libtcod requires SDL 2.0.5, the version of SDL on Ubuntu 16.04 is too old and is missing the enum symbol SDL_PIXELFORMAT_RGBA32.

The installer uses sdl2-config so it's possible to build and install the latest version of SDL manually and that will be linked when you install from pip. Otherwise you can upgrade Ubuntu to a later version such as 18.04 LTS, which will have an up-to-date package of SDL.

lee2sman commented 5 years ago

Hi, I had the exact same error. I'm on Ubuntu 16.04 LTS so also must have SDL 2.0.4.

I found this thread and followed along faithfully, even trying the --enable-mir-shared=nothat is mentioned lower in the thread. Didn't work for me.

Someone more knowledgeable than I can hopefully use that thread to fix this install method correctly or to update python-tcod.

Ok, but I did get things to work using an 'untrustworthy' PPA build. Info on building SDL 2.0.8 from a dev's source is here. Looks like this is working for me.

HexDecimal commented 5 years ago

The break specifically happened in python-tcod 7.0.0, when libtcod was updated to 1.9.0. If you're unable to upgrade SDL then you could potentially stick with python-tcod 6.0.7.

Wolfenswan commented 5 years ago

Thanks to the help! As per @lee2sman's suggestion Libsdl2-2.0.8 installed fine, though now the tcod installation is unable to find the sdl2-config file, while I'm unable to install libsdl2-dev. Technically my question has been answered however, so feel free to close the issue @HexDecimal.

Wolfenswan commented 5 years ago

Scratch the last one, after fiddling with my package manager and getting libsdl2-dev to install, tcod 8.0.0 also installed successfully.