wasmer-php
wasmer-php copied to clipboard
centos7 collect2: error: ld returned 1 exit status
centos 7 php7.3
creating libtool
appending configuration tag "CXX" to libtool
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC...
checking if g++ static flag works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... unsupported
configure: creating ./config.status
config.status: creating config.h
/bin/sh /xiaolu/root/php-ext-wasm/extension/libtool --mode=compile g++ -I. -I/xiaolu/root/php-ext-wasm/extension -DPHP_ATOM_INC -I/xiaolu/root/php-ext-wasm/extension/include -I/xiaolu/root/php-ext-wasm/extension/main -I/xiaolu/root/php-ext-wasm/extension -I/www/server/php/73/include/php -I/www/server/php/73/include/php/main -I/www/server/php/73/include/php/TSRM -I/www/server/php/73/include/php/Zend -I/www/server/php/73/include/php/ext -I/www/server/php/73/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -c /xiaolu/root/php-ext-wasm/extension/wasm.cc -o wasm.lo
mkdir .libs
g++ -I. -I/xiaolu/root/php-ext-wasm/extension -DPHP_ATOM_INC -I/xiaolu/root/php-ext-wasm/extension/include -I/xiaolu/root/php-ext-wasm/extension/main -I/xiaolu/root/php-ext-wasm/extension -I/www/server/php/73/include/php -I/www/server/php/73/include/php/main -I/www/server/php/73/include/php/TSRM -I/www/server/php/73/include/php/Zend -I/www/server/php/73/include/php/ext -I/www/server/php/73/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -c /xiaolu/root/php-ext-wasm/extension/wasm.cc -DPIC -o .libs/wasm.o
/bin/sh /xiaolu/root/php-ext-wasm/extension/libtool --mode=link cc -DPHP_ATOM_INC -I/xiaolu/root/php-ext-wasm/extension/include -I/xiaolu/root/php-ext-wasm/extension/main -I/xiaolu/root/php-ext-wasm/extension -I/www/server/php/73/include/php -I/www/server/php/73/include/php/main -I/www/server/php/73/include/php/TSRM -I/www/server/php/73/include/php/Zend -I/www/server/php/73/include/php/ext -I/www/server/php/73/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o wasm.la -export-dynamic -avoid-version -prefer-pic -module -rpath /xiaolu/root/php-ext-wasm/extension/modules wasm.lo -Wl,-rpath,/xiaolu/root/php-ext-wasm/extension/. -L/xiaolu/root/php-ext-wasm/extension/. -lwasmer_runtime_c_api
cc -shared .libs/wasm.o -L/xiaolu/root/php-ext-wasm/extension/. -lwasmer_runtime_c_api -Wl,-rpath -Wl,/xiaolu/root/php-ext-wasm/extension/. -Wl,-soname -Wl,wasm.so -o .libs/wasm.so
/usr/bin/ld: .libs/wasm.o: relocation R_X86_64_32S against symbol `wasm_array_buffer_class_entry_handlers' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [wasm.la] 错误 1
error: Recipe `php` failed with exit code 2
Ah, this -fPIC
error… I don't know how to fix it yet, except by running gcc
by hand as I did for CircleCI. Let's keep this issue opened for the moment the time I find a solution.
(⊙o⊙)… I've met the trouble too
ubuntu bionic php 7.3
same
How do you build the extension?
EDIT: Nevermind, i've put the source of this extension on a non-persistant storage. It now works.
When using the instructions from the CircleCI configuration, the extension gets compiled, but cannot be loaded. Any advice here?
PHP Warning: PHP Startup: Unable to load dynamic library 'wasm.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20180731/wasm.so (libwasmer_runtime_c_api.so: failed to map segment from shared object)) in Unknown on line 0
on PHP 7.2
PHP Warning: PHP Startup: Unable to load dynamic library 'wasm.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/wasm.so (libwasmer_runtime_c_api.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Maybe the provided shared library isn't compatible for your system.
In https://github.com/wasmerio/php-ext-wasm/pull/99, I've introduced a new command just build-runtime
. Can you run it first? It will compile a shared library specifically for your system.
@Hywan
@shijunti19 What version of Rust do you have? Is it up-to-date?
@Hywan ok php 7.3.13 rust 1.14
Compiling php-ext-wasm v0.5.0 (/longteng/soft/php-ext-wasm)
Finished release [optimized] target(s) in 6m 41s
ln: 无法创建符号链接"wasmer/libwasmer_runtime_c_api.so": 没有那个文件或目录
error: Recipe `build-runtime` failed with exit code 1
just build
/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [wasm.la] 错误 1
error: Recipe `build` failed with exit code 2
I experienced the same problems on Manjaro Linux 18.1.5 running php 7.4.2 and rust 1.40.0
I can at least run the example/simple.php file when I add the -fPIC flag here: https://github.com/wasmerio/php-ext-wasm/blob/6b02d0f1a853ba270bafa6f2b123e29c47dfbac7/justfile#L47 , like so:
export CXXFLAGS='-std=c++11 -fPIC'
Thanks for making this, looking forward to experiment more with rust, wasm and php.
@shijunti19 You can update Rust (1.41 is the current version), but it won't solve the problem I guess.
@DeppLearning Some platforms need PIC, some others don't. I don't know exactly how to solve this.