Using curl/libcurl in a C Ruby extension?

You need to tell mkmf to link to libcurl when building your extension. The command to use is have_library In your exconf. Rb add have_library("curl", "curl_easy_init") before the call to create_makefile Also, I don't think you need the dir_config(extension_name) line (On a Mac, you can see what libraries are linked to a binary with otool -L Try otool -L test.

Bundle before and after adding have_library you should see a line something like usr/lib/libcurl.4. Dylib (compatibility version 6.0.0, current version 6.1.0) added. ).

You need to tell mkmf to link to libcurl when building your extension. The command to use is have_library. In your exconf.

Rb, add have_library("curl", "curl_easy_init") before the call to create_makefile. Also, I don't think you need the dir_config(extension_name) line. (On a Mac, you can see what libraries are linked to a binary with otool -L.

Try otool -L test. Bundle before and after adding have_library, you should see a line something like /usr/lib/libcurl.4. Dylib (compatibility version 6.0.0, current version 6.1.0) added.).

You're absolutely right. That was what was missing. I did find it out the hard way before you posted your answer but it is nice to know about otool, which is very useful.Is the "curl_easy_init" part necessary?

What does it do? – Dana Woodman Jun 7 at 4:47 @Dana I'm not really sure what the second arg is for, it seems to work without it. I think maybe it's so you can check that the library you want actually has a given function.

– matt Jun 8 at 2:06 Yes I think you're right. Have_library("curl") works just fine. Thanks again!

– Dana Woodman Jun 8 at 23:15.

Symbol not found: _curl_easy_init sounds like a link error to me. It seems like you should be passing some flags to your linker (see curl-config --libs).

Cam, thanks for your answer! It did end up being a linker issue, but matt's answer was a bit more specific. Thanks for the info though.

– Dana Woodman Jun 7 at 4:52.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions