1
+ sudo apt install libboost-dev libwebsocketpp-dev libmsgpack-dev
2
+
3
+
4
+ ``` console
5
+ mkdir build
6
+ /opt/cmake/bin/cmake ..
7
+ make -j4
8
+ ```
9
+
10
+
11
+ ``` console
12
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $ /opt/cmake/bin/cmake ..
13
+ -- The C compiler identification is GNU 5.4.0
14
+ -- The CXX compiler identification is GNU 5.4.0
15
+ -- Check for working C compiler: /usr/bin/cc
16
+ -- Check for working C compiler: /usr/bin/cc -- works
17
+ -- Detecting C compiler ABI info
18
+ -- Detecting C compiler ABI info - done
19
+ -- Detecting C compile features
20
+ -- Detecting C compile features - done
21
+ -- Check for working CXX compiler: /usr/bin/c++
22
+ -- Check for working CXX compiler: /usr/bin/c++ -- works
23
+ -- Detecting CXX compiler ABI info
24
+ -- Detecting CXX compiler ABI info - done
25
+ -- Detecting CXX compile features
26
+ -- Detecting CXX compile features - done
27
+ -- Looking for pthread.h
28
+ -- Looking for pthread.h - found
29
+ -- Looking for pthread_create
30
+ -- Looking for pthread_create - not found
31
+ -- Looking for pthread_create in pthreads
32
+ -- Looking for pthread_create in pthreads - not found
33
+ -- Looking for pthread_create in pthread
34
+ -- Looking for pthread_create in pthread - found
35
+ -- Found Threads: TRUE
36
+ -- Boost version: 1.66.0
37
+ -- Found the following Boost libraries:
38
+ -- program_options
39
+ -- system
40
+ -- thread
41
+ -- random
42
+ -- chrono
43
+ -- date_time
44
+ -- atomic
45
+ -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g")
46
+ -- AUTOBAHN_BUILD_EXAMPLES: ON
47
+ -- CMAKE_ROOT: /opt/cmake/share/cmake-3.11
48
+ -- Boost_INCLUDE_DIRS: /opt/boost/include
49
+ -- Boost_LIBRARIES: /opt/boost/lib/libboost_program_options.so/opt/boost/lib/libboost_system.so/opt/boost/lib/libboost_thread.so/opt/boost/lib/libboost_random.so/opt/boost/lib/libboost_chrono.so/opt/boost/lib/libboost_date_time.so/opt/boost/lib/libboost_atomic.so
50
+ -- Msgpack_INCLUDE_DIRS: /opt/msgpack/include
51
+ -- Msgpack_LIBRARIES: /opt/msgpack/libs
52
+ -- Websocketpp_INCLUDE_DIRS: /opt/websocketpp/include
53
+ -- Websocketpp_LIBRARIES: /opt/websocketpp/libs
54
+ -- Configuring done
55
+ -- Generating done
56
+ -- Build files have been written to: /home/oberstet/scm/crossbario/autobahn-cpp/build
57
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $ make -j4
58
+ Scanning dependencies of target examples_parameters
59
+ [ 5%] Building CXX object examples/CMakeFiles/examples_parameters.dir/parameters.cpp.o
60
+ [ 11%] Linking CXX static library libexamples_parameters.a
61
+ [ 11%] Built target examples_parameters
62
+ Scanning dependencies of target callee
63
+ Scanning dependencies of target caller
64
+ Scanning dependencies of target provide_prefix
65
+ Scanning dependencies of target wampcra
66
+ [ 16%] Building CXX object examples/CMakeFiles/caller.dir/caller.cpp.o
67
+ [ 22%] Building CXX object examples/CMakeFiles/callee.dir/callee.cpp.o
68
+ [ 27%] Building CXX object examples/CMakeFiles/provide_prefix.dir/callee.cpp.o
69
+ [ 33%] Building CXX object examples/CMakeFiles/wampcra.dir/wampcra.cpp.o
70
+ [ 38%] Linking CXX executable wampcra
71
+ [ 38%] Built target wampcra
72
+ Scanning dependencies of target subscriber
73
+ [ 44%] Linking CXX executable caller
74
+ [ 50%] Building CXX object examples/CMakeFiles/subscriber.dir/subscriber.cpp.o
75
+ [ 50%] Built target caller
76
+ Scanning dependencies of target uds
77
+ [ 55%] Linking CXX executable callee
78
+ [ 61%] Linking CXX executable provide_prefix
79
+ [ 66%] Building CXX object examples/CMakeFiles/uds.dir/uds.cpp.o
80
+ [ 66%] Built target callee
81
+ Scanning dependencies of target publisher
82
+ [ 66%] Built target provide_prefix
83
+ Scanning dependencies of target websocket_callee
84
+ [ 72%] Building CXX object examples/CMakeFiles/publisher.dir/publisher.cpp.o
85
+ [ 77%] Building CXX object examples/CMakeFiles/websocket_callee.dir/websocket_callee.cpp.o
86
+ [ 83%] Linking CXX executable subscriber
87
+ [ 83%] Built target subscriber
88
+ [ 88%] Linking CXX executable publisher
89
+ [ 94%] Linking CXX executable uds
90
+ [ 94%] Built target publisher
91
+ [ 94%] Built target uds
92
+ [100%] Linking CXX executable websocket_callee
93
+ [100%] Built target websocket_callee
94
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $
95
+ ```
96
+
97
+
98
+ ``` console
99
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $ file examples/websocket_callee
100
+ examples/websocket_callee: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=bfcab40b2350acd5869d913226723999cf0b822e, not stripped
101
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $ ldd examples/websocket_callee
102
+ linux-vdso.so.1 => (0x00007fff44760000)
103
+ libboost_program_options.so.1.66.0 => /opt/boost/lib/libboost_program_options.so.1.66.0 (0x00007f8518873000)
104
+ libboost_system.so.1.66.0 => /opt/boost/lib/libboost_system.so.1.66.0 (0x00007f851866f000)
105
+ libboost_thread.so.1.66.0 => /opt/boost/lib/libboost_thread.so.1.66.0 (0x00007f8518446000)
106
+ libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f85181dd000)
107
+ libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f8517d99000)
108
+ libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8517b7c000)
109
+ libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f85177fa000)
110
+ libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f85175e4000)
111
+ libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f851721a000)
112
+ librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8517012000)
113
+ libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8516e0e000)
114
+ /lib64/ld-linux-x86-64.so.2 (0x00007f8518af3000)
115
+ libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8516b05000)
116
+ oberstet@thinkpad-t430s:~/scm/crossbario/autobahn-cpp/build $
117
+ ```
118
+
119
+
120
+
121
+
1
122
# AutobahnC++
2
123
3
124
WAMP for C++ on Boost/ASIO.
@@ -23,8 +144,8 @@ The API and implementation make use of modern C++ 11 and new asynchronous idioms
23
144
AutobahnC++ supports running WAMP (` rawsocket-msgpack ` ) over ** TCP(-TLS)** , ** Unix domain sockets** or ** pipes** (` stdio ` ). The library is "header-only", light-weight (< 2k code lines) and ** depends on** the following:
24
145
25
146
* C++11 compiler
26
- * [ ` boost::future ` ] ( http://www.boost.org/doc/libs/1_63_0 /doc/html/thread/synchronization.html#thread.synchronization.futures )
27
- * [ ` boost::asio ` ] ( http://www.boost.org/doc/libs/1_63_0 /doc/html/boost_asio.html )
147
+ * [ ` boost::future ` ] ( http://www.boost.org/doc/libs/1_66_0 /doc/html/thread/synchronization.html#thread.synchronization.futures )
148
+ * [ ` boost::asio ` ] ( http://www.boost.org/doc/libs/1_66_0 /doc/html/boost_asio.html )
28
149
* [ ` msgpack-c ` ] ( https://github.com/msgpack/msgpack-c )
29
150
* [ ` WebSocket++ ` ] ( https://github.com/zaphoyd/websocketpp )
30
151
@@ -103,22 +224,34 @@ The Autobahn|Cpp repository contains a number of [examples](examples) that demon
103
224
104
225
## Building
105
226
227
+ The instructions below were tested on Debian/Ubuntu and build and install the following:
228
+
229
+ * Boost in ` /opt/boost `
230
+ * MsgPack-C in ` /opt/msgpackc `
231
+ * WebSocketC++ in ` /opt/websocketpp `
232
+ * AutobahnC++ in ` /opt/autobahncpp `
233
+
106
234
> * Notes*
107
235
>
108
236
> * The library code is written in standard C++ 11. Target toolchains currently include ** clang** and ** gcc** . Support for MSVC is tracked on this [ issue] ( https://github.com/crossbario/autobahn-cpp/issues/2 ) .
109
237
> * While C++ 11 includes ` std::future ` in the standard library, this lacks continuations. ` boost::future.then ` allows attaching continuations to futures as outlined in the proposal [ here] ( http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3634.pdf ) . This feature will come to standard C++, but probably not before 2017 (see [ C++ Standardisation Roadmap] ( http://isocpp.org/std/status ) )
110
238
> * Support for ` when_all ` and ` when_any ` as described in above proposal depends on Boost 1.56 or higher.
111
239
> * The library and example programs were tested and developed with ** clang 3.4** , ** libc++** and ** Boost trunk/1.56** on an Ubuntu 13.10 x86-64 bit system. It also works with ** gcc 4.8** , ** libstdc++** and ** Boost trunk/1.56** . Your mileage with other versions of the former may vary, but we accept PRs;)
112
240
241
+ ---
242
+
113
243
114
244
### Build tools
115
245
116
- Install some libs and build tools (these are for Ubuntu):
246
+ Install some libs and build tools (these are for Debian/ Ubuntu):
117
247
118
248
``` console
119
249
sudo apt-get install -y libbz2-dev libssl-dev cmake
120
250
```
121
251
252
+ ---
253
+
254
+
122
255
### Clang
123
256
124
257
If you want to work with Clang (rather than GCC), install [ clang] ( http://clang.llvm.org/ ) and [ libc++] ( http://libcxx.llvm.org/ ) (these are for Ubuntu):
@@ -146,37 +279,51 @@ oder geben Sie die Auswahlnummer ein: 1
146
279
update-alternatives: /usr/bin/clang++ wird verwendet, um /usr/bin/c++ (c++) im manueller Modus bereitzustellen
147
280
```
148
281
282
+ ---
283
+
284
+
149
285
### Boost
150
286
151
- Most of the time, your distro's Boost libraries will be outdated (unless you're using Arch or Homebrew). Don't waste time with those: to build the latest Boost 1.63 (current release as of 2016/12) from sources.
287
+ Most of the time, your distro's Boost libraries will be outdated (unless you're using Arch or Homebrew). Don't waste time with those. To build the latest Boost 1.66 (current release as of 2018/4) from sources.
288
+
289
+ Get Boost:
152
290
153
- Get Boost 1.63:
154
291
``` console
155
292
cd ~
156
- wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.bz2
157
- tar xvjf boost_1_63_0.tar.bz2
158
- cd boost_1_63_0
159
- ```
160
- To build using Clang:
161
- ``` console
162
- ./bootstrap.sh --with-toolset=clang
163
- ./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" -j 4
293
+ wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2
294
+ tar xvjf boost_1_66_0.tar.bz2
295
+ cd boost_1_66_0
164
296
```
165
- To build using GCC:
297
+
298
+ Then, to build using the * GCC* toolchain:
299
+
166
300
``` console
167
301
./bootstrap.sh --with-toolset=gcc
168
- ./b2 toolset=gcc -j 4 install --prefix=/usr/local
302
+ ./b2 toolset=gcc -j4
303
+ sudo ./b2 install --prefix=/opt/boost
169
304
```
170
305
171
- > Note: The ` -j 4 ` option will allow use of 4 cores for building.
306
+ > Note: The ` -j 4 ` option will allow use of 4 CPU cores for building.
307
+
308
+ Instead, to build using the * Clang* toolchain:
309
+
310
+ ``` console
311
+ ./bootstrap.sh --with-toolset=clang
312
+ ./b2 toolset=clang -j4 \
313
+ cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"
314
+ sudo ./b2 install --prefix=/opt/boost
315
+ ```
172
316
173
317
Then add the following to your ` ~/.profile ` or ` ~/.bashrc ` :
174
318
175
319
``` shell
176
- export BOOST_ROOT=${HOME} /boost_1_63_0
177
- export LD_LIBRARY_PATH=${BOOST_ROOT} /stage/ lib:${LD_LIBRARY_PATH}
320
+ export BOOST_ROOT=/opt/boost
321
+ export LD_LIBRARY_PATH=${BOOST_ROOT} /lib:${LD_LIBRARY_PATH}
178
322
```
179
323
324
+ ---
325
+
326
+
180
327
### MsgPack-C
181
328
182
329
Get [ MsgPack-C] ( https://github.com/msgpack/msgpack-c ) and install:
@@ -186,11 +333,22 @@ cd ~
186
333
git clone https://github.com/msgpack/msgpack-c.git
187
334
cd msgpack-c
188
335
git checkout cpp-1.4.2
189
- cmake -DMSGPACK_CXX11=ON .
190
- make install
336
+ cmake -DMSGPACK_CXX11=ON -DCMAKE_INSTALL_PREFIX=/opt/msgpackc .
337
+ make
338
+ sudo make install
191
339
```
192
340
> On FreeBSD, you need to ` pkg install autotools ` and invoke ` gmake ` instead of ` make ` .
193
341
342
+ Then add the following to your ` ~/.profile ` or ` ~/.bashrc ` :
343
+
344
+ ``` shell
345
+ export MSGPACKC_ROOT=/opt/msgpackc
346
+ export LD_LIBRARY_PATH=${MSGPACKC_ROOT} /lib:${LD_LIBRARY_PATH}
347
+ ```
348
+
349
+ ---
350
+
351
+
194
352
### WebSocket++
195
353
196
354
Get [ WebSocket++] ( https://github.com/zaphoyd/websocketpp ) and install:
@@ -199,10 +357,20 @@ Get [WebSocket++](https://github.com/zaphoyd/websocketpp) and install:
199
357
cd ~
200
358
git clone https://github.com/zaphoyd/websocketpp.git
201
359
cd websocketpp
202
- cmake .
203
- make install
360
+ cmake -DCMAKE_INSTALL_PREFIX=/opt/websocketpp .
361
+ sudo make install
362
+ ```
363
+
364
+ Then add the following to your ` ~/.profile ` or ` ~/.bashrc ` :
365
+
366
+ ``` shell
367
+ export WEBSOCKETPP_ROOT=/opt/websocketpp
368
+ export LD_LIBRARY_PATH=${WEBSOCKETPP_ROOT} /lib:${LD_LIBRARY_PATH}
204
369
```
205
370
371
+ ---
372
+
373
+
206
374
### AutobahnC++
207
375
208
376
To get AutobahnC++ library and examples, clone the repo
@@ -216,13 +384,17 @@ cp -r autobahn/ /usr/local/include/
216
384
217
385
The library is "header-only", means there isn't anything to compile or build. Just include the relevant headers.
218
386
387
+
388
+
219
389
## Examples
220
390
221
391
``` console
222
392
apt-get install scons
223
393
cd $HOME/autobahn-cpp/examples
224
394
scons
225
395
```
396
+
397
+
226
398
## Documentation
227
399
228
400
[ Click here] ( http://autobahn.ws/cpp/reference/ ) for the Autobahn|Cpp reference documentation.
0 commit comments