Issue using libsdl2-image-2.0-0 - c++

Recently I've been playing around with the SDL library and wanted to start using libsdl2-image-2.0-0 along with SDL. I have been trying to get this working with Ubuntu 15.04. I have installed the package using
sudo apt-get install libsdl2-image-2.0-0
The installation appeared to go completely fine but when I try to include the image library in my C++ code with
#include <SDL2/SDL_image.h>
I get an error "fatal error: SDL2/SDL_image.h: No such file or directory"
I went and looked where the SDL2 base library was located /usr/local/include/SDL2 and just as the error message said SDL_image.h was not there.
I then tried to figure out where the library was using
apt-file search SDL_image.h
When I do this
libsdl-image1.2-dev: /usr/include/SDL/SDL_image.h
libsdl2-image-dev: /usr/include/SDL2/SDL_image.h
both show up as results. This is strange to me since I did not install libsdl2-image-dev. Also when I try to view /usr/include/SDL2/ the folder doesn't even appear to exist which just adds to my confusion.
I then tried to remove libsdl2-image-dev so I could install libsdl2-image-2.0-0 but when I run the command
sudo apt-get remove libsdl2-image-dev
I get
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'libsdl2-image-dev' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
and when I try to run the command
sudo apt-get install libsdl2-2.0-0
I end up getting
Reading package lists... Done
Building dependency tree
Reading state information... Done
libsdl2-2.0-0 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
So basically I cannot locate where this library is and so I can't properly link it to my code. Is there a more reliable way to locate where this library is and is there something fundamental I am not understanding in regards to using these supplementary libraries?

You need the development packages installed to develop SDL2 based programs.
sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev

Related

How to install libpq-fe.h?

I cannot figure this out for the life of me.
When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
So to install libpq-fe-h I need to sudo apt-get install libpq-dev..
..which returns..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.
I am lost at this point. If anyone can help I would highly appreciate it.
For some reason, the file is missing on the system.
As you're using apt-get, the system is dpkg based, presumably Debian or it's derivative. You can try the Ubuntu's package search to get which package contains a file with name ending in libpq-fe.h.
I found the package is libpq-dev and file's absolute path is /usr/include/postgresql/libpq-fe.h.
FWIW, on a dpkg based system, you can check which package gives a file if you know the file's absolute path:
% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
Also, unlike find, locate keeps a cache of found files (mlocate.db) that is created everyday via cron; so if the file happens to be removed after the last run, you can run locate libfq-fe.h to get the absolute path to the file without needing to check the Ubuntu package search online.
So the package is libpq-dev. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg will prompt you for action for any package that does that).
To reinstall the package:
sudo apt-get install --reinstall libpq-dev
For me, I realized it was trying to use the deprecated setup.py so I installed wheel (pip install wheel) and that sorted it all out.
Well after installing these libraries
sudo dnf install python-virtualenv openssl-devel gcc libffi-devel libxslt-devel issue was not gone.
I used mlocate to find where libpq-fe.h file is located. On my system (Fedora 32) it was located at /usr/pgsql-10/include/libpq-fe.h
yum install mlocate
sudo updateb
locate libpq-fe.h
After all added this line to ~/.bash_profile
nano ~/.bash_profile
export PATH=/usr/pgsql-10/bin/:$PATH
Works fine, I can easily install psycopg2 without any trouble.
You need to create a LD_LIBRARY_PATH that indicates the path of your library /user/pgsql-11/lib
Source: The 3rd point of build prerequisites at https://www.psycopg.org/docs/install.html#build-prerequisites

Qt 5.4.0 install failing on libGL.so.1, but libgl-dev and ibglu-dev already installed

I am trying to install (offline installer) Qt 5.4.0 on linux 14.04 "Trusty Tahr" and I keep getting the error message:
Warning: /home/bd-01/Qt5.4.0//Tools/QtCreator/bin/sdktool: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
I've googled and searched and the answer seems to be to install libgl-dev and libglu-dev but they are already installed, per the console messages I see when installing each:
libgl-dev
`Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libgl1-mesa-dev' instead of 'libgl-dev'
libgl1-mesa-dev is already the newest version.
libgl1-mesa-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 598 not upgraded.`
libglu-dev
`Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libglu1-mesa-dev' instead of 'libglu1-mesa-dev'
libglu1-mesa-dev is already the newest version.
libglu1-mesa-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 598 not upgraded.`
So I see 2 possible problems but don't know how to adress either.
'libglu1-mesa-dev' is being substituted for 'libglu1-mesa-dev'
libglu1-mesa-dev set to manually installed
Can anyone help me understand what is going on here?
Given that you have the following items done proper:
sudo apt-get install libgl1-mesa-dev
not mixing 32 and 64 bits
you used the proper download URL
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 is available
etc
... it seems that, as I suspected, your system was b0rked. When you are dealing with packages through the package manager, you need to ensure that the system is in a clean and proper, and not in a broken state.
Things, like apt-get auto remove run means that you system is fundamentally broken and you have to fix your system first before experimenting with packages on top of it.

Unable to locate package GLFW on Linux Mint

