phpv8 / v8js

V8 Javascript Engine for PHP — This PHP extension embeds the Google V8 Javascript Engine
http://pecl.php.net/package/v8js
MIT License
1.84k stars 200 forks source link

checking for V8 version... NONE configure: error: could not determine libv8 version #123

Closed sKenDread closed 10 years ago

sKenDread commented 10 years ago

Ive been tearing my hair out trying to figure thois one out. Ive tried both comping using the basic methods on here and also from this site https://registry.hub.docker.com/u/stesie/v8js/dockerfile/ and go to the DockerFile tab to see the code.

Im on windows 8 and i am runung this through Cygwin ... heres a snippet

$ ./configure --with-v8js=/usr/local/v8 checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-unknown-cygwin checking host system type... x86_64-unknown-cygwin checking target system type... x86_64-unknown-cygwin checking for PHP prefix... /usr/local checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib checking for PHP extension directory... /usr/local/lib/php/extensions/debug-zts-20121212 checking for PHP installed headers prefix... /usr/local/include/php checking if debug is enabled... yes checking if zts is enabled... yes checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for V8 Javascript Engine... yes, shared checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for V8 version... NONE configure: error: could not determine libv8 version

stesie commented 10 years ago

hmm, I wanted to give it a try ... since I don't have a Windows box I created a Windows Server 2012 instance on Amazon EC2 ...

but I don't even get v8 to compile with cygwin :-/

Which version did you use? Any special flags to make there?

cheers, stesie

NB: the config.m4 code currently is hard-coded to .so (instead of .dll common under Windows), besides it wants to -rpath link, which doesn't seem to work under Windows likewise.

sKenDread commented 10 years ago

Hi Stesie, I installed Cygwin64 and made sure every single option was installed. This took quite a few hours so I left my machine running all weekend. Upon returning to work today I found it was completely installed.

These are the steps I took. most of them from this link: https://code.google.com/p/v8/issues/detail?id=2992#c2

I am still learning how to do all of this so this is very new to me. After initiating build the machine didn't show any thing apart from me noticing the Microsoft compiler in task bar was active for more than 30 mins.

Although some of the below didn't work, I made a few changes: But after all that. It still threw errors. I am learning though //=================================================================

  1. cygwin64 git clone git://github.com/v8/v8.git v8 && cd v8
  2. cygwin64 svn co http://gyp.googlecode.com/svn/trunk build/gyp
  3. cygwin64 svn co https://src.chromium.org/chrome/trunk/deps/third_party/icu46 third_party/icu
  4. cygwin64 svn co http://src.chromium.org/svn/trunk/tools/third_party/python_26@89111 third_party/python_26
  5. cygwin64 svn co http://src.chromium.org/svn/trunk/deps/third_party/cygwin@66844 third_party/cygwin
  6. Download and install Python (make sure it adds python.exe to PATH during install) http://www.python.org/download/
  7. MS-DOS prompt (goto the the directory where v8 is located e.g. cd c:\blah\v8) Note: this didnt work? python build\gyp_v8 So also used cygwin
  8. cygwin64 third_party/python_26/python.exe build/gyp_v8 -Dtarget_arch=x64
  9. MS-DOS prompt - (replace "9.0" with your version etc. //============ NOT THIS============== "c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com" /build Release build\All.sln //============ BUT THIS ============== In cygwin: /cygdrive/c/Program\ Files\ (x86)/Microsoft\ Visual\ Studio\ 11.0/Common7/IDE/WDExpress.exe /build Release build/all.sln

stesie commented 10 years ago

Ahh, okay, so you ended up compiling v8 with Visual Studio and have a v8.dll file around somewhere, right?

I initially thought you (successfully) compiled v8 with g++ or mingw instead of Visual Studio.

Tonight I tried the same, i.e. compile v8 with Visual Studio, ... successfully. However I've used VS 2013 Express

... I think it's possible bot so far have no clue to use the DLL with Cygwin (v8js) then. Contrary I was considering building PHP & V8Js with Visual Studio also. But had no time so far.

sKenDread commented 10 years ago

Oh please would you tell me how you did it. please excuse my explanation. What you have done, I am trying to do myself. I am also using VS 2013 Express

sKenDread commented 10 years ago

Just an update. Apologies... I did not say thank you previously for responding.The previous example was to compile V8. Which I have managed to do successfully... I think. The output is in the build/release folder. v8_screenshot Next, I tried compiling V8js using

  1. cd /tmp
  2. git clone https://github.com/preillyme/v8js.git
  3. cd v8js
  4. phpize
  5. ./configure --with-v8js=/v8
  6. make
  7. sudo make install

The first attempt stopped after not finding the local V8 files. v8js_compile_first_attempt

I Looked at the config file and found that it was looking for V8 in the /usr/local directory. So I copied over the include folder from V8 to usr/local. Am I doing something wrong here? v8js_compile_sec_attempt

sKenDread commented 10 years ago

Sorry for the confusion. It looks like we are at the same stage. Yes V8 compiles. No V8Js wont in windows. On line 4272 I see the SEARCH_PATH array SEARCH_PATH="/usr/local /usr" Which looks like its trying to find the V8 comp there.

stesie commented 10 years ago

yes, this is you have a v8.dll file (together with some more *.dll files) around.

The problem is, that g++ (as part of cygwin) cannot directly link against .dll file but it needs it's own intermediary format (aka import library); i.e. I think in order to go with php on cygwin with v8 compiled in VS 2013 we first need to build the import library ...

Alternative still: build PHP with VS as well and V8Js in turn (with VS)

But I need to dig deeper first, maybe towards the weekend.

stesie commented 10 years ago

Just to let you know, still work in progress, but ...

rdesktop - 54 172 15 181_001

it works to some degree :) ... as you can see it launches the engine and prints the text. Somehow it crashes on shutdown however.

For the moment I had to comment out portions of V8Js code which cannot be compiled with Visual Studio 2013 unfortunately. But I'll follow up soon.

I completely ditched cygwin, since

... hence the need to compile PHP with Visual Studio ... the problem with that however, windows.php.net seems to still emphasize on VS 2012 ... however V8 cannot be built with VS 2012 any longer. And you cannot link a v8 built with VS 2013 against a PHP, compiled with VS 2012; the problematic thing is that windows.php.net provides the dependencies for VS 2012 only ...

... anyways, not too much of a problem if you just want to have PHP CLI with V8Js :)

Unfortunately I'm currently stuck not knowing how to debug the v8 crash on exit ... ... and I'll have to apply some fixes to V8Js ...

For the moment I hope that's enough for a teaser :D

sKenDread commented 10 years ago

Wow awesome. This is great news. As I said before I am still learning. But I am more than willing to help if I can

stesie commented 10 years ago

... test suite passes 55 of 77 tests :-)

Current set of patches is at https://github.com/stesie/v8js/compare/issue-123

stesie commented 10 years ago

... test suite now passes 71 tests, 2 skipped because of dependencies, 4 failed. 3 of these are related to DateTime/timezone stuff which probably just needs some love. Last not least the recursive error-unwind stuff fails (which doesn't reliably work on Linux likewise however).

Patches branch updated.

stesie commented 10 years ago

I've now merged my Windows related fixes. Apart from the recursive error-unwind stuff the test suite passes now.

Besides I've added a file README.Win32.md outlining how to build v8 and php (including v8js).

Jenkins has build jobs on Windows as well now, see https://jenkins.brokenpipe.de/job/windows-v8js/ I've created jobs for PHP 5.5.18 and 5.6.3 both with and without thread safety.