wasmerio / wasmer-php

🐘🕸️ WebAssembly runtime for PHP
https://wasmerio.github.io/wasmer-php/wasm/
MIT License
1k stars 42 forks source link

libwasmer.so: file not recognized: File format not recognized #114

Closed suhanyujie closed 4 years ago

suhanyujie commented 4 years ago

Summary

When I build the ext, it gives me some error info:

creating libtool
appending configuration tag "CXX" to libtool
checking whether the g++ linker (/usr/bin/ld) 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) 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 /just/php-ext-wasm/src/libtool --mode=compile g++  -I. -I/just/php-ext-wasm/src -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c++11   -c /just/php-ext-wasm/src/wasm.cc -o wasm.lo
mkdir .libs
 g++ -I. -I/just/php-ext-wasm/src -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -c /just/php-ext-wasm/src/wasm.cc  -DPIC -o .libs/wasm.o
/bin/sh /just/php-ext-wasm/src/libtool --mode=link cc -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2    -o wasm.la -export-dynamic -avoid-version -prefer-pic -module -rpath /just/php-ext-wasm/src/modules  wasm.lo -Wl,-rpath,/just/php-ext-wasm/src/. -L/just/php-ext-wasm/src/. -lwasmer
cc -shared  .libs/wasm.o  -L/just/php-ext-wasm/src/. -lwasmer  -Wl,-rpath -Wl,/just/php-ext-wasm/src/. -Wl,-soname -Wl,wasm.so -o .libs/wasm.so
/just/php-ext-wasm/src/./libwasmer.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make: *** [wasm.la] Error 1
error: Recipe `build` failed with exit code 2
[root@2a21bde6fff5 src]# just build-runtime
    Finished release [optimized] target(s) in 0.21s
ln: failed to create symbolic link 'wasmer/libwasmer_runtime_c_api.so': No such file or directory
error: Recipe `build-runtime` failed with exit code 1
[root@2a21bde6fff5 php-ext-wasm]# just build-runtime
    Finished release [optimized] target(s) in 0.09s
creating libtool
appending configuration tag "CXX" to libtool
checking whether the g++ linker (/usr/bin/ld) 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) 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 /just/php-ext-wasm/src/libtool --mode=compile g++  -I. -I/just/php-ext-wasm/src -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib  -DHAVE_CONFIG_H  -std=c++11 -fPIC   -c /just/php-ext-wasm/src/wasm.cc -o wasm.lo
mkdir .libs
 g++ -I. -I/just/php-ext-wasm/src -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -fPIC -c /just/php-ext-wasm/src/wasm.cc  -DPIC -o .libs/wasm.o
/bin/sh /just/php-ext-wasm/src/libtool --mode=link cc -DPHP_ATOM_INC -I/just/php-ext-wasm/src/include -I/just/php-ext-wasm/src/main -I/just/php-ext-wasm/src -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2    -o wasm.la -export-dynamic -avoid-version -prefer-pic -module -rpath /just/php-ext-wasm/src/modules  wasm.lo -Wl,-rpath,/just/php-ext-wasm/src/. -L/just/php-ext-wasm/src/. -lwasmer
cc -shared  .libs/wasm.o  -L/just/php-ext-wasm/src/. -lwasmer  -Wl,-rpath -Wl,/just/php-ext-wasm/src/. -Wl,-soname -Wl,wasm.so -o .libs/wasm.so
/just/php-ext-wasm/src/./libwasmer.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make: *** [wasm.la] Error 1
error: Recipe `build` failed with exit code 2

Additional details

suhanyujie commented 4 years ago

I already know how the solve this problem, change the branch and compile:

git checkout trying
./build.sh

Look at build.sh detail.

syrusakbary commented 4 years ago

What was the issue @suhanyujie ?

suhanyujie commented 4 years ago

What was the issue @suhanyujie ?

It's finished. I'll just close the issue.

Hywan commented 4 years ago

I've to apologize, I totally missed your issue! Sorry for that. If there is anything I can help you with, feel free to ping.

arku31 commented 3 years ago

I am still not able to build it in the master branch. Using the branch "trying" helped.

uname -a

Linux fae8cd9b7f2d 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 GNU/Linux

cat /etc/issue

Debian GNU/Linux 10 \n \l