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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...