Couchdb: Support additional INCLUDE/LIB paths during compile

Created on 30 May 2017  路  19Comments  路  Source: apache/couchdb

Problem

Try to build CouchDB 2.0.0 from the source on CentOS 6.9 stopped with this problem:

Compiling /home/USER/tmp/apache-couchdb-2.0.0/src/couch/priv/couch_js/http.c
/home/USER/tmp/apache-couchdb-2.0.0/src/couch/priv/couch_js/http.c:18:19: Warning: jsapi.h: No such file or directory

Setup

I've build ERLANG OTP 17.5 and SpiderMonkey 1.8.5 in the local user directory.
They are available in $HOME/include and $HOME/lib.

What i tried

Give configure the paths like in earlier CouchDB versions (./configure --with-js-lib=$HOME/lib --with-js-include=$HOME/include/js) doesn't work and was ignored.

I tried to set the paths as compiler vars.

CFLAGS=-I$HOME/include
LDFLAGS=-L$HOME/lib

But it also doesn't work. The compile run breaks.

Another try:

export CPATH=$HOME/include:$LD_LIBRARY_PATH
export LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/lib:$LD_LIBRARY_PATH

Make always fails at the same point.

build chore need more info

Most helpful comment

installing libmozjs185-dev fixed my problem

All 19 comments

HI @NoodleBB, at present we don't support searching for include headers or shared libraries anywhere other than the system default. Our configure script is not based on autotools - none of the environment variables you specified will work.

It is possible to update https://github.com/apache/couchdb/blob/master/src/couch/rebar.config.script to make this work specifically for couchjs in a platform-neutral fashion, by changing how we handle the JS_CFLAGS and JS_LDFLAGS variables. We'd be happy to accept a pull request here that doesn't break our current build process.

Hi @wohali.

at present we don't support searching for include headers or shared libraries anywhere other than the system default.

Not very handy.

It is possible to update https://github.com/apache/couchdb/blob/master/src/couch/rebar.config.script to make this work (...)

I tried it to change it that way...

{unix, freebsd} ->
    {"-DHAVE_CURL -I$HOME/include", "-DHAVE_CURL -L$HOME/lib -lmozjs185 -lcurl"};

...but it fails at the same point again.

Yeah, that won't work, because there is no $ENVVAR expansion with that syntax inside of a rebar.config file.

If you just want it compiling for now, hard-code the path to your home directory instead of using $HOME.

If you just want it compiling for now, (...)

Yes: now.
I wanted to demonstrate my bosses and the IT-Department the advantages of CouchDB over Access in an actual use case. - ...and i don't get the the latest version of CouchDB installed.

(...) hard-code the path to your home directory instead of using $HOME.

By the way...

{unix, freebsd} ->
   {"-DHAVE_CURL -I/home/syncer/include", "-DHAVE_CURL -L/home/syncer/lib -lmozjs185 -lcurl"};

...also fails. Same point, same error.

That line only applies if you specify -c or --with-curl to configure. Did you?

That line only applies if you specify -c or --with-curl to configure. Did you?

Nope. I didn't know. But now...

$ ./configure --with-curl
==> configuring couchdb in rel/couchdb.config
You have configured Apache CouchDB, time to relax. Relax.

Nothing changed. Make still fails. Same error.

Try -I/home/syncer/include/js.

Try -I/home/syncer/include/js

I did. Build fails. Same error.

I am having he same problem.... have tried the same things and end up in the same place....

I thought my spidermonkey was installed in the default location

/usr/local/lib/libmozjs185.so and
/usr/local/include/js/

If that is not the default location where do I need to move it to?

Default location should be under /usr/lib/libmozjs185.so and /usr/include/js.

So sorry for the inconvenience here. Pull requests welcome.

That did the trick... THANKS!

Added needhelp label, closing for inactivity until somebody sends a PR

installing libmozjs185-dev fixed my problem

Yeah, I had to download https://launchpad.net/ubuntu/bionic/amd64/libmozjs185-dev/1.8.5-1.0.0+dfsg-7
deb version from here and install on ubuntu 18.

FYI libmozjs185{-dev} is no longer available in the Ubuntu repos.

It has been deleted and replaced by libmozjs-52.

@lag-linaro Yes, we will be supplying our own packages for libmozjs185.

@wohali do you have a time-line for this?

@lag-linaro already done for 2.1.2

see http://docs.couchdb.org/en/2.1.2/install/unix.html#installation-using-the-apache-couchdb-convenience-binary-packages

Was this page helpful?
0 / 5 - 0 ratings