在ubuntu 18.04上安装v8js

时间:2018-10-30 16:32:02

标签: ubuntu vagrant v8 homestead v8js

我已使用ubuntu 18.04在本地计算机上安装了laravel homestead。我想在上面安装v8js,我已经检查了一些教程,但是我仍然不知道该怎么做。我通过

安装v8js js
$ sudo pecl install v8js

我不知道在此字段中键入什么,因此我将其保留为自动检测:Please provide the installation prefix of libv8 [autodetect] :

我收到以下日志和错误消息:

vagrant@autossr:/$ sudo pecl install v8js
PHP Warning:  PHP Startup: Unable to load dynamic library 'v8js.so' (tried: /usr/lib/php/20170718/v8js.so (/usr/lib/php/20170718/v8js.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/v8js.so.so (/usr/lib/php/20170718/v8js.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading v8js-2.1.0.tgz ...
Starting to download v8js-2.1.0.tgz (101,553 bytes)
.......................done: 101,553 bytes
28 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
Please provide the installation prefix of libv8 [autodetect] :
building in /tmp/pear/temp/pear-build-rooth8NOvW/v8js-2.1.0
running: /tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
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-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20170718
checking for PHP installed headers prefix... /usr/include/php/20170718
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 1.0.1 (ok)
checking for gawk... gawk
checking for V8 Javascript Engine... yes, shared
checking for V8 files in default path... found in /usr
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 C standard version... c++11
checking how to allow c++11 narrowing... -Wno-narrowing
checking for libv8_libplatform... configure: error: could not find libv8_libplatform library
ERROR: `/tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js' failed

是否可以安装它?

1 个答案:

答案 0 :(得分:0)

在安装php import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; final public class TestCodeGUI { private JFrame frame; private JTable table; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { TestCodeGUI window = new TestCodeGUI(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public TestCodeGUI() { initialize(); } private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 370, 168); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 330, 103); frame.getContentPane().add(scrollPane); table = new JTable(); scrollPane.setViewportView(table); table.setModel(new DefaultTableModel( new Object[][] { {new CustomClass("00"), Integer.parseInt("01"), "02"}, {new CustomClass("10"), Integer.parseInt("11"), "12"}, {new CustomClass("20"), Integer.parseInt("21"), "22"}, {new CustomClass("30"), Integer.parseInt("31"), "32"}, }, new String[] { "Column 0", "Column 1", "Column 2" } ) { Class[] columnTypes = new Class[] { CustomClass.class, Integer.class, String.class }; public Class getColumnClass(int columnIndex) { return columnTypes[columnIndex]; } }); System.out.println("Initialize complete"); } } class CustomClass { int value = 0; public CustomClass(String newValue) throws NumberFormatException { System.out.println("CustomClass constructor with \"" + newValue + "\""); value = Integer.parseInt(newValue); if(value<0 || value>100) throw new NumberFormatException("value out of range"); } public String toString() { String s = value+""; System.out.println("CustomClass toString returning \"" + s + "\""); return s; } } 扩展名之前,您需要先安装v8js库。

我发现根本不使用v8,而是更轻松地构建和安装pecl库和v8

我能够使用在v8js github上找到的this guide来做到这一点。