Open shijunti19 opened 5 years ago
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.
centos 7 php7.3