cloudant / bigcouch

Putting the 'C' back in CouchDB
http://bigcouch.cloudant.com/
Apache License 2.0
565 stars 52 forks source link

couch_js doesn't build on centos 5.6 #82

Open benoitc opened 13 years ago

benoitc commented 13 years ago

When you try to build couch_js on this platform you get this error :

==> couchjs (compile)
scons: Reading SConscript files ...
Checking for C library m... yes
Checking for C library pthread... yes
Checking for C library curl... yes
Checking for C library nspr4... yes
Checking for C header file mozjs/jsapi.h... no
Checking for C header file js/jsapi.h... no
Checking for C header file jsapi.h... yes
Checking for C library mozjs185-1.0... no
Checking for C library mozjs... no
Checking for C library js... yes
Checking whether JS_NewCompartmentAndGlobalObject is declared... no
Checking whether JS_ThrowStopIteration is declared... no
Checking whether JS_GetStringCharsAndLength is declared... no
Checking for C type JSScript*... yes
scons: done reading SConscript files.
scons: Building targets ...
scons: Configure: creating build/config.h
c++ -o build/main.o -c -g -O2 -DXP_UNIX build/main.c
In file included from build/sm170.c:19,
                 from build/main.c:20:
build/utf8.h:19:7: warning: no newline at end of file
c++ -o build/http.o -c -g -O2 -DXP_UNIX build/http.c
In file included from build/http.c:18:
build/utf8.h:19:7: warning: no newline at end of file
build/http.c: In function 'JSBool go(JSContext*, JSObject*, HTTPData*, char*, size_t)':
build/http.c:394: error: 'CURLOPT_SEEKFUNCTION' was not declared in this scope
build/http.c:395: error: 'curl_seek_callback' was not declared in this scope
build/http.c:440: error: 'CURLOPT_SEEKDATA' was not declared in this scope
scons: *** [build/http.o] Error 1
scons: building terminated because of errors.
benoitc commented 13 years ago

centos 5.6 only provides curl 7.15 and CURLOPT_SEEKFUNCTION have been added in 7.18. Followin patch fix this:

--- a/couchjs/c_src/SConscript
+++ b/couchjs/c_src/SConscript
@@ -51,9 +51,13 @@ if not env.GetOption('clean'):

     require_lib('m')
     require_lib('pthread')
-    require_lib('curl')
     require_lib('nspr4')

+    ## check curl
+    if conf.CheckHeader('curl/curl.h'):
+        if conf.CheckDeclaration('CURLOPT_SEEKFUNCTION', 'curl/curl.h'):
+            conf.Define('WITH_CURL', 1)
+    
     ## check for SpiderMonkey development header
     if conf.CheckHeader('mozjs/jsapi.h'):
         jsapi = 'mozjs/jsapi.h'
davisp commented 13 years ago

lgtm

kocolosk commented 13 years ago

LGTM as well

davisp commented 13 years ago

Hrm. But its not. Hacking together a fix. We've needed this for awhile anyway.

davisp commented 13 years ago

@benoitc Can you try this version?

https://github.com/cloudant/bigcouch/commit/1cd3eb1

benoitc commented 13 years ago

works for me .