I have been trying to install GLFW and GLFW3, using Terminal to install
sudo apt-get install GLFW
sudo apt-get install GLFW3
Whenever I do so, I get results such as
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glfw3
I have been trying to install GLFW for two hours now, and I'm getting a bit impatient. Also I'm very new to Linux (Mint), so I apologize if I'm doing something stupid...
EDIT:
No matter what I try, my program encounters
/home/myusername/Desktop/basic_window.cpp:11:21: fatal error: GL/glfw.h: No such file or directory
#include <GL/glfw.h>
^
compilation terminated.
Having a frustrating time with this, not sure why this is much more complicated than the other libraries I've installed so far.
I have been trying to install GLFW and GLFW3, using Terminal to install...
On Mint 17, it looks like you need to install libglfw2. So perform a sudo apt-get install libglfw2.
If you plan on developing against it, then install libglfw-dev instead. Notice the lack of a version number.
If interested, perform apt-cache search glfw
In Debian-based systems such as Ubuntu and Mint, library packages typically have names that begin with "lib", and development headers (for compiling new programs that use the library) are in a separate package whose name ends with "-dev".
Ubuntu 14.04 has GLFW 2 packaged as libglfw2 and libglfw-dev. Mint doesn't seem to have those packages, but you can probably use the Ubuntu ones since Mint 17 is based on Ubuntu 14.04.
GLFW 3 isn't in Ubuntu 14.04, but it looks like it'll be in 14.10 (as libglfw3 and libglfw3-dev).
Unless you really need GLFW 3 specifically, you're probably better off sticking with the packaged GLFW 2. Packages get easy automatic upgrades; compiling stuff "by hand" is a good way to end up with lots of cruft in your system with no automatic upgrade or uninstall.
Download GLFW source packages from their website.
Extract the folder glfw-3.0.4 from the tarball
Open console
Navigate to the folder you just extracted and go inside of it using cd
Type cmake . (be sure you include the dot)
If cmake . fails, then type the following as root:
apt-get install cmake
If you don't think you're root then type the following:
sudo apt-get install cmake
If that doesn't work then type the following as root, or add sudo if you're not root:
apt-get install build-essential cmake
Once you have cmake installed, navigate back to the folder and try cmake . again.

Not able to install c++ eclipse indigo after completely uninstalling from ubuntu 11.10

I had installed Indigo eclipse successfully earlier in Ubuntu (Virtual Machine) with following commands:
sudo apt-get install eclipse
sudo apt-get install eclipse-cdt
However, it got messed up when I did an update from its "Install New Software" tab. After running following commands, I removed eclipse completely.
sudo apt-get remove --purge eclipse
sudo apt-get autoremove
sudo rm -rf /usr/bin/eclipse /usr/lib/eclipse/ /usr/share/eclipse /usr/share/man/man1/eclipse.1.gz /etc/eclipse.ini
However, now I want to again install eclipse in my Ubuntu. When I run the above commands, it simply doesn't go well and stop at following execution:
milind#milind-VirtualUbuntuOneiric:~$ sudo apt-get install eclipse
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
eclipse
0 upgraded, 1 newly installed, 0 to remove and 147 not upgraded.
Need to get 0 B/17.3 kB of archives.
After this operation, 131 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
eclipse
Install these packages without verification [y/N]? y
Selecting previously deselected package eclipse.
(Reading database ... 133931 files and directories currently installed.)
Unpacking eclipse (from .../eclipse_3.7.0-0ubuntu1_all.deb) ...
Setting up eclipse (3.7.0-0ubuntu1) ...
milind#milind-VirtualUbuntuOneiric:~$
Trying for so long (with restarting the VBox many times), but no luck. Can you please help me with:
How to install eclipse for C++ (I think indigo) from command line
like earlier I did ?
If command line is not working then what is the latest C++ eclipse site to get it ?
How to install proper CDT for this eclipse so that it can be used
nicely for debugging (which was my root problem) ?
I had a few problems installing from apt recently (Ubuntu 11.10). I eventually ended up downloading a build from here and then installing to a custom location [/home/usrname/programs/eclipse]. This was the only way I could get the marketplace to work.

reinstalling sdl manually on buntu

I am new to doing manually installing.
I reinstalled sdl manually, now everytime I run pygame or a game that uses SDL (eg. solarwolf or supertux) I get the message: Unsupported console hardware.
I know my computer can run SDL, because it worked prior to the reinstallation.
I want to now how I can reinstall SDL properly, so that pygame will work again.
versions:
ubuntu: Ubuntu 10.04 LTS Lucid Lynx
sdl: 1.2.14
Stuff I have tried:
1)
I have tried this commandoes I found on the net:
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure --prefix=$HOME
make
make install
2)
I tried again with sudo and no prefix. Maybe that wrecked some prior configurationsfile or something?
wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz
tar -xzvf SDL-1.2.14.tar.gz
cd SDL-1.2.14
./configure
make
sudo make install
3)I used the Synaptic Package Manager to completely remove and reinstall all files starting with libsdl.
4)I have tried reinstalling supertux and solarwolf (with ubuntu software senter)
hoping it could resolve the problem if there were some missing dependencies.
Conclusion. I geuss a have installed sdl, but wrecked a confirgurationfile or something preventing communication between sdl and the graphic driver.
But that is a wild guess.
This sounds strange.
try: sudo ldconfig
from man ldconfig
"ldconfig creates, updates, and removes the necessary links and cache
(for use by the run-time linker, ld.so) to the most recent shared
libraries found in the directories specified on the command line, in
the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and
/lib). ldconfig checks the header and file names of the libraries it
encounters when determining which versions should have their links
updated. ldconfig ignores symbolic links when scanning for libraries.
"