Can not find SDL, or any graphic libraries, when attempting to compile?
Can not find SDL, or any graphic libraries, when attempting to compile?
Hello, (ubuntu 18 on Lenovo x230, integrated graphics, plenty of ram etc, using Geany as the ide)
I've been using Ubuntu for about eight years but only attempting to program on this platform recently. I am having no trouble doing things in a terminal only program, but attempting to use any of the graphic commands tells me that various libraries, which I presumed would have been installed with freebasic, are missing. I have tracked down many and installed them, but for whatever reason SDL, among others, is not working. I have downloaded and installed SDL 1.2.15, and when it did not work, I have downloaded 2.0.9 to no avail. The error that I am getting is ld: cannot find -lSDL, from trying to compile the example programs, but whether I am trying SDL, OpenGL, or any of the others included in examples I get very similar errors.
I really wanted freebasic to work because it has a syntax familiar enough to me that I feel like I can use it- I'm averse to c and all of the more 'modern' languages because they are quite frankly illegible, having grown up using 6502 assembly (C64), various basic flavors and HyperTalk fairly extensively. I'm a hobbyist who wants to make chincy NES style wargames. I've a good idea how to do the back end of it without the graphics but at the end of the day colored numbers in the terminal isn't going to cut it.
Does anyone have any suggestions?
I've been using Ubuntu for about eight years but only attempting to program on this platform recently. I am having no trouble doing things in a terminal only program, but attempting to use any of the graphic commands tells me that various libraries, which I presumed would have been installed with freebasic, are missing. I have tracked down many and installed them, but for whatever reason SDL, among others, is not working. I have downloaded and installed SDL 1.2.15, and when it did not work, I have downloaded 2.0.9 to no avail. The error that I am getting is ld: cannot find -lSDL, from trying to compile the example programs, but whether I am trying SDL, OpenGL, or any of the others included in examples I get very similar errors.
I really wanted freebasic to work because it has a syntax familiar enough to me that I feel like I can use it- I'm averse to c and all of the more 'modern' languages because they are quite frankly illegible, having grown up using 6502 assembly (C64), various basic flavors and HyperTalk fairly extensively. I'm a hobbyist who wants to make chincy NES style wargames. I've a good idea how to do the back end of it without the graphics but at the end of the day colored numbers in the terminal isn't going to cut it.
Does anyone have any suggestions?
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
Hi f0rgotten, welcome to the forum.
Please, consult the Manual first, for often asked questions, before posting.
The Linker (ld) can't find the SDL library (.so in 'ix OS's/.dll in WIN).
Refer to FB-Manual: "including external libraries" (prebuilt)
FB-Manual's title page: "FB-Manual's title page"
Please, consult the Manual first, for often asked questions, before posting.
Should be self explaining:The error that I am getting is ld: cannot find -lSDL
The Linker (ld) can't find the SDL library (.so in 'ix OS's/.dll in WIN).
Refer to FB-Manual: "including external libraries" (prebuilt)
FB-Manual's title page: "FB-Manual's title page"
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
Why not try:f0rgotten wrote:Hello, (ubuntu 18 on Lenovo x230, integrated graphics, plenty of ram etc, using Geany as the ide)
I've been using Ubuntu for about eight years but only attempting to program on this platform recently. I am having no trouble doing things in a terminal only program, but attempting to use any of the graphic commands tells me that various libraries, which I presumed would have been installed with freebasic, are missing. I have tracked down many and installed them, but for whatever reason SDL, among others, is not working. I have downloaded and installed SDL 1.2.15, and when it did not work, I have downloaded 2.0.9 to no avail. The error that I am getting is ld: cannot find -lSDL, from trying to compile the example programs, but whether I am trying SDL, OpenGL, or any of the others included in examples I get very similar errors.
Does anyone have any suggestions?
sudo apt-get install libsdl-dev libsdl-image-dev libsdl-mixer-dev libsdl-net-dev libsdl-ttf-dev
or
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
+1 to Kuan Hsu's post.
Dependent libraries are not included with the FB compiler on Linux because they are typically a standard part of the distribution and can be installed using the distro's package manager, as Kuan Hsu has so helpfully indicated. Note that if your distro is 64-bit, you'll need to double check whether you got the 32-bit or 64-bit version of FB, and make sure you get the appropriate 32 or 64-bit SDL packages.
If FB was available as an Ubuntu package in a PPA repository, then installing that would have automatically installed the SDL library and any other dependent libraries. That's the beauty of a packaging system. FB is maintained by a very small number of dedicated volunteers who don't have the time and resources to maintain distro-specific packages, so we make do with binary tarballs.
In any case, in Linux your first port of call for installing missing libraries should always be the distro's package manager and official repositories. Installing libraries from source should only be done if you really need something not in the repos, and if you really know what you're doing. Installing from source will often default to installing to /usr/local, which isn't always in the default library search path, and can conflict with system-installed libraries in /usr.
In Ubuntu you can install a graphical package manager called Synaptic, and you can use that to search for specific libraries. I've often found this to be helpful when I wasn't sure what a package was called.
Dependent libraries are not included with the FB compiler on Linux because they are typically a standard part of the distribution and can be installed using the distro's package manager, as Kuan Hsu has so helpfully indicated. Note that if your distro is 64-bit, you'll need to double check whether you got the 32-bit or 64-bit version of FB, and make sure you get the appropriate 32 or 64-bit SDL packages.
If FB was available as an Ubuntu package in a PPA repository, then installing that would have automatically installed the SDL library and any other dependent libraries. That's the beauty of a packaging system. FB is maintained by a very small number of dedicated volunteers who don't have the time and resources to maintain distro-specific packages, so we make do with binary tarballs.
In any case, in Linux your first port of call for installing missing libraries should always be the distro's package manager and official repositories. Installing libraries from source should only be done if you really need something not in the repos, and if you really know what you're doing. Installing from source will often default to installing to /usr/local, which isn't always in the default library search path, and can conflict with system-installed libraries in /usr.
In Ubuntu you can install a graphical package manager called Synaptic, and you can use that to search for specific libraries. I've often found this to be helpful when I wasn't sure what a package was called.
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
@f0rgotten: You might also get some use out of FreeBASIC's built in graphics library. It requires no extra libraries to be installed.
Here is a link to all the available keywords.
Here is a link to all the available keywords.
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
Apart from SDL, the wiki (DevBuildLinux) suggests these packages are needed to compile FB itself:
These should be enough to run standard FB programs as well.
If you get any further errors about additional files then let us know the filenames and we should be able to work out what package is needed.
Alternatively, if you put something like "apt install [library-filename]" into your favourite search engine, there's a good chance it will find the necessary package name.
Code: Select all
libncurses5-dev
libgpm-dev
libx11-dev
libxext-dev
libxpm-dev
libxrandr-dev
libxrender-dev
libgl1-mesa-dev
libffi-dev
If you get any further errors about additional files then let us know the filenames and we should be able to work out what package is needed.
Alternatively, if you put something like "apt install [library-filename]" into your favourite search engine, there's a good chance it will find the necessary package name.
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
Thanks to those whom have replied.
are installed already.
resulted in
I am running 64 bit fbc, and for grins, I am attempting to complie ~/FreeBASIC-1.05.0-linux-x86_64/examples/graphics/SDL/image_test1.bas and I am getting
I do appreciate the suggestions all. I admit my lack of linux-fu. I feel like I have done my due diligence from the command line but clearly I am still doing something wrong.
Code: Select all
libncurses5-dev libgpm-dev libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev libgl1-mesa-dev libffi-dev
Code: Select all
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
Code: Select all
libsdl2-dev is already the newest version (2.0.8+dfsg1-1ubuntu1.18.04.1).
Code: Select all
fbc -w all "image_test1.bas" (in directory: /home/rmx256/FreeBASIC-1.05.0-linux-x86_64/examples/graphics/SDL)
ld: cannot find -lSDL
ld: cannot find -lSDL_image
Compilation failed.
I do appreciate the suggestions all. I admit my lack of linux-fu. I feel like I have done my due diligence from the command line but clearly I am still doing something wrong.
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
image_test1.bas is a SDL 1.x example, do you install SDL 1.x libs?f0rgotten wrote:Thanks to those whom have replied.
are installed already.Code: Select all
libncurses5-dev libgpm-dev libx11-dev libxext-dev libxpm-dev libxrandr-dev libxrender-dev libgl1-mesa-dev libffi-dev
resulted inCode: Select all
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-net-dev libsdl2-ttf-dev
I am running 64 bit fbc, and for grins, I am attempting to complie ~/FreeBASIC-1.05.0-linux-x86_64/examples/graphics/SDL/image_test1.bas and I am gettingCode: Select all
libsdl2-dev is already the newest version (2.0.8+dfsg1-1ubuntu1.18.04.1).
Code: Select all
fbc -w all "image_test1.bas" (in directory: /home/rmx256/FreeBASIC-1.05.0-linux-x86_64/examples/graphics/SDL) ld: cannot find -lSDL ld: cannot find -lSDL_image Compilation failed.
I do appreciate the suggestions all. I admit my lack of linux-fu. I feel like I have done my due diligence from the command line but clearly I am still doing something wrong.
Is sdl2-hello.bas not working?
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
Thanks for your reply, u/Kuan Hsu.
Attempting to compile sdl2-hello.bas results in
That being said I did get some of the built in graphics commands to work- I can now open a window, which is helpful, as I do want a double-clickable executable.
Attempting to compile sdl2-hello.bas results in
Code: Select all
fbc -w all "sdl2-hello.bas" (in directory: /home/rmx256/FreeBASIC-1.05.0-linux-x86_64/examples/graphics/SDL)
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2.so when searching for -lSDL2
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2.a when searching for -lSDL2
ld: cannot find -lSDL2
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2_image.so when searching for -lSDL2_image
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2_image.a when searching for -lSDL2_image
ld: cannot find -lSDL2_image
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2_ttf.so when searching for -lSDL2_ttf
ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libSDL2_ttf.a when searching for -lSDL2_ttf
ld: cannot find -lSDL2_ttf
Compilation failed.
Re: Can not find SDL, or any graphic libraries, when attempting to compile?
That means that you're either compiling a 32-bit executable and you have the 64-bit version of SDL2, or the other way around. Check the bitness of the library (and the compiled output) to make sure they match.f0rgotten wrote:...
Attempting to compile sdl2-hello.bas results in
...