1

When I do

$ gcc cube.c -lglut -lGL -lGLU -lSDL 
/usr/bin/ld: cannot find -lSDL
collect2: error: ld returned 1 exit status

When I do

$ sudo apt-get install libsdl*
Reading package lists...
Building dependency tree...
Reading state information...
libsdl-image1.2 is already the newest version.
libsdl-image1.2 set to manually installed.
libsdl1.2debian is already the newest version.
libsdl1.2debian set to manually installed.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libsdformat-dev : Depends: libboost-regex-dev but it is not going to be installed
                   Depends: liburdfdom-dev but it is not going to be installed
 libsdl-image1.2-dev : Depends: libtiff-dev
 libsdl-mixer1.2-dev : Depends: libflac-dev (>= 1.2.1) but it is not going to be installed
                       Depends: libvorbis-dev (>= 1.2.0) but it is not going to be installed
 libsdl1.2-dbg : Depends: libsdl1.2debian (= 1.2.15-8ubuntu1) but 1.2.15-8ubuntu1.1 is to be installed
 libsdl1.2-dev : Depends: libsdl1.2debian (= 1.2.15-8ubuntu1) but 1.2.15-8ubuntu1.1 is to be installed
                 Depends: libpulse-dev but it is not going to be installed
 libsdl2-dev : Depends: libpulse-dev but it is not going to be installed
               Depends: libudev-dev but it is not going to be installed

It seems libsdl installation was not successful. While searching about libsdl there are two versions libsdl1 and libsdl2. I am thinking to find some other ways to install them. Anyone have any advice for the installation?

@steeldriver:I did your suggestion and the output was the followings:

$ sudo apt-get update && sudo apt-get upgrade
finished...

$ sudo apt-get install libsdl1.2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libsdl1.2-dev : Depends: libsdl1.2debian (= 1.2.15-8ubuntu1) but 1.2.15-8ubuntu1.1 is to be installed
                 Depends: libpulse-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

A.B. as you requested. Here is output of commands in your comment.

When I did

$ apt-cache policy libsdl1.2-dev
libsdl1.2-dev:
  Installed: (none)
  Candidate: 1.2.15-8ubuntu1
  Version table:
     1.2.15-8ubuntu1 0
        500 http://ubuntu.mirror.crucial.com.au/ trusty/main amd64 Packages

When I did

$ apt-cache policy libsdl1.2debian
libsdl1.2debian:
  Installed: 1.2.15-8ubuntu1.1
  Candidate: 1.2.15-8ubuntu1.1
  Version table:
 *** 1.2.15-8ubuntu1.1 0
        100 /var/lib/dpkg/status
     1.2.15-8ubuntu1 0
        500 http://ubuntu.mirror.crucial.com.au/ trusty/main amd64 Packages

When I did

$ apt-cache policy libpulse-dev
libpulse-dev:
  Installed: (none)
  Candidate: 1:4.0-0ubuntu11
  Version table:
     1:4.0-0ubuntu11 0
        500 http://ubuntu.mirror.crucial.com.au/ trusty/main amd64 Packages

A.B.: When I did. Downgrade happened.

$ sudo apt-get install libsdl1.2debian=1.2.15-8ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  libsdl1.2debian
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 162 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
  libsdl1.2debian
Install these packages without verification? [y/N] y
Get:1 http://ubuntu.mirror.crucial.com.au/ trusty/main libsdl1.2debian amd64 1.2.15-8ubuntu1 [162 kB]
Fetched 162 kB in 0s (243 kB/s)     
dpkg: warning: downgrading libsdl1.2debian:amd64 from 1.2.15-8ubuntu1.1 to 1.2.15-8ubuntu1
(Reading database ... 443054 files and directories currently installed.)
Preparing to unpack .../libsdl1.2debian_1.2.15-8ubuntu1_amd64.deb ...
Unpacking libsdl1.2debian:amd64 (1.2.15-8ubuntu1) over (1.2.15-8ubuntu1.1) ...
Setting up libsdl1.2debian:amd64 (1.2.15-8ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.6) ...

Solved by doug's suggestion

Open up Software & Updates > Updates tab & make sure that 
the first 2 are enabled. (- trusty-security, trusty-updates). 
If one or the other wasn't enabled then do so, 
after that reload sources & proceed.

Thanks for your solution, doug! Thanks to all who participated in this problem especially steeldriver and A.B.!

Evan S
  • 377
  • It looks like your system has a mix of trusty and trusty-updates packages: have you tried doing a sudo apt-get update && sudo apt-get upgrade cycle to try to get your packages in sync, and the sudo apt-get install libsdl1.2-dev? – steeldriver May 20 '15 at 20:04
  • Btw, remember that using * in apt commands do not mean what you seem to think: http://askubuntu.com/questions/210976/apt-get-remove-with-wildcard-removed-way-more-than-expected-why – Rmano May 20 '15 at 20:23
  • @Rmano: I followed guidance on https://tutorialsplay.com/opengl/2014/04/23/textured-cube/ – Evan S May 20 '15 at 21:47
  • @steeldriver: thanks for suggeston. but still the same...I pasted output of terminal on question. – Evan S May 20 '15 at 22:01
  • Do you have any PPAs enabled, that might be holding back those packages? – steeldriver May 21 '15 at 02:49
  • That page is wrong too.... It can work but only by chance – Rmano May 21 '15 at 05:31
  • @Rmano: Which part is wrong? I am a first time OpenGL learner. If you can tell a website explains step by step from setup enviornment to run codes. It would be more than welcome... – Evan S May 21 '15 at 06:11
  • I am not referring to OpenGL. I was speaking about the apt-get command. For what you want to do, the correct command is apt-get install 'libsdl.*'; apt-get needs a regular expression, not a glob pattern. In this case it will probably making no difference, though; it can have messed things before. Have you tried a apt-get install -f to see if it can sort out the dependency knot? – Rmano May 21 '15 at 09:37
  • @Rmano: I tried with libsdl.* still output remain unchanged. I found that the command alright I tried with a livedisc it worked. I also tried to install a dependency package individually as well. In fact it is more on my system issue accessing repository as there are no such a package to install at the end. If I install libpulse-dev then I would get another dependency package and so on. Dig down ends up reaching package not available. – Evan S May 21 '15 at 12:48
  • @steeldriver: You mean under preferences -> Other software ->[ ] PPA's ? If so I have a lot of lines of them. I just executed commands sudo rm -if /etc/apt/sources.list.d/* to clean them all. But still getting unmet dependencies for libsdl1.2debian and libpulse-dev when I executed install libsdl1.2-dev. I am suspecting on my system issue because when I tried with a livedisc worked just perfect. Can you tell what else I can do? I remember I did not get dependency error before. Dependency issue first appeared when update something from software center which I cannot recall now... – Evan S May 21 '15 at 13:36
  • Edit your question and post the output of apt-cache policy libsdl1.2-dev, apt-cache policy libsdl1.2debian, apt-cache policy libpulse-dev – A.B. May 21 '15 at 14:45
  • @A.B.: I put up the output of those commands on my question. Please take a look :-) Thanks. – Evan S May 22 '15 at 20:38
  • Try this: sudo apt-get install libsdl1.2debian=1.2.15-8ubuntu1 – A.B. May 22 '15 at 20:48
  • @A.B.: Thanks for your reply. I put up the output of the command on my question. Please take a look :-) Thanks. – Evan S May 23 '15 at 02:21

2 Answers2

0

Open up Software & Updates > Updates tab & make sure that the first 2 are enabled. (- trusty-security, trusty-updates). If one or the other wasn't enabled then do so, after that reload sources & proceed.

If both where then try switching severs on main page > Download from: use main server. Then reload sources & see.

You need libsdl1.2-dev (1.2.15-8ubuntu1.1) to be available & it should be, was released in 04/14 - http://packages.ubuntu.com/trusty-updates/libsdl1.2-dev

doug
  • 17,026
-2

Try something like gcc cube.c $(pkg-config --libs glut gl glu sdl). Not totally sure about those package names though.