Jump to content

Compilation error in ubuntu 20.04


1General
 Share

Recommended Posts

Dear 0ad developers,

When I try to compile the source code from svn, I found a bug with errors like

fatal error SDL.h: No such file or directory

Here I notice that in ubuntu the libsdl2 called like this #include <SDL2/SDL.h>  and libsdl1 #include <sdl/SDL.h>

To fix this error there is two simple ways the first one is to replace #include <SDL.h> with #include <SDL2/SDL.h> and every libsdl2 header need to add SDL2/header_name.h

The other way which I tried here, is to add -D_REENTRANT -I/usr/include/SDL2 -lSDL2 to makefile

ALL_CFLAGS += ... -D_REENTRANT -I/usr/include/SDL2 -lSDL2

ALL_CXXFLAGS += .... -D_REENTRANT -I/usr/include/SDL2 -lSDL2

And thanks for your time and this honorable work.

Link to comment
Share on other sites

I install libsdl2-dev then how I fix the bug !

sdl2-config --cflags --libs

give

-I/usr/include/SDL2 -D_REENTRANT
-lSDL2

-----------------------------

pkg-config --cflags --libs sdl2

give

-D_REENTRANT -I/usr/include/SDL2 -lSDL2

Edited by 1General
Link to comment
Share on other sites

6 minutes ago, 1General said:

I install libsdl2-dev then how I fix the bug !

sdl2-config --cflags --libs

give

-I/usr/include/SDL2 -D_REENTRANT
-lSDL2

-----------------------------

pkg-config --cflags --libs sdl2

give

-D_REENTRANT -I/usr/include/SDL2 -lSDL2

Edited 1 minute ago by 1General

is this 20.04 or 21.04?

 

Link to comment
Share on other sites

cat /etc/*release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Link to comment
Share on other sites

35 minutes ago, 1General said:
sdl2-config --cflags --libs

give

-I/usr/include/SDL2 -D_REENTRANT
-lSDL2

-----------------------------

pkg-config --cflags --libs sdl2

give

-D_REENTRANT -I/usr/include/SDL2 -lSDL2

So these path are correct, and no need to change something in the code. Maybe there is a problem somewhere in premake which doesn't catch these paths properly.

Link to comment
Share on other sites

1 hour ago, asterix said:

@fabio any help here, please?

https://youtu.be/kOQPiud3fks

thats (k)ubuntu. so it may help you.

may importend:
from
https://trac.wildfiregames.com/wiki/BuildInstructions#Dependencies

    On Debian 10 (Buster) or Ubuntu 18.04 LTS (Bionic Beaver) or later install the required dependencies with:

    sudo apt-get install -y build-essential cmake libboost-dev libboost-system-dev   \
        libboost-filesystem-dev libcurl4-gnutls-dev libenet-dev libfmt-dev   \
        libgloox-dev libicu-dev libminiupnpc-dev libnvtt-dev libogg-dev   \
        libopenal-dev libpng-dev libsdl2-dev libsodium-dev libvorbis-dev   \
        libxml2-dev python rustc subversion zlib1g-dev

    If you want to use a packaged SpiderMonkey, which will be made available for example in 0ad.dev PPA:
        you should add libmozjs-78-dev and run update-workspace.sh with --with-system-mozjs.
    When not using system nvidia-texture-tools, libnvtt-dev can be omitted, but cmake is needed to build the bundled NVTT.
    You can also use libcurl4-openssl-dev instead of libcurl4-gnutls-dev (it's not possible to install both at once), but note that openssl is not GPL compatible and the resulting binaries could not be redistributed.

    Finally you need to install the WX libraries for Atlas:

    sudo apt install -y wx3.0-headers libwxbase3.0-dev libwxgtk3.0-gtk3-dev libwxbase3.0-0v5

Edited by seeh
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...