Skip to content

Commit d442de8

Browse files
authored
Merge pull request #674 from rticommunity/feature/ROUTING-1182-to-develop
ROUTING-1182: adding cross-compilation instructions where missing for…
2 parents a0bd5c2 + 0750cbd commit d442de8

File tree

17 files changed

+313
-16
lines changed

17 files changed

+313
-16
lines changed

examples/cloud_discovery_service/library_api/c++11/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,30 @@ you want to link against. For example:
112112
cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 ..
113113
```
114114

115+
### Cross-compilation
116+
117+
When you need to cross-compile the example, the above
118+
command will not work, the assigned compiler won't be the cross-compiler and
119+
errors may happen when linking against the cross-compiled Connext binaries.
120+
To fix this, you have to create a file with the architecture name and call
121+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
122+
An example of the file to create with the toolchain settings (e.g. for an
123+
ARM architectures):
124+
125+
```cmake
126+
set(CMAKE_SYSTEM_NAME Linux)
127+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
128+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
129+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
130+
```
131+
132+
Then you can call CMake like this:
133+
134+
```bash
135+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
136+
-DCONNEXTDDS_ARCH=<connext architecture> ..
137+
```
138+
115139
### CMake Build Infrastructure
116140

117141
The `CMakeListst.txt` script that builds this example uses a generic CMake

examples/cloud_discovery_service/library_api/c/README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,33 @@ you want to link against. For example:
112112
cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 ..
113113
```
114114

115+
### Cross-compilation
116+
117+
When you need to cross-compile the example, the above
118+
command will not work, the assigned compiler won't be the cross-compiler and
119+
errors may happen when linking against the cross-compiled Connext binaries.
120+
To fix this, you have to create a file with the architecture name and call
121+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
122+
An example of the file to create with the toolchain settings (e.g. for an
123+
ARM architectures):
124+
125+
```cmake
126+
set(CMAKE_SYSTEM_NAME Linux)
127+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
128+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
129+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
130+
```
131+
132+
Then you can call CMake like this:
133+
134+
```bash
135+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
136+
-DCONNEXTDDS_ARCH=<connext architecture> ..
137+
```
138+
115139
### CMake Build Infrastructure
116140

117-
The `CMakeListst.txt` script that builds this example uses a generic CMake
141+
The `CMakeLists.txt` script that builds this example uses a generic CMake
118142
function called `connextdds_add_example` that defines all the necessary constructs
119143
to:
120144

examples/persistence_service/library_api/c/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,30 @@ you want to link against. For example:
117117
cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 ..
118118
```
119119

120+
### Cross-compilation
121+
122+
When you need to cross-compile the example, the above
123+
command will not work, the assigned compiler won't be the cross-compiler and
124+
errors may happen when linking against the cross-compiled Connext binaries.
125+
To fix this, you have to create a file with the architecture name and call
126+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
127+
An example of the file to create with the toolchain settings (e.g. for an
128+
ARM architectures):
129+
130+
```cmake
131+
set(CMAKE_SYSTEM_NAME Linux)
132+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
133+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
134+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
135+
```
136+
137+
Then you can call CMake like this:
138+
139+
```bash
140+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
141+
-DCONNEXTDDS_ARCH=<connext architecture> ..
142+
```
143+
120144
### CMake Build Infrastructure
121145
122146
The `CMakeListst.txt` script that builds this example uses a generic CMake

examples/persistence_service/persistent_storage/c++11/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,30 @@ you want to link against. For example:
226226
cmake -DCONNEXTDDS_ARCH=x64Linux3gcc5.4.0 ..
227227
```
228228

229+
### Cross-compilation
230+
231+
When you need to cross-compile the example, the above
232+
command will not work, the assigned compiler won't be the cross-compiler and
233+
errors may happen when linking against the cross-compiled Connext binaries.
234+
To fix this, you have to create a file with the architecture name and call
235+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
236+
An example of the file to create with the toolchain settings (e.g. for an
237+
ARM architectures):
238+
239+
```cmake
240+
set(CMAKE_SYSTEM_NAME Linux)
241+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
242+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
243+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
244+
```
245+
246+
Then you can call CMake like this:
247+
248+
```bash
249+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
250+
-DCONNEXTDDS_ARCH=<connext architecture> ..
251+
```
252+
229253
### CMake Build Infrastructure
230254
231255
The `CMakeListst.txt` script that builds this example uses a generic CMake

examples/recording_service/pluggable_storage/c++11/README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ In order to build this example, you need to provide the following variables to
5858
- `BUILD_SHARED_LIBS`: specifies the link mode. Valid values are ON for
5959
dynamic linking and OFF for static linking.
6060

61+
- `CONNEXTDDS_DIR`: specifies the path to your RTI Connext installation
62+
folder.
63+
64+
- `CONNEXTDDS_ARCH`: specifies the architecture of the specific libraries
65+
you want to link against.
66+
6167
Build the example code by running the following command:
6268

6369
```bash
6470
mkdir build
6571
cd build
66-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
72+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
73+
-DCONNEXTDDS_DIR=<connext dir> \
74+
-DCONNEXTDDS_ARCH=<connext architecture> ..
6775
cmake --build .
6876
```
6977

@@ -77,7 +85,9 @@ In case you are using Windows x64, you have to add the option -A in the cmake
7785
command as follow:
7886

7987
```bash
80-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .. -A x64
88+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
89+
-DCONNEXTDDS_DIR=<connext dir> \
90+
-DCONNEXTDDS_ARCH=<connext architecture> .. -A x64
8191
```
8292

8393
**Cross-compilation**.

examples/recording_service/pluggable_storage/c/README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,20 @@ In order to build this example, you need to provide the following variables to
5858
- `BUILD_SHARED_LIBS`: specifies the link mode. Valid values are ON for
5959
dynamic linking and OFF for static linking.
6060

61+
- `CONNEXTDDS_DIR`: specifies the path to your RTI Connext installation
62+
folder.
63+
64+
- `CONNEXTDDS_ARCH`: specifies the architecture of the specific libraries
65+
you want to link against.
66+
6167
Build the example code by running the following command:
6268

6369
```bash
6470
mkdir build
6571
cd build
66-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
72+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
73+
-DCONNEXTDDS_DIR=<connext dir> \
74+
-DCONNEXTDDS_ARCH=<connext architecture> ..
6775
cmake --build .
6876
```
6977

@@ -77,7 +85,9 @@ In case you are using Windows x64, you have to add the option -A in the cmake
7785
command as follow:
7886

7987
```bash
80-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .. -A x64
88+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
89+
-DCONNEXTDDS_DIR=<connext dir> \
90+
-DCONNEXTDDS_ARCH=<connext architecture> .. -A x64
8191
```
8292

8393
**Cross-compilation**.

examples/recording_service/service_admin/c++11/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Build the example code by running the following command:
4747
```sh
4848
mkdir build
4949
cd build
50-
cmake ..
50+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCONNEXTDDS_ARCH=<connext architecture> ..
5151
cmake --build .
5252
```
5353

examples/recording_service/service_as_lib/c++11/README.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,20 @@ In order to build this example, you need to provide the following variables to
4848
- `BUILD_SHARED_LIBS`: specifies the link mode. Valid values are ON for
4949
dynamic linking and OFF for static linking.
5050

51+
- `CONNEXTDDS_DIR`: specifies the path to your RTI Connext installation
52+
folder.
53+
54+
- `CONNEXTDDS_ARCH`: specifies the architecture of the specific libraries
55+
you want to link against.
56+
5157
Build the example code by running the following command:
5258

53-
```sh
59+
```bash
5460
mkdir build
5561
cd build
56-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
62+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
63+
-DCONNEXTDDS_DIR=<connext dir> \
64+
-DCONNEXTDDS_ARCH=<connext architecture> ..
5765
cmake --build .
5866
```
5967

@@ -66,8 +74,10 @@ cmake --build .
6674
In case you are using Windows x64, you have to add the option -A in the cmake
6775
command as follow:
6876

69-
```sh
70-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON .. -A x64
77+
```bash
78+
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON \
79+
-DCONNEXTDDS_DIR=<connext dir> \
80+
-DCONNEXTDDS_ARCH=<connext architecture> .. -A x64
7181
```
7282

7383
This will produce a binary directory (*build*) where the `ServiceAsLibExample`

examples/routing_service/file_adapter/c++11/README.md

+26-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,30 @@ supports static linking of adapters. To use this functionality you would need to
6666
create an application that uses Routing Service as a library component and
6767
statically links to this `FileAdapter` library.
6868

69+
### Cross-compilation
70+
71+
When you need to cross-compile the example, the above
72+
command will not work, the assigned compiler won't be the cross-compiler and
73+
errors may happen when linking against the cross-compiled Connext binaries.
74+
To fix this, you have to create a file with the architecture name and call
75+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
76+
An example of the file to create with the toolchain settings (e.g. for an
77+
ARM architectures):
78+
79+
```cmake
80+
set(CMAKE_SYSTEM_NAME Linux)
81+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
82+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
83+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
84+
```
85+
86+
Then you can call CMake like this:
87+
88+
```bash
89+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
90+
-DCONNEXTDDS_ARCH=<connext architecture> ..
91+
```
92+
6993
## Running C++ example
7094

7195
To run the example, you just need to run the following command from the `build`
@@ -97,10 +121,10 @@ appropriate value of ```SHAPE_TOPIC``` before starting Routing Service.
97121
To run Routing Service, you will need first to set up your environment as follows.
98122

99123
Before running the RTI Routing Service, you need to specify where the
100-
`fileadapter` library is located as shown below:
124+
`FileAdapterC++11` library is located as shown below:
101125

102126
```bash
103-
$export RTI_LD_LIBRARY_PATH=<Connext DDS Directory>/lib/<Connext DDS Architecture>:<Path to fileadapter library>
127+
$export RTI_LD_LIBRARY_PATH=<Connext DDS Directory>/lib/<Connext DDS Architecture>:<Path to FileAdapterC++11 library>
104128
```
105129

106130
```bash

examples/routing_service/file_adapter/c++11/RsFileAdapter.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<adapter_plugin name="FileAdapter">
1111
<!--
1212
By specifing this value, RTI Router will search for
13-
libfileadapter.so in Unix systems, fileadapter.dll on
14-
Windows systems and libfileadapter.dylib on Mac OS.
13+
libFileAdapterC++11.so in Unix systems, FileAdapterC++11.dll on
14+
Windows systems and libFileAdapterC++11.dylib on Mac OS.
1515
RTI Routing Service will attempt to load this library from:
1616
- Working directory or plugin_search_path
1717
- Executable directory

examples/routing_service/file_adapter/c/README.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,30 @@ supports static linking of adapters. To use this functionality you would need to
4343
create an application that uses Routing Service as a library component and
4444
statically links to this `FileAdapter` library.
4545

46+
### Cross-compilation
47+
48+
When you need to cross-compile the example, the above
49+
command will not work, the assigned compiler won't be the cross-compiler and
50+
errors may happen when linking against the cross-compiled Connext binaries.
51+
To fix this, you have to create a file with the architecture name and call
52+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
53+
An example of the file to create with the toolchain settings (e.g. for an
54+
ARM architectures):
55+
56+
```cmake
57+
set(CMAKE_SYSTEM_NAME Linux)
58+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
59+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
60+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
61+
```
62+
63+
Then you can call CMake like this:
64+
65+
```bash
66+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
67+
-DCONNEXTDDS_ARCH=<connext architecture> ..
68+
```
69+
4670
## Running C Example
4771

4872
Before running the example, take a look at file_bridge.xml. It defines the
@@ -76,7 +100,7 @@ $export NDDSHOME=<RTI Connext DDS Directory>
76100
```
77101

78102
Before running the RTI Routing Service, you also need to specify where the
79-
`fileadapter` library is located as shown below:
103+
`FileAdapterC` library is located as shown below:
80104

81105
```bash
82106
$export RTI_LD_LIBRARY_PATH=<Path to CMake build folder>

examples/routing_service/file_adapter/c/file_bridge.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<!-- Adapter entry points are defined here -->
1818
<adapter_library name="adapters">
1919
<adapter_plugin name="file">
20-
<dll>fileadapter</dll>
20+
<dll>FileAdapterC</dll>
2121
<create_function>RTI_RoutingServiceFileAdapterPlugin_create</create_function>
2222
</adapter_plugin>
2323
</adapter_library>

examples/routing_service/mongo_db/c++11/README.rst

+27
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,33 @@ Here is more information about generating
5050
create an application that uses Routing Service as a library component and
5151
statically link to this adapter.
5252

53+
Cross-compilation
54+
-----------------
55+
56+
When you need to cross-compile the example, the above
57+
command will not work, the assigned compiler won't be the cross-compiler and
58+
errors may happen when linking against the cross-compiled Connext binaries.
59+
To fix this, you have to create a file with the architecture name and call
60+
CMake with a specific flag called ``-DCMAKE_TOOLCHAIN_FILE``.
61+
An example of the file to create with the toolchain settings (e.g. for an
62+
ARM architectures):
63+
64+
.. code::
65+
66+
set(CMAKE_SYSTEM_NAME Linux)
67+
set(toolchain_path "<path to>/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian")
68+
set(CMAKE_C_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-gcc")
69+
set(CMAKE_CXX_COMPILER "${toolchain_path}/bin/arm-linux-gnueabihf-g++")
70+
71+
72+
Then you can call CMake like this:
73+
74+
.. code::
75+
76+
cmake -DCONNEXTDDS_DIR=<connext dir> -DCMAKE_TOOLCHAIN_FILE=<toolchain file created above>
77+
-DCONNEXTDDS_ARCH=<connext architecture> ..
78+
79+
5380
Running
5481
-------
5582

0 commit comments

Comments
 (0)