-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add docker env #115
Open
suhanyujie
wants to merge
2
commits into
wasmerio:master
Choose a base branch
from
suhanyujie:modifyReadmeForDockerEnv
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add docker env #115
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/composer.lock | ||
/doc | ||
/target/ | ||
/vendor/ | ||
/vendor/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# docker env for php-ext-wasm | ||
## reference | ||
# * https://circleci.com/gh/wasmerio/php-ext-wasm | ||
|
||
FROM circleci/php:latest | ||
|
||
RUN git clone https://github.com/wasmerio/php-ext-wasm.git $HOME/project \ | ||
&& cd $HOME/project && git checkout trying && cd $HOME \ | ||
&& test -d /usr/local/cargo || curl https://sh.rustup.rs -sSf | sh -s -- -y \ | ||
&& export PATH="$HOME/.cargo/bin:$PATH" \ | ||
&& test -f $HOME/.cargo/bin/just || cargo install just \ | ||
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \ | ||
&& php composer-setup.php \ | ||
&& php -r "unlink('composer-setup.php');" \ | ||
&& mv composer.phar composer \ | ||
&& export PATH="$HOME/.cargo/bin:$PATH" \ | ||
&& export CXX="gcc" \ | ||
&& EXTENSION="$HOME/project/src" \ | ||
&& cd $EXTENSION \ | ||
&& PHP_PREFIX=$(php-config --prefix) \ | ||
&& PHP_PREFIX_BIN=$PHP_PREFIX/bin \ | ||
&& $PHP_PREFIX_BIN/phpize --clean \ | ||
&& $PHP_PREFIX_BIN/phpize \ | ||
&& ./configure --with-php-config=$PHP_PREFIX_BIN/php-config \ | ||
&& /bin/bash $EXTENSION/libtool --mode=compile $CXX -I. -I$EXTENSION -DPHP_ATOM_INC -I$EXTENSION/include -I$EXTENSION/main -I$EXTENSION -I$PHP_PREFIX/include/php -I$PHP_PREFIX/include/php/main -I$PHP_PREFIX/include/php/TSRM -I$PHP_PREFIX/include/php/Zend -I$PHP_PREFIX/include/php/ext -I$PHP_PREFIX/include/php/ext/date/lib -DHAVE_CONFIG_H -c $EXTENSION/wasm.cc -o wasm.lo -fPIC \ | ||
&& $CXX -I. -I$EXTENSION -DPHP_ATOM_INC -I$EXTENSION/include -I$EXTENSION/main -I$EXTENSION -I$PHP_PREFIX/include/php -I$PHP_PREFIX/include/php/main -I$PHP_PREFIX/include/php/TSRM -I$PHP_PREFIX/include/php/Zend -I$PHP_PREFIX/include/php/ext -I$PHP_PREFIX/include/php/ext/date/lib -DHAVE_CONFIG_H -c $EXTENSION/wasm.cc -DPIC -o .libs/wasm.o -fPIC \ | ||
&& /bin/bash $EXTENSION/libtool --mode=link cc -DPHP_ATOM_INC -I$EXTENSION/include -I$EXTENSION/main -I$EXTENSION -I$PHP_PREFIX/include/php -I$PHP_PREFIX/include/php/main -I$PHP_PREFIX/include/php/TSRM -I$PHP_PREFIX/include/php/Zend -I$PHP_PREFIX/include/php/ext -I$PHP_PREFIX/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o wasm.la -export-dynamic -avoid-version -prefer-pic -module -rpath $EXTENSION/modules wasm.lo -Wl,-rpath,$EXTENSION/. -L$EXTENSION/. -lwasmer_runtime_c_api -fPIC \ | ||
&& cc -shared .libs/wasm.o -L$EXTENSION/. -lwasmer_runtime_c_api -Wl,-rpath -Wl,$EXTENSION/. -Wl,-soname -Wl,wasm.so -o .libs/wasm.so -fPIC \ | ||
&& sudo make install-modules \ | ||
&& export PATH="$HOME/.cargo/bin:$PATH" \ | ||
&& cd $HOME/project \ | ||
&& composer config repo.packagist composer https://mirrors.aliyun.com/composer/ && composer install --no-progress \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't it a workaround for China? Do we want to keep this in the general |
||
&& cd /usr/local/etc/php/conf.d && sudo touch docker-php-ext-wasm.ini && sudo chmod 777 docker-php-ext-wasm.ini \ | ||
&& echo 'extension=wasm.so' > docker-php-ext-wasm.ini | ||
|
||
CMD ["/bin/sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,9 @@ please try running `just build-runtime` first. | |
|
||
(Yes, you need [`just`](https://github.com/casey/just/)). | ||
|
||
### Docker | ||
* `docker run -it --rm --name phpwasm1 suhanyujie/phpwasm:0.0.1 bash` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we update since we have our own |
||
|
||
## Testing | ||
|
||
Once the extension is compiled and installed (just run `just rust && just php`), run the following commands: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to checkout the
master
branch rather than thetrying
branch. The latter is used by Bors to run the tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Hywan Hi, I'm having some problems. When I checkout the
master
branch, I can't build the docker env(docker build -t phpwasm:0.0.3 .
), it prompt error like this:And I don't know how to resolve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should use
-L
instead of-l
, but as a short-term solution, did you try to set theLD_LIBRARY_PATH
environment variable?