Sign up ×
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/ In function 'int zm_startup_v8js(int, int)':
/usr/local/src/v8js-0.1.2/ error: 'PHP_V8_VERSION' was not declared in this scope
/usr/local/src/v8js-0.1.2/ In function 'void zm_info_v8js(zend_module_entry*)':
/usr/local/src/v8js-0.1.2/ 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, I then get:

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

which is make complaining because it's not using the provided v8 lib path and instead is trying to find 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: *** [] 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**)': undefined reference to `v8::internal::Thread::Join()' undefined reference to `v8::internal::Thread::Thread(v8::internal::Isolate*, v8::internal::Thread::Options const&)' undefined reference to `v8::internal::Thread::Start()' undefined reference to `v8::internal::OS::CreateSemaphore(int)' undefined reference to `v8::internal::OS::CreateSemaphore(int)'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':[SourceGroup::IsolateThread::~IsolateThread()]+0x14): undefined reference to `v8::internal::Thread::~Thread()'
obj/sample/shell/release/shell.o: In function `SourceGroup::IsolateThread::~IsolateThread()':[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 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/' - cannot open shared object file: No such file or directory in Unknown on line 0

when resides at /usr/local/v8/ I've tried appending that directory to $PATH, linking 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 (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/ (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 to /usr/local/php-5.3.6/lib/php/extensions/no-debug-non-zts-20090626/ ? – rvs Mar 28 '11 at 7:09
Another suggestion: cannot find its dependencies. run ldd /path/to/ and check if there any files missing. You might need to add /usr/local/v8/ and/or some other dirs to /etc/ 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.