0

I wrote a little C-program which uses libcurl and it's SMTP-capabilities in particular.

Since the version/the supported protocols of host-installed libcurl doesn't quite fit my needs I compiled a version of curl/libcurl in my home-directory.

I configured my PATH so I can use my own compiled version of curl, curl -V looks fine, exactly how I need it.

With help of curl-config I compiled my program like this:

gcc -I/home/me/include -o my-program my-program.c -L/home/me/lib -lcurl

If I call the programm from the shell it works like expected without any errors.

It gets tricky if I call it through cron which leads to this error:

curl_easy_perform() failed: Unsupported protocol

The Unsupported protocol error indicates that the wrong build of libcurl is used because the host-installed curl indeed does not have SMTP-support.

I already tried setting PATH like in the shell (/home/me/bin) and C_INCLUDE_PATH like suggested here (/home/me/include) but neither solved my problem.

Where is my fallacy? Any suggestions?

Thanks, Tim

Community
  • 1
  • 1
afk
  • 123
  • 7

1 Answers1

1

You need to specify path to curl library at LD_LIBRARY_PATH environment variable. C_INCLUDE_PATH is used for paths to header files.

Oleksandr Kravchuk
  • 5,963
  • 1
  • 20
  • 31
  • Thanks. This actually worked out. I didn' considered LD_LIBRARY_PATH because of [this](http://stackoverflow.com/questions/18241517/c-include-path-vs-ld-library-path) article. – afk Jan 28 '15 at 10:54