Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Running into a problem with v8js-0.1.2 (beta) - I'm seeing others have success on the net but regardless of what platform/OS I'm running, I always hit the same problem.

I'm currently attempting to build the module, both directly via pecl, and building after using phpize on the source. It finds the V8 install, configure is successful, and then make errors out:

/usr/local/src/v8js-0.1.2/v8js.cc: In function 'int zm_startup_v8js(int, int)':
/usr/local/src/v8js-0.1.2/v8js.cc:1135: error: 'PHP_V8_VERSION' was not declared in this scope
/usr/local/src/v8js-0.1.2/v8js.cc: In function 'void zm_info_v8js(zend_module_entry*)':
/usr/local/src/v8js-0.1.2/v8js.cc:1231: error: 'PHP_V8_VERSION' was not declared in this scope
make: *** [v8js.lo] Error 1

If I add #define PHP_V8_VERSION "0.1.2" in v8js.cc, I then get:

/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8js.la] Error 1

which is make complaining because it's not using the provided v8 lib path and instead is trying to find libv8.so in the default lib path. If I symlink it into place, I get:

/usr/bin/ld: skipping incompatible /usr/local/lib/libv8.a when searching for -lv8
/usr/bin/ld: cannot find -lv8
collect2: ld returned 1 exit status
make: *** [v8js.la] Error 1

when libv8.a is directly from the newly compiled V8. Anyone have any thoughts?

Addendum: I would've tagged this v8 and v8js but I don't have enough rep yet. Sorry! :(


After trying to rebuild V8 (via scons) with library=shared, I'm presented with more problems:

obj/sample/shell/release/shell.o: In function `RunMain(int, char**)':
shell.cc:(.text+0xf14): undefined reference to `v8::internal::Thread::Join()'
shell.cc:(.text+0xff4): undefined reference to `v8::internal::Thread::Thread(v8::internal::Isolate*, v8::internal::Thread::Options const&)'
shell.cc:(.text+0x1008): undefined reference to `v8::internal::Thread::Start()'
shell.cc:(.text+0x10a3): undefined reference to `v8::internal::OS::CreateSemaphore(int)'
shell.cc:(.text+0x10b2): undefined reference to `v8::internal::OS::CreateSemaphore(int)'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':
shell.cc:(.text._ZN11SourceGroup13IsolateThreadD0Ev[SourceGroup::IsolateThread::~IsolateThread()]+0x14): undefined reference to `v8::internal::Thread::~Thread()'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':
shell.cc:(.text._ZN11SourceGroup13IsolateThreadD1Ev[SourceGroup::IsolateThread::~IsolateThread()]+0xe): undefined reference to `v8::internal::Thread::~Thread()'
collect2: ld returned 1 exit status
scons: *** [shell] Error 1
scons: building terminated because of errors.

Should I be using a version of V8 other than latest? Also, if I left it as-is (static, using libv8.a), is it possible to use a static PHP module instead? For whatever reason, running configure on the v8js-0.1.2 source does NOT allow me to disable shared and enable static; they're both enabled by default, and passing --disabled-shared or --enable-shared=no (opposite of default yes value) leaves shared enabled and disables static.

Edit 2:

After a solid 3+hrs of repeated compiling the problem seems to be that you cannot both enable sample=shell while using library=shared. This doesn't seem reasonable and AFAICT is likely a bug, however, using arch=x64 and library=shared worked for me, and then I was able to link libv8.so to the proper place and compile the v8js PHP extension.

The problem now is that PHP doesn't seem to actually be able to find the shared object:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/v8js.so' - libv8.so: cannot open shared object file: No such file or directory in Unknown on line 0

when libv8.so resides at /usr/local/v8/libv8.so. I've tried appending that directory to $PATH, linking libv8.so to the extension directory, etc. Any ideas?

share|improve this question

2 Answers 2

configure script can have a hard time determining the V8 version if you don't have V8 installed in the usual location (directly in /usr or /usr/local). I used: export CXXFLAGS="-I/usr/local/mydir/include -Wl,--rpath,/usr/local/mydir/lib" before running the configure script ( --with-v8js=/usr/local/mydir ) so that it could find the v8 version.

Really it's a bug in v8js that the configure script doesn't exit 1 when it can't find the V8 version.

share|improve this answer

You need libv8.so (shared library, .a is usually not a shared lib) somewhere where ld would find it - in /usr/lib/, /usr/local/lib/ or at any path specified in /etc/ld.so.conf (you could add any directory you want there)

share|improve this answer
Rebuilding V8 with library=shared (totally spaced while I was building it)... I'll let you know how it goes. Thanks! –  mway Mar 27 '11 at 8:17
Updated the question with more errors from rebuilding V8 with library=shared. :( –  mway Mar 27 '11 at 19:35
Hmm, usual reason for 'No such file' error is that there is no such file. It's very simple to make error in path. Have you tried to copy-paste path and copy v8js.so to /usr/local/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/ ? –  rvs Mar 28 '11 at 7:09
Another suggestion: v8js.so cannot find its dependencies. run ldd /path/to/v8js.so and check if there any files missing. You might need to add /usr/local/v8/ and/or some other dirs to /etc/ld.so.conf so system could find libs there. –  rvs Mar 28 '11 at 7:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.