node-mongodb icon indicating copy to clipboard operation
node-mongodb copied to clipboard

Will not compile

Open defrex opened this issue 14 years ago • 7 comments

I'm on ubuntu 9.10 with node 0.1.32 defrex@laps:~/Desktop/node-mongo$ node-waf configure build Check for program g++ or c++ : /usr/bin/g++ Check for program cpp : /usr/bin/cpp Check for program ar : /usr/bin/ar Check for program ranlib : /usr/bin/ranlib Checking for g++ : ok
Checking for node prefix : ok /usr/local 'configure' finished successfully (0.077s) Waf: Entering directory /home/defrex/Desktop/node-mongo/build' [1/3] cxx: src/mongo.cc -> build/default/src/mongo_1.o [2/3] cxx: src/bson.cc -> build/default/src/bson_1.o ../src/mongo.cc: In member function ‘void Connection::WriteSendBuffer()’: ../src/mongo.cc:367: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ ../src/mongo.cc:368: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ [3/3] cxx_link: build/default/src/mongo_1.o build/default/src/bson_1.o -> build/default/mongo.node /usr/bin/ld: cannot find -lmongoc collect2: ld returned 1 exit status Waf: Leaving directory/home/defrex/Desktop/node-mongo/build' Build failed: -> task failed (err #1): {task: cxx_link mongo_1.o,bson_1.o -> mongo.node}

defrex avatar Mar 31 '10 16:03 defrex

I have same issue. I can't compile I am on ubuntu 10.0.4

The mongo-c driver got built properly but node-mongodb is not. Any pointers?

Checking for program g++ or c++ : /usr/bin/g++ Checking for program cpp : /usr/bin/cpp Checking for program ar : /usr/bin/ar Checking for program ranlib : /usr/bin/ranlib Checking for g++ : ok
Checking for node prefix : ok /usr/local 'configure' finished successfully (0.043s) Waf: Entering directory /opt/node-mongodb/build' [3/3] cxx_link: build/default/src/mongo_1.o build/default/src/bson_1.o -> build/default/mongo.node /usr/bin/ld: /opt/node-mongodb/mongo-c-driver/libmongoc.a(mongo.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /opt/node-mongodb/mongo-c-driver/libmongoc.a: could not read symbols: Bad value collect2: ld returned 1 exit status Waf: Leaving directory `/opt/node-mongodb/build' Build failed: -> task failed (err #1): {task: cxx_link mongo_1.o,bson_1.o -> mongo.node}

kesavkolla avatar May 12 '10 17:05 kesavkolla

Ok I figure out the issue. The gcc needs the -fPIC flag to make the shared objects. I modified SConstruct file under mongo-c-driver and added -fPIC flag to CPPFLAGS environment flags. After the change I could build the node-mongo properly.

kesavkolla avatar May 12 '10 17:05 kesavkolla

I believe you figured out your issue, trying to compile this on Debian still has the cannot find -lmongoc issue. I imagine it's just a missing requirement that's not mentioned or I haven't seen.

xealot avatar Oct 21 '10 20:10 xealot

Also getting this error. I tried to add the -fPIC flag to the SConstruct file, but it still won't work. Using Ubuntu 10.04 x64.

Here's the error in full:

'configure' finished successfully (0.023s) Waf: Entering directory /home/hynese/Desktop/Dropbox/www/socket/node-mongodb/build' [2/3] cxx: src/bson.cc -> build/default/src/bson_1.o [1/3] cxx: src/mongo.cc -> build/default/src/mongo_1.o ../src/mongo.cc: In member function ‘void Connection::WriteSendBuffer()’: ../src/mongo.cc:367: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ ../src/mongo.cc:368: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘long int’ [3/3] cxx_link: build/default/src/mongo_1.o build/default/src/bson_1.o -> build/default/mongo.node /usr/bin/ld: /home/hynese/Desktop/Dropbox/www/socket/node-mongodb/mongo-c-driver/libmongoc.a(mongo.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /home/hynese/Desktop/Dropbox/www/socket/node-mongodb/mongo-c-driver/libmongoc.a: could not read symbols: Bad value collect2: ld returned 1 exit status Waf: Leaving directory `/home/hynese/Desktop/Dropbox/www/socket/node-mongodb/build' Build failed: -> task failed (err #1): {task: cxx_link mongo_1.o,bson_1.o -> mongo.node}

ghost avatar Nov 01 '10 12:11 ghost

install scon through package manager.. this issue will be solved

pradeepthundiyil avatar Nov 11 '10 12:11 pradeepthundiyil