SDL 2.0 init video fails, help!

Problem: With SDL2.0 the SDL_InitSubSystem(SDL_INIT_VIDEO) funtion fails
and last error is set to “No available video device”

I did a fresh install of Ubuntu 13.04 32-bit and immediately tried to
compile my “blank” SDL 2 project. The project compiles but fails at run
time when the video system cannot be initialized.

Things I’ve tried:

I’ve activated nvidia’s proprietary video driver and the video system still
fails to initialize.
I’ve made sure sym links libGL.so and libGL.so.1 in in my /usr/lib folder.
I’ve tried setting SDL_VIDEODRIVER to x11
I’ve tested the game gltron and it runs flawlessly.

Stepping into SDL2 sources I see the following happening:

I call SDL_InitSubSystem(SDL_INIT_VIDEO)

goes to SDL_video.c …

SDL_VideoInit(const char *driver_name) // line 409, driver_name is NULL
when SDL_VIDEODRIVER is undefined
bootstrap[i]->available()// line 447, bootstrap has 2 pointer, first one
is valid, second one is NULL

goes to SDL_nullvideo.c …

DUMMY_Available(void) // line 60, returns 0 because SDL_VIDEODRIVER is
undefined

returns toSDL_video.c …

return SDL_SetError(“No available video device”); // line 459,
initialize video stops here

When I set and export SDL_VIDEODRIVER to x11 it still fails in pretty much
the same manner.

Can anyone help me understand why this is happening and what I could try to
configure this new install so that the video initialization doesn’t fail?

Did you have X11 headers installed by the time you configured/compiled SDL?

Yes,

I actually was using a pre-built version which I’ve used on a few systems
successfully hosted here:

http://www.baregame.org/#topic_resources

Then after I had problems with that I version I got the most recent release
candidate sources and made another build resulting in the same problem.On Sun, Jul 21, 2013 at 5:43 PM, Jannik Heller wrote:

Did you have X11 headers installed by the time you configured/compiled SDL?
_____________**
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/**listinfo.cgi/sdl-libsdl.orghttp://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

This seems to have fixed it:

sudo apt-get build-dep libsdl1.2

I was hit by exactly the same problem on Ubuntu 13.04 32-bit, and solved the
problem by exactly the same way as Anthony did:
sudo apt-get build-dep libsdl1.2
Getting dependent library would be okay for SDL developers, but I wonder how
to distribute the resulting executables non-developers.

To distribute our Ubuntu executable that uses SDL2, should we make an
automated package (like .deb) and have it install libsdl1.2 on each user’s
machine? Is that really a right way to go? I’m quite new to Linux software
development and I’m sorry if I’m asking something very stupid…

I think in the end what you need for distribution of game on Linux is a deb
file, although I have no idea how to make one. it would probably be useful
is someone could post a link to easy to follow steps in taking a SDL 2.0
game/app and converting into into a deb file.

As an aside, I’ve been working on a cross platform IDE customized with SDL
2.0 in mind and am preparing a new version.

Main page:
http://barebare.org

Installer topic:
http://baregame.org/#topic_installation

For Ubuntu/Debian what I have is a script which sets everything up
including precompiled SDL 2.0 libraries. Feel free to examine it here:

http://baregame.org/download/?file=bare-install.sh

I’ll eventually need a script for other Linux distributions …

Huh, that’s funny - a few months ago, I started working on a game engine
with SDL called bear engine https://github.com/mrozbarry/bear-engine.
Bear/bare are cool names, anyway. Project looks nice, keep up the good
work.On Tue, Jul 23, 2013 at 2:58 PM, Anthony Walter wrote:

I think in the end what you need for distribution of game on Linux is a
deb file, although I have no idea how to make one. it would probably be
useful is someone could post a link to easy to follow steps in taking a SDL
2.0 game/app and converting into into a deb file.

As an aside, I’ve been working on a cross platform IDE customized with SDL
2.0 in mind and am preparing a new version.

Main page:
http://barebare.org

Installer topic:
http://baregame.org/#topic_installation

For Ubuntu/Debian what I have is a script which sets everything up
including precompiled SDL 2.0 libraries. Feel free to examine it here:

http://baregame.org/download/?file=bare-install.sh

I’ll eventually need a script for other Linux distributions …


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Quite a nasty script.

It unconditionally deletes any SDL2 libraries under /usr. Why at all
expect them there?

Then replaces them with ones downloaded from your site. Why?

All of this is normally taken care of with PKG_CONFIG_PATH pointing to
something like ~/prefix.

And then downloads some code from your site and executes it. Which is
a binary file.

Are you serious?On Tue, Jul 23, 2013 at 10:58 PM, Anthony Walter wrote:

For Ubuntu/Debian what I have is a script which sets everything up including
precompiled SDL 2.0 libraries. Feel free to examine it here:

http://baregame.org/download/?file=bare-install.sh


./lxnt

The source code to the binary is in the git repository and it needs a
specific compiler to work be built (FPC 2.7.1 trunk specific revision).
Rather than attempt to download the source code to the compiler and IDE and
build it on their system I just have a prebuild compiler and IDE which I’ve
taken the time to configure and extend (the IDE has some enhancements).

With regards to installing SDL 2.0 directly, since it’s not been released
yet I don’t see a problem with bundling the latest release candidate
binaries with my installer. Here is a walk through video of the installer
and IDE:

http://www.baregame.org/#topic_installation

http://www.baregame.org/#topic_using_lazarus

Eventually I’d like to make a deb installer file, but I would prefer to
installer stuff in the/home/user directory so that multiple copies
(different versions) of the compiler coud be installed on the end users
machine without interfering with each other (which si how it works now,
save for copying the SDL 2.0 library to /usr/lib like you mentioned).

SDL 2.0 has a debian directory and can be built as a deb natively.

See the dpkg-buildpackage man page for details.
http://manpages.ubuntu.com/manpages/jaunty/man1/dpkg-buildpackage.1.html

Cheers!On Tue, Jul 23, 2013 at 6:18 PM, Anthony Walter wrote:

The source code to the binary is in the git repository and it needs a
specific compiler to work be built (FPC 2.7.1 trunk specific revision).
Rather than attempt to download the source code to the compiler and IDE and
build it on their system I just have a prebuild compiler and IDE which I’ve
taken the time to configure and extend (the IDE has some enhancements).

With regards to installing SDL 2.0 directly, since it’s not been released
yet I don’t see a problem with bundling the latest release candidate
binaries with my installer. Here is a walk through video of the installer
and IDE:

http://www.baregame.org/#topic_installation

http://www.baregame.org/#topic_using_lazarus

Eventually I’d like to make a deb installer file, but I would prefer to
installer stuff in the/home/user directory so that multiple copies
(different versions) of the compiler coud be installed on the end users
machine without interfering with each other (which si how it works now,
save for copying the SDL 2.0 library to /usr/lib like you mentioned).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, I have to concur with Alexander… that bare-install.sh is dangerous
and should not be used. You never tool around with libraries in /usr/lib
that aren’t explicitly owned by your software package, and even then it
should be done via the platform’s package manager.

Now I haven’t tried the setup tool, but it sounds like you want to provide
a downloadable self-contained build of your software that installs
somewhere in the user’s home folder. Until the native packages catch on,
can I suggest bundling a snapshot build of libSDL2.so with your library
files and linking it with RPATH, instead of throwing it in /usr/lib/ where
it can smash things.On 24 July 2013 10:22, Sam Lantinga wrote:

SDL 2.0 has a debian directory and can be built as a deb natively.

See the dpkg-buildpackage man page for details.
http://manpages.ubuntu.com/manpages/jaunty/man1/dpkg-buildpackage.1.html

Cheers!

On Tue, Jul 23, 2013 at 6:18 PM, Anthony Walter wrote:

The source code to the binary is in the git repository and it needs a
specific compiler to work be built (FPC 2.7.1 trunk specific revision).
Rather than attempt to download the source code to the compiler and IDE and
build it on their system I just have a prebuild compiler and IDE which I’ve
taken the time to configure and extend (the IDE has some enhancements).

With regards to installing SDL 2.0 directly, since it’s not been released
yet I don’t see a problem with bundling the latest release candidate
binaries with my installer. Here is a walk through video of the installer
and IDE:

http://www.baregame.org/#topic_installation

http://www.baregame.org/#topic_using_lazarus

Eventually I’d like to make a deb installer file, but I would prefer to
installer stuff in the/home/user directory so that multiple copies
(different versions) of the compiler coud be installed on the end users
machine without interfering with each other (which si how it works now,
save for copying the SDL 2.0 library to /usr/lib like you mentioned).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Okay,

Regarding rpath, supposing I wanted to offer installation using the current
users folders rather than system folder, what would be the ld command to
embed a local folder in their home directory (e.g. ~/lib) into an
executable’s rpath?

ld … $HOME/lib/libSDL.so.2.0.0 --library-path $HOME/lib mytestgame

The reason I want to overwrite binaries and use the users folders (at least
for the compiler) is so that the user can run different versions,
libraries, and examples which are updated using tools inside the IDE (for
example, they can upgrade my library or download example projects inside
the IDE using IDE menu items and wizards).