Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

Since Pangolin, I can't manage to link any program with libcurl, even the example provided with libcurl themselves.

I have installed libcurl:

sudo apt-get install libcurl4-gnutls-dev

Then as the README says in /usr/share/doc/libcurl4-gnutls-dev/examples I tried compiling the simplest program in the examples (copied it to /tmp before to avoid write access issues)

`curl-config --cc --cflags --libs` -o simple simple.c

And then I get:

simple.c:(.text+0x99): undefined reference to `curl_easy_init'
simple.c:(.text+0xc6): undefined reference to `curl_easy_setopt'
simple.c:(.text+0xd2): undefined reference to `curl_easy_perform'
simple.c:(.text+0xe1): undefined reference to `curl_easy_cleanup'
collect2: ld returned 1 exit status

It worked like a charm with 10.04, but now it does not anymore on 12.04.

Any idea on how to link sucessfuly with libcurl in 12.04?

Should I report to launchpad, as obviously, there is something broken, either in the libraries installation, or at least in the documentation?

It could be a issue with new multiarch, something I do wrong on the command line related to that new multiarch, or the libs were not installed in the directories expected by multiarch?

share|improve this question

Answered by launchpad

The documentation in /usr/share/doc/libcurl4-gnutls-dev/html/curl-config.html is indead wrong, and thus this is a documentation bug.

Instead or reading on line 88:

`curl-config --cc --cflags --libs` -o example example.c

it should read

`curl-config --cc --cflags` -o example example.c `curl-config --libs`

This places the shared libraries AFTER the object we want to link, and now it works.

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.