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

  • 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...