Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm struggling in the attept to compile c++ with SDL2. I've done as always:

  1. checkout the code (both from mercurial and
  2. ./configure, make, sudo make install

But it keeps to say:

/usr/bin/ld: error: cannot find -lSDL2

I need to get working on my source code quickly and on 13.04 and 13.10 these operations always led me to working libs. Now back on 12.04 something strange is happening. Also the make install instructions said:

Libraries have been installed in:
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR' 
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
 during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
 during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/'

can someone please elaborate a little bit on these instructions, since i don't seem to get it?

echoing both variables shows they're empty, also i'm on a 64 bit version of 12.04 (it must matter since on both 13.04/13.10 no problems at all)

share|improve this question

First, run:

$ ./configure

Then create a directory and go into it:

$ md build && cd ./build

Then run make:

$ ../make

Finally, install it:

$ sudo ../make install

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.