GithubHelp home page GithubHelp logo

38 / plumber_examples Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 1.0 261 KB

Example Repository for Plumber

License: BSD 2-Clause "Simplified" License

Shell 11.37% Makefile 3.63% C 59.44% HTML 18.85% JavaScript 2.47% C++ 0.74% Python 0.30% Rust 3.20%
plumber

plumber_examples's Introduction

The Example Repository for Plumber Project

Main project: https://github.com/38/plumber

This is the collections of the examples for the Plumber project. To compile the examples, enter the Plumber Isolated Environment using the ./init script at the root of the repository.

After you entering the environment, you can change current working directory to any of the examples under the example directory and build the example.

Getting Started

This repository provides an easy way to try Plumber in an isolated directory.

git clone --recursive https://github.com/38/plumber_examples.git
cd plumber_examples && ./init
git clone --recursive https://github.com/38/plumber_examples.git

The minimal required dependencies are

- Python 2 (Python 2.7 Recommended)
- CMake 2.6 or later (CMake 3+ Recommended)
- libreadline 
- GCC and G++ (GCC-5 Recommended)
- GNU Make
- zsh (For the startup script)
- pkg-config 
- OpenSSL (For SSL support)

for Ubuntu users, use command

apt-get install cmake gcc g++ uuid-dev libssl-dev pkg-config python2.7 libpython2.7-dev libreadline-dev zsh

for MacOS users, use command

sudo brew install cmake [email protected] ossp-uuid pkg-config  pkgconfig   readline

After installed all the dependencies, use the following command to enter the environment.

cd plumber_examples
./init 

In the environment, you should be able to build and run the examples under src directory.

plumber_examples's People

Contributors

38 avatar feng23 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

feng23

plumber_examples's Issues

Building on Ubuntu 20.04

Just wanted to report what changes I needed to do on Ubuntu 20.04, beyond the given instructions;

$ git log --oneline -1
ee6ce60 (HEAD -> master, origin/master, origin/HEAD) Sync plumber code

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
	modified:   dependencies/plumber (modified content)
	modified:   init

no changes added to commit (use "git add" and/or "git commit -a")

diff of init script - disabling javascript, because plumberserver.com does not exist any more:

diff --git a/init b/init
index 2c5b03c..d4ce446 100755
--- a/init
+++ b/init
@@ -77,7 +77,7 @@ shell=zsh
 
 case ${OS_NAME} in
        Linux )
-               javascript="yes"
+               javascript="no"
                js_prebuilt="http://plumberserver.com/downloads/plumberv8-prebuild.6.3.0.x64.release.tar.gz"
                ;;
        Darwin)
@@ -259,6 +259,8 @@ then
        export LIBS=${LIBS} 
        export CFLAGS=${CFLAGS} 
        echo "-DCMAKE_INSTALL_PREFIX=${INSTALLDIR}
+-G \"Unix Makefiles\"
+-DPYTHON_PREFIX=python2
 ${cmake_param}
 ${JS_PARAM}
 ${SOURCEDIR}/plumber" | xargs cmake    

in dependencies/plumber:

$ git status
HEAD detached at 30fead1
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   build/compiler/shared.cmake

no changes added to commit (use "git add" and/or "git commit -a")

diff of build/compiler/shared.cmake (that is, ./dependencies/plumber/build/compiler/shared.cmake) - remove Werror as the break builds nowadays:

diff --git a/build/compiler/shared.cmake b/build/compiler/shared.cmake
index 0a7c366..ed297b8 100644
--- a/build/compiler/shared.cmake
+++ b/build/compiler/shared.cmake
@@ -1,2 +1,4 @@
-set(SHARED_CFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Werror -Wshadow -Wcast-qual -Wmissing-prototypes -Wbad-function-cast -Wstrict-prototypes")
-set(SHARED_CXXFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Werror -Wshadow -Wcast-qual")
+#set(SHARED_CFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Werror -Wshadow -Wcast-qual -Wmissing-prototypes -Wbad-function-cast -Wstrict-prototypes")
+#set(SHARED_CXXFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Werror -Wshadow -Wcast-qual")
+set(SHARED_CFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Wshadow -Wcast-qual -Wmissing-prototypes -Wbad-function-cast -Wstrict-prototypes")
+set(SHARED_CXXFLAGS "-g -Wpointer-arith -Wformat=2 -Wconversion -Wextra -Wall -Wshadow -Wcast-qual")

Also beyond the given:

sudo apt install cmake gcc g++ uuid-dev libssl-dev pkg-config python2.7 libpython2.7-dev libreadline-dev zsh

... I had to do:

sudo apt install python2 python2-dev zlib1g-dev

And, then I could run:

$ ./init 
~/src/plumber_examples_git/build/plumber ~/src/plumber_examples_git
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/gcc
...
Operation sucessfully posted
Compiling type description file /home/administrator/src/plumber_examples_git/dependencies/plumber/servlets/rest/controller/protocol/command.ptype
Validating....
Types to update:
	[0]	plumber/std_servlet/rest/controller/v0/Command
	[1]	plumber/std_servlet/rest/controller/v0/OpCodes
	[2]	plumber/std_servlet/rest/controller/v0/UUID
Operation sucessfully posted

You are enetring Isolated Plumber Envrionment

  To check if you are in the Plumber Isolated Environment, use command whereami
  To quit the environment, please exit current shell

  Plumber Version                        0.1.1.30fead1.dirty 2023-04-10T12:24:26 Linux
  Plumber Service Script Interpreter     pscript  at /home/user/src/plumber_examples_git/installed/bin/pscript
  Plumber Servlet Testbed                pstest   at /home/user/src/plumber_examples_git/installed/bin/pstest
  Protocol Management Tool               protoman at /home/user/src/plumber_examples_git/installed/bin/protoman

mypc% whereami
You are under Plumber Isolated Environment at /home/user/src/plumber_examples_git, to leave the environment, please exit current shell.
mypc% (ctrl-D)
$

Here is how to run an example: change to a subdirectory, and do make run - at first it fails:

mypc% cd src/extractor_example 
mypc% make run
cd readsock && make -f /home/user/src/plumber_examples_git/installed/lib/plumber/servlet.mk LINKER="gcc" OUTPUT="../bin" LDFLAGS=" -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto" CFLAGS="-g -I/home/user/src/plumber_examples_git/installed/include/pstd -I/home/user/src/plumber_examples_git/installed/include/proto"
make[1]: Entering directory '/home/user/src/plumber_examples_git/src/extractor_example/readsock'
cc -c -fPIC -I/home/user/src/plumber_examples_git/installed/include/pservlet  -o readsock.o readsock.c -g -I/home/user/src/plumber_examples_git/installed/include/pstd -I/home/user/src/plumber_examples_git/installed/include/proto
gcc -fPIC -shared -Wl,-soname,libreadsock.so -o ../bin/libreadsock.so readsock.o -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto -L/home/user/src/plumber_examples_git/installed/lib -lpservlet 
/usr/bin/ld: cannot open output file ../bin/libreadsock.so: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [/home/user/src/plumber_examples_git/installed/lib/plumber/servlet.mk:30: libreadsock.so] Error 1
make[1]: Leaving directory '/home/user/src/plumber_examples_git/src/extractor_example/readsock'
make: *** [../../shared.mk:13: bin/libreadsock.so] Error 2

Apparently, there is a bin directory missing so let's create it:

mypc% mkdir bin
mypc% make run
cd readsock && make -f /home/user/src/plumber_examples_git/installed/lib/plumber/servlet.mk LINKER="gcc" OUTPUT="../bin" LDFLAGS=" -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto" CFLAGS="-g -I/home/user/src/plumber_examples_git/installed/include/pstd -I/home/user/src/plumber_examples_git/installed/include/proto"
make[1]: Entering directory '/home/user/src/plumber_examples_git/src/extractor_example/readsock'
gcc -fPIC -shared -Wl,-soname,libreadsock.so -o ../bin/libreadsock.so readsock.o -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto -L/home/user/src/plumber_examples_git/installed/lib -lpservlet 
make[1]: Leaving directory '/home/user/src/plumber_examples_git/src/extractor_example/readsock'
cd writesock && make -f /home/user/src/plumber_examples_git/installed/lib/plumber/servlet.mk LINKER="gcc" OUTPUT="../bin" LDFLAGS=" -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto" CFLAGS="-g -I/home/user/src/plumber_examples_git/installed/include/pstd -I/home/user/src/plumber_examples_git/installed/include/proto"
make[1]: Entering directory '/home/user/src/plumber_examples_git/src/extractor_example/writesock'
gcc -fPIC -shared -Wl,-soname,libwritesock.so -o ../bin/libwritesock.so writesock.o -L/home/user/src/plumber_examples_git/installed/lib -lpstd -lproto -L/home/user/src/plumber_examples_git/installed/lib -lpservlet 
make[1]: Leaving directory '/home/user/src/plumber_examples_git/src/extractor_example/writesock'
pscript service.pss

Note that in the final step, pscript service.pss, but there is no such script here:

mypc% ls
bin  Makefile  readsock  test.pss  writesock

... so call the one that exists instead:

mypc% pscript test.pss 
N[1681122791.629313|runtime_servlet_binary_load@src/runtime/servlet.c:564] Servlet address map: /home/user/src/plumber_examples_git/src/extractor_example/bin/libreadsock.so => [0x7f8c5af5f000]
N[1681122791.629527|runtime_servlet_binary_load@src/runtime/servlet.c:564] Servlet address map: /home/user/src/plumber_examples_git/installed/lib/plumber/servlet/dataflow/libextract.so => [0x7f8c5af59000]
N[1681122791.629702|runtime_servlet_binary_load@src/runtime/servlet.c:564] Servlet address map: /home/user/src/plumber_examples_git/src/extractor_example/bin/libwritesock.so => [0x7f8c5af53000]
^CE[1681122795.312244|_accept@src/module/tcp/module.c:730] Cannot get active request form tne connection pool
E[1681122795.312298|_module_event_loop_main@src/itc/eloop.c:93] failed to accept the incoming request from module #2
N[1681122795.312305|_module_event_loop_main@src/itc/eloop.c:104] Event loop thread has been killed!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.