Closed suneeshs closed 5 years ago
Hi @suneeshs,
I found someone with an issue compiling with asio that seems similar to your issue.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224130#c3
They seem to have fixed the issue by upgrading to boost 1.67 (which includes asio 1.12.1)
Fast-RTPS is using asio 1.12.0. When the next asio version is released as requested on chriskohlhoff/asio#309, we will update our submodule.
I hope you can go on with Fast-RTPS with this information.
Add flag -stdlib=libstdc++, you may solve this problem.
Hi @suneeshs,
I found someone with an issue compiling with asio that seems similar to your issue.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224130#c3
They seem to have fixed the issue by upgrading to boost 1.67 (which includes asio 1.12.1)
Fast-RTPS is using asio 1.12.0. When the next asio version is released as requested on chriskohlhoff/asio#309, we will update our submodule.
I hope you can go on with Fast-RTPS with this information.
Unfortunately not. I have not yet tried using boost 1.67 with Fast-RTPS 1.6.0 yet. Instead I tried updating the ASIO library in thirdparty to the source code from "asio version 1.12.1 Released Sunday, 15 April 2018." https://github.com/chriskohlhoff/asio/tree/master/asio and see the same issue.
hi @suneeshs have you solved the problem? Now I also want to cross compile FastRTPS for QNX. But I download the FastRTPS at http://www.eprosima.com/index.php?option=com_ars&view=browses&layout=normal. There is not a CMakeList.txt, instead a configure.
Hi suneeshs @suneeshs and hi all you should add -DTHIRDPARTY=ON to you cross compile. it solved fastcdr problem. But it report a error: /home/caros/Documents/qnx_lib/qnx-lib/fast-rtps/Fast-RTPS/src/cpp/utils/eClock.cpp: In static member function 'static void eprosima::fastrtps::eClock::my_sleep(uint32_t)': /home/caros/Documents/qnx_lib/qnx-lib/fast-rtps/Fast-RTPS/src/cpp/utils/eClock.cpp:100:26: error: 'usleep' was not declared in this scope usleep(milliseconds*1000);
Add flag -stdlib=libstdc++, you may solve this problem.
This helped with the compile issue. Thanks!
I was able to proceed compiling using @seancx 's suggestion of adding "-stdlib=libstdc++". However, now I am seeing an error while linking libfastrtps.so:
[ 97%] Building C object src/cpp/CMakeFiles/fastrtps.dir/rtps/persistence/sqlite3.c.o [ 98%] Building CXX object src/cpp/CMakeFiles/fastrtps.dir///thirdparty/tinyxml2/tinyxml2.cpp.o [ 99%] Linking CXX shared library libfastrtps.so : Invalid argumentn64\x86_64\usr\bin\x86_64-pc-nto-qnx7.0.0-ld: cannot find CMakeFiles/fastrtps.dir///thirdparty/tinyxml2/tinyxml2.cpp.o cc: c:/qnx700//host/win64/x86_64/usr/bin/x86_64-pc-nto-qnx7.0.0-ld caught signal 1 gmake[2]: [src/cpp/libfastrtps.so.1.6.0] Error 1 gmake[1]: [src/cpp/CMakeFiles/fastrtps.dir/all] Error 2 gmake.exe: *** [all] Error 2
@suneeshs : FYI: for QNX SDP 7, by default it is linked to libc++. If you specify -stdlib=libstdc++, it will link to libstdc++. If your project needs a lot of third party libs, make sure they are all linked to the same c++ libs. Otherwise, you will see unexpected crashes in runtime.
A simple way to list all linked libraries is to run "ntoxxxxx-objdump -p yourlib.so" . Hope it helps.
Here is the diff which might help the asio issue aforementioned.
Index: boost/asio/detail/impl/socket_ops.ipp
===================================================================
--- boost/asio/detail/impl/socket_ops.ipp (revision 843663)
+++ boost/asio/detail/impl/socket_ops.ipp (working copy)
@@ -1479,6 +1479,9 @@
call_setsockopt(&msghdr::msg_namelen, s,
SOL_SOCKET, SO_REUSEPORT, optval, optlen);
}
+#else //QNX
+ call_setsockopt(&msghdr::msg_namelen, s,
+ SOL_SOCKET, SO_REUSEPORT, optval, optlen);
#endif
}
Thanks for your help and collaboration. Currently we don't support officially QNX. We are working to make it officially in future versions. All contributions are appreciated.
@richiware : Welcome. Found some old notes and re-run the compilation. Luckily It still works.
Here they are:
git clone https://github.com/eProsima/Fast-RTPS.git
cd Fast-RTPS
git checkout release/1.4.0
git submodule init
git submodule update
Index: boost/asio/detail/impl/socket_ops.ipp
===================================================================
--- boost/asio/detail/impl/socket_ops.ipp (revision 843663)
+++ boost/asio/detail/impl/socket_ops.ipp (working copy)
call_setsockopt(&msghdr::msg_namelen, s,
SOL_SOCKET, SO_REUSEPORT, optval, optlen);
}
+#else //QNX
+ call_setsockopt(&msghdr::msg_namelen, s,
+ SOL_SOCKET, SO_REUSEPORT, optval, optlen);
#endif
}
cd Fast-RTPSs
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/home/jilin/Downloads/fast_rtps_aarch64le_Toolchain.cmake -DCMAKE_INSTALL_PREFIX=/usr -DTHIRDPARTY=ON -DCMAKE_BUILD_TYPE=Release -DCOMPILE_EXAMPLES=OFF -DCMAKE_SHARED_LINKER_FLAGS=-lsocket ..
make -j4
You should see the following at the end:
[100%] Linking CXX shared library libfastrtps.so
[100%] Built target fastrtps
fast_rtps_aarch64le_Toolchain.cmake.txt
Here is its linked libraries:
ntoaarch64-objdump -p ./src/cpp/libfastrtps.so
./src/cpp/libfastrtps.so: file format elf64-littleaarch64
Program Header:
LOAD off 0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**16
filesz 0x00000000001706fc memsz 0x00000000001706fc flags r-x
LOAD off 0x0000000000170f58 vaddr 0x0000000000180f58 paddr 0x0000000000180f58 align 2**16
filesz 0x0000000000009210 memsz 0x000000000000a2a8 flags rw-
DYNAMIC off 0x0000000000175168 vaddr 0x0000000000185168 paddr 0x0000000000185168 align 2**3
filesz 0x0000000000000200 memsz 0x0000000000000200 flags rw-
NOTE off 0x00000000000001c8 vaddr 0x00000000000001c8 paddr 0x00000000000001c8 align 2**2
filesz 0x0000000000000020 memsz 0x0000000000000020 flags r--
NOTE off 0x00000000001706e4 vaddr 0x00000000001706e4 paddr 0x00000000001706e4 align 2**0
filesz 0x0000000000000018 memsz 0x0000000000000018 flags r--
EH_FRAME off 0x000000000014d41c vaddr 0x000000000014d41c paddr 0x000000000014d41c align 2**2
filesz 0x0000000000003bcc memsz 0x0000000000003bcc flags r--
RELRO off 0x0000000000170f58 vaddr 0x0000000000180f58 paddr 0x0000000000180f58 align 2**0
filesz 0x00000000000070a8 memsz 0x00000000000070a8 flags r--
Dynamic Section:
NEEDED libsocket.so.3
NEEDED libc++.so.1
NEEDED libm.so.3
NEEDED libc.so.4
SONAME libfastrtps.so
INIT_ARRAY 0x0000000000180f58
INIT_ARRAYSZ 0x0000000000000248
FINI_ARRAY 0x00000000001811a0
FINI_ARRAYSZ 0x0000000000000008
HASH 0x00000000000001e8
STRTAB 0x00000000000156e8
SYMTAB 0x0000000000004e28
STRSZ 0x000000000002d4e3
SYMENT 0x0000000000000018
PLTGOT 0x0000000000185368
PLTRELSZ 0x00000000000064f8
PLTREL 0x0000000000000007
JMPREL 0x0000000000055318
RELA 0x0000000000044200
RELASZ 0x0000000000011118
RELAENT 0x0000000000000018
BIND_NOW 0x0000000000000000
FLAGS_1 0x0000000000000001
VERNEED 0x00000000000441e0
VERNEEDNUM 0x0000000000000001
VERSYM 0x0000000000042bcc
RELACOUNT 0x000000000000040b
Version References:
required from libsocket.so.3:
0x040fdf22 0x00 02 libsocket.so.2
private flags = 0:
HI jilinzhou @jilinzhou I apologize for disturbing you again..
for QNX SDP 7, by default it is linked to libc++. If you specify -stdlib=libstdc++, it will link to libstdc++. If your project needs a lot of third party libs, make sure they are all linked to the same c++ libs. Otherwise, you will see unexpected crashes in runtime
Just as you say, my project depend protobuf indeed. I need it is linked to the libstdc++. But It failed. It seem that protobuf do not support flag libstdc++. https://github.com/protocolbuffers/protobuf/issues/2945 How can I solve these incompatible problems? Thanks
I was able to get the HelloWorld program to run between my QNX machine and a Windows machine while using unicast (just have not had the time to try multicast discovery yet). So I consider this issue closed. To summarize, the changes I needed to make were:
Hi, @jilinzhou, I have compile the fast rtps for qnx. And start it with a very simple example found at: https://github.com/eProsima/Fast-RTPS/tree/master/examples/C%2B%2B/HelloWorldExample But They can not communicate with each other. are there anything needed to set? I run all the node in the QNX.
The ifconfig output is lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33136 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 ravb0: flags=8a43<UP,BROADCAST,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500 address: 4a:3b:83:03:38:36 media: Ethernet autoselect (1000baseT full-duplex) status: active inet 172.20.102.35 netmask 0xffffff00 broadcast 172.20.102.255 inet6 fe80::483b:83ff:fe03:3836%ravb0 prefixlen 64 scopeid 0x11
append:
the netstat -g output is:
root@~# netstat -g
Virtual Interface Table is empty Multicast Forwarding Cache is empty IPv6 Multicast Interface Table is empty IPv6 Multicast Routing Table is empty
The multicast seems does not work.
the nicinfo output is
root@# nicinfo en0 en0:
@darbee : Cannot remember I ever run those examples. I suggest you enable logging and debug from there. Take a closer look of its CMakelist.txt and figure out all possible configurable parameters. Here are some related to logging:
To build libfastrtps in debug mode, use -DCMAKE_BUILD_TYPE=Debug
To enable libfastrtps internal logging, use -DINTERNAL_DEBUG=ON
In any test program, in main.cc, set verbosity level Log::SetVerbosity(Log::Kind::Info);
by default, all log messages go to console.
@jilinzhou very thanks for your reply jilinzhou. I think it's not the reason of log level. Because I use the tcpdump -i lo0 to monitor the network. When I run the listener and talker, tcpdump output nothing. More detail message can find at https://github.com/eProsima/Fast-RTPS/issues/343. Thank for you jilinzhou again!
@darbee : Of course, it is not the log level problem. However looking at internal log messages help you find the root cause.
Hi, @jilinzhou, I have compile the fast rtps for qnx. And start it with a very simple example found at: https://github.com/eProsima/Fast-RTPS/tree/master/examples/C%2B%2B/HelloWorldExample But They can not communicate with each other. are there anything needed to set? I run all the node in the QNX.
The ifconfig output is lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33136 inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 ravb0: flags=8a43<UP,BROADCAST,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500 address: 4a:3b:83:03:38:36 media: Ethernet autoselect (1000baseT full-duplex) status: active inet 172.20.102.35 netmask 0xffffff00 broadcast 172.20.102.255 inet6 fe80::483b:83ff:fe03:3836%ravb0 prefixlen 64 scopeid 0x11
I did have to add initial peers. Probably something you could try: For example in HelloWorldPublisher::init() I added:
loc_initial_peer.set_IP4_address(127, 0, 0, 1);
loc_initial_peer.port = 7610;
PParam.rtps.builtin.initialPeersList.push_back(loc_initial_peer);
loc_initial_peer_host.set_IP4_address(192, 168, 10,3);
loc_initial_peer_host.port = 7610;
PParam.rtps.builtin.initialPeersList.push_back(loc_initial_peer_host);
# uname -a
QNX I 7.0.0 2017/02/14-16:05:38EST R-Car_H3_rev_1.1 aarch64le
1st console:
# HelloWorldExample subscriber
...
Message HelloWorld 275 RECEIVED
Message HelloWorld 276 RECEIVED
Message HelloWorld 277 RECEIVED
Message HelloWorld 278 RECEIVED
Message HelloWorld 279 RECEIVED
Message HelloWorld 280 RECEIVED
Message HelloWorld 281 RECEIVED
Message HelloWorld 282 RECEIVED
Message HelloWorld 283 RECEIVED
Message HelloWorld 284 RECEIVED
Message HelloWorld 285 RECEIVED
Message HelloWorld 286 RECEIVED
Message HelloWorld 287 RECEIVED
Message HelloWorld 288 RECEIVED
Message HelloWorld 289 RECEIVED
Message HelloWorld 290 RECEIVED
Message HelloWorld 291 RECEIVED
Message HelloWorld 292 RECEIVED
Message HelloWorld 293 RECEIVED
Message HelloWorld 294 RECEIVED
Message HelloWorld 295 RECEIVED
Message HelloWorld 296 RECEIVED
Message HelloWorld 297 RECEIVED
2nd console:
# HelloWorldExample publisher
...
Message: HelloWorld with index: 271 SENT
Message: HelloWorld with index: 272 SENT
Message: HelloWorld with index: 273 SENT
Message: HelloWorld with index: 274 SENT
Message: HelloWorld with index: 275 SENT
Message: HelloWorld with index: 276 SENT
Message: HelloWorld with index: 277 SENT
Message: HelloWorld with index: 278 SENT
Message: HelloWorld with index: 279 SENT
Message: HelloWorld with index: 280 SENT
Message: HelloWorld with index: 281 SENT
Message: HelloWorld with index: 282 SENT
Message: HelloWorld with index: 283 SENT
Message: HelloWorld with index: 284 SENT
Message: HelloWorld with index: 285 SENT
Message: HelloWorld with index: 286 SENT
Message: HelloWorld with index: 287 SENT
Message: HelloWorld with index: 288 SENT
Message: HelloWorld with index: 289 SENT
Message: HelloWorld with index: 290 SENT
Message: HelloWorld with index: 291 SENT
Message: HelloWorld with index: 292 SENT
Message: HelloWorld with index: 293 SENT
Message: HelloWorld with index: 294 SENT
Message: HelloWorld with index: 295 SENT
Message: HelloWorld with index: 296 SENT
Message: HelloWorld with index: 297 SENT
...
@suneeshs thanks you , I will try your suggestion. Soon I will tell you the result
@jilinzhou I want to cry. Why I can not get the output like you? Is there are some thing wrong with my QNX? I will listen to you to modify the log level to see the reason. By the way , can you tell me the output of " netstat -g " of you qnx machine?
the debug log is : ` [RTPS_READER Info] Sending ACKNACK: 2: -> Function event
[RTPS_MSG_IN Info] (ID:4) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:4) DST RTPSParticipant is now: 1.f.66.23.1c.40.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:4) HB Submsg ignored, DST is another RTPSParticipant... -> Function processCDRMsg
[RTPS_MSG_OUT Info] UDPv4: 64 bytes TO endpoint: 172.20.102.35:7410 FROM 0.0.0.0:65438 -> Function SendThroughSocket
[RTPS_MSG_OUT Info] SENT 64 -> Function SendThroughSocket
[RTPS_MSG_IN Info] (ID:5) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_OUT Info] UDPv4: 64 bytes TO endpoint: 239.255.0.1:7400 FROM 0.0.0.0:65438 -> Function SendThroughSocket
[RTPS_MSG_IN Info] (ID:5) DST RTPSParticipant is now: 1.f.66.23.1c.40.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:5) Acknack Submsg ignored, DST is another RTPSParticipant... -> Function processCDRMsg
[RTPS_MSG_OUT Info] SENT 64 -> Function SendThroughSocket
[RTPS_MSG_IN Info] (ID:4) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:4) DST RTPSParticipant is now: 1.f.66.23.1c.40.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:4) Acknack Submsg ignored, DST is another RTPSParticipant... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:5) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:5) DST RTPSParticipant is now: 1.f.66.23.21.50.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:5) Acknack Submsg received, processing... -> Function processCDRMs
[RTPS_WRITER Info] Requested Changes: 1 -> Function requested_changes_set
[RTPS_MSG_IN Info] (ID:4) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:4) DST RTPSParticipant is now: 1.f.66.23.21.50.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:4) Acknack Submsg received, processing... -> Function processCDRMsg
[RTPS_WRITER Info] Responding to Acknack msg -> Function event
[RTPS_WRITER Info] Sending relevant changes as DATA/DATA_FRAG messages -> Function add_data
[RTPS_WRITER Info] Sending INFO_TS message -> Function add_info_ts_in_buffer
[RTPS_MSG_OUT Info] UDPv4: 328 bytes TO endpoint: 127.0.0.1:7410 FROM 0.0.0.0:65438 -> Function SendThroughSocket
[RTPS_WRITER Info] Changing underway to unacked for Reader: 1.f.66.23.1c.40.45.0.0.0.0.0|0.0.4.c7 -> Function event
[RTPS_MSG_OUT Info] SENT 328 -> Function SendThroughSocket
[RTPS_WRITER Info] Finish sending unsent changes -> Function send_any_unsent_changes
[RTPS_MSG_IN Info] (ID:5) InfoDST message received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:5) DST RTPSParticipant is now: 1.f.66.23.1c.40.45.0.0.0.0.0 -> Function proc_Submsg_InfoDST
[RTPS_MSG_IN Info] (ID:5) InfoTS Submsg received, processing... -> Function processCDRMsg
[RTPS_MSG_IN Info] (ID:5) Data Submsg ignored, DST is another RTPSParticipant -> Function processCDRMsg`
And again @jilinzhou ilinzhou. Can you offer me your libs such as libfastcdr.so libfastcdr.so.1.0.7 libfastrtps.so libfastrtps.so.1 libfastrtps.so.1.6.0 and your executable file HelloWorldExample? Using these files , I can find out
When I first run
./HelloWorldExample publisher
and then
./HelloWorldExample subscriber
it will output
Subscriber matched
But Don't ouput anything.
When I first run
./HelloWorldExample subscriber
and then
./HelloWorldExample publisher
It will output
Publisher matched Message: HelloWorld with index: 1 SENT Message: HelloWorld with index: 2 SENT Message: HelloWorld with index: 3 SENT Message: HelloWorld with index: 4 SENT Message: HelloWorld with index: 5 SENT Message: HelloWorld with index: 6 SENT Message: HelloWorld with index: 7 SENT Message: HelloWorld with index: 8 SENT Message: HelloWorld with index: 9 SENT Message: HelloWorld with index: 10 SENT
But subscriber output nothing.
It is very strange for me.
Please accept my deepest thanks jilinzhou.
And it 's too late for me. It is about 01:18 in my time zone. so I may not be able to wait for your reply. sorry.
You can send these files to my email lantuling@gmail.com or Upload as an attachment.
By the way I want to know the
netstat -g
of you qnx system.
thanks again jilinzhou
@darbee : attached with the binaries. fast-rtps.tar.gz
Here is the linking info for the example:
jilin@jilin-Precision-3520 Downloads $ ntoaarch64-objdump -p ./HelloWorldExample
./HelloWorldExample: file format elf64-littleaarch64
...
Dynamic Section:
NEEDED libfastrtps.so
NEEDED libfastcdr.so
NEEDED libc++.so.1
NEEDED libm.so.3
NEEDED libc.so.4
...
Too sad, @jilinzhou using your libs and HelloWorldExample, It can run correctly. But using my code, I can only run staticworlExample.
Do you use the example at
https://github.com/eProsima/Fast-RTPS/tree/master/examples/C%2B%2B/HelloWorldExample
Have you change anything?
--- boost/asio/detail/impl/socket_ops.ipp (revision 843663) +++ boost/asio/detail/impl/socket_ops.ipp (working copy)
call_setsockopt(&msghdr::msg_namelen, s,
SOL_SOCKET, SO_REUSEPORT, optval, optlen);
}
+#else //QNX
}
except this file , any other file have you changed for qnx @jilinzhou ? By the way , I don't find the boost/asio/detail/impl/socket_ops.ipp
I only find a file named socket_ops.ipp at thirdparty/asio/asio/include/asio/detail/impl/socket_ops.ipp
boost/asio/detail/impl/socket_ops.ipp
--- boost/asio/detail/impl/socket_ops.ipp (revision 843663) +++ boost/asio/detail/impl/socket_ops.ipp (working copy)
call_setsockopt(&msghdr::msg_namelen, s, SOL_SOCKET, SO_REUSEPORT, optval, optlen); }
+#else //QNX
* ``` call_setsockopt(&msghdr::msg_namelen, s, ``` * ``` SOL_SOCKET, SO_REUSEPORT, optval, optlen); ```
endif
}
except this file , any other file have you changed for qnx @jilinzhou ? By the way , I don't find the boost/asio/detail/impl/socket_ops.ipp
I only find a file named socket_ops.ipp at thirdparty/asio/asio/include/asio/detail/impl/socket_ops.ipp
That is the only file I changed.
Hmmm. Interesting, still does't work.. @jilinzhou . Would you mind giving me a copy of the code of your version (fast rtps).Although I follow your steps and instructions to build the project
git clone https://github.com/eProsima/Fast-RTPS.git
cd Fast-RTPS
git checkout release/1.4.0
git submodule init
git submodule update
but I didn't get your results. Maybe this is the last way to help me to figure out what's wrong with my code.This may not seem very polite,But I've spent about a week on it.... I searched the whole network, there is nothing about qnx and fast rtps. You are my last hope, kind man..
@darbee Sorry, I cannot pass you the code but it should be exactly the same as yours. Are you using the toolchain file I uploaded? Are you linking it with libstdc++ or libc++? Use ntoaarch64-objdump -p to show that.
@jilinzhou yes,I use your toolchain file, and it link with libc++ . here is my objdump result:
`HelloWorldExample: file format elf64-littleaarch64`
`Dynamic Section:
NEEDED libfastrtps.so.1
NEEDED libfastcdr.so.1.0.7
NEEDED libc++.so.1
NEEDED libm.so.3
NEEDED libc.so.4`
`build/src/cpp/libfastrtps.so: file format elf64-littleaarch64`
`Dynamic Section:
NEEDED libsocket.so.3
NEEDED libfastcdr.so.1.0.7
NEEDED libc++.so.1
NEEDED libm.so.3
NEEDED libc.so.4
SONAME libfastrtps.so.1`
`build/thirdparty/fastcdr/src/cpp/libfastcdr.so: file format elf64-littleaarch64`
`Dynamic Section:
NEEDED libsocket.so.3
NEEDED libc++.so.1
NEEDED libm.so.3
NEEDED libc.so.4
SONAME libfastcdr.so.1.0.7`
By the way why In you project, there is a boost path,boost/asio/detail/impl/socket_ops.ipp but mine is thirdparty/asio/asio/include/asio/detail/impl/socket_ops.ipp
Hi @jilinzhou thanks again, I have work it out. On the basis of your help, I change the socket_ops.ipp file. But instead using
else //QNX call_setsockopt(&msghdr::msg_namelen, s, SOL_SOCKET, SO_REUSEPORT, optval, optlen);
I change the code
from
|| defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
to
|| defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__)
Thank you again for your tireless help. I can't solve this problem without you!
Hi @jilinzhou thanks again, I have work it out. On the basis of your help, I change the socket_ops.ipp file. But instead using
else //QNX call_setsockopt(&msghdr::msg_namelen, s, SOL_SOCKET, SO_REUSEPORT, optval, optlen);
I change the code from
|| defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
to|| defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__)
Thank you again for your tireless help. I can't solve this problem without you!
glad that you figured it out. My diff for socket_ops.ipp was generated in somewhere else. The way you are doing it is supposed to be.
Aha, That is how it is. Anyway, thank you very much for your selfless help.
Came across the following issue while compiling Fast-RTPS(v1.6.0) on QNX 7.0 with libc++
eProsima/Fast-RTPS/thirdparty/asio/asio/include/asio/detail/handler_alloc_helpers.hpp:169:26: error: 'struct std::__1::allocator_traits<asio::detail::hook_allocator<std::__1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::*)(), eprosima::fastrtps::rtps::ResourceEvent*>, void> >::rebind_alloc<asio::detail::completion_handler<std::__1::__bind<void (eprosima::fastrtps::rtps::ResourceEvent::*)(), eprosima::fastrtps::rtps::ResourceEvent*> > >' has no member named 'allocate'
return a.allocate(1);
Since QNX libc++ is at 3.7 it does not yet support TEMPLATE_ALIASES. Created the patch file fast_rtps_asio.patch.gz to fix the issue
@anup-pem : I think your configuration has some issues. The libc++ shipped with QNX SDP 7.0.0 for sure has alias_template feature. I have attached the feature_tests.cxx used by CMake here. You can try it manually as the following: feature_tests.cxx.txt
>>ntoaarch64-g++ -std=c++11 feature_tests.cxx -o feature_tests.bin
>>strings feature_tests.bin | grep FEATURE
CXX_FEATURE:0cxx_aggregate_default_initializers
CXX_FEATURE:1cxx_alias_templates
CXX_FEATURE:1cxx_alignas
CXX_FEATURE:1cxx_alignof
CXX_FEATURE:1cxx_attributes
CXX_FEATURE:0cxx_attribute_deprecated
CXX_FEATURE:1cxx_auto_type
CXX_FEATURE:0cxx_binary_literals
CXX_FEATURE:1cxx_constexpr
CXX_FEATURE:0cxx_contextual_conversions
CXX_FEATURE:1cxx_decltype
CXX_FEATURE:0cxx_decltype_auto
CXX_FEATURE:1cxx_decltype_incomplete_return_types
CXX_FEATURE:1cxx_default_function_template_args
CXX_FEATURE:1cxx_defaulted_functions
CXX_FEATURE:1cxx_defaulted_move_initializers
CXX_FEATURE:1cxx_delegating_constructors
CXX_FEATURE:1cxx_deleted_functions
CXX_FEATURE:0cxx_digit_separators
CXX_FEATURE:1cxx_enum_forward_declarations
CXX_FEATURE:1cxx_explicit_conversions
CXX_FEATURE:1cxx_extended_friend_declarations
CXX_FEATURE:1cxx_extern_templates
CXX_FEATURE:1cxx_final
CXX_FEATURE:1cxx_func_identifier
CXX_FEATURE:1cxx_generalized_initializers
CXX_FEATURE:0cxx_generic_lambdas
CXX_FEATURE:1cxx_inheriting_constructors
CXX_FEATURE:1cxx_inline_namespaces
CXX_FEATURE:1cxx_lambdas
CXX_FEATURE:0cxx_lambda_init_captures
CXX_FEATURE:1cxx_local_type_template_args
CXX_FEATURE:1cxx_long_long_type
CXX_FEATURE:1cxx_noexcept
CXX_FEATURE:1cxx_nonstatic_member_init
CXX_FEATURE:1cxx_nullptr
CXX_FEATURE:1cxx_override
CXX_FEATURE:1cxx_range_for
CXX_FEATURE:1cxx_raw_string_literals
CXX_FEATURE:1cxx_reference_qualified_functions
CXX_FEATURE:0cxx_relaxed_constexpr
CXX_FEATURE:0cxx_return_type_deduction
CXX_FEATURE:1cxx_right_angle_brackets
CXX_FEATURE:1cxx_rvalue_references
CXX_FEATURE:1cxx_sizeof_member
CXX_FEATURE:1cxx_static_assert
CXX_FEATURE:1cxx_strong_enums
CXX_FEATURE:1cxx_template_template_parameters
CXX_FEATURE:1cxx_thread_local
CXX_FEATURE:1cxx_trailing_return_types
CXX_FEATURE:1cxx_unicode_literals
CXX_FEATURE:1cxx_uniform_initialization
CXX_FEATURE:1cxx_unrestricted_unions
CXX_FEATURE:1cxx_user_literals
CXX_FEATURE:0cxx_variable_templates
CXX_FEATURE:1cxx_variadic_macros
CXX_FEATURE:1cxx_variadic_templates
@jilinzhou Thank you for your response. Sorry for not being specific about the version of Fast-RTPS. I am using v1.6.0. I updated my previous comment. Would be great if you can compile v1.6.0 version without any asio changes. If so, please let me know.
Thanks Anup
@jilinzhou For simplicity, I created a test case to reproduce the problem I see in asio package(asio/include/asio/detail/memory.hpp) when compiling Fast-RTPS with v1.6.0.
Just copy this code into a file called test_bind.cpp and the command used to compile is at the beginning of the source code. If you uncomment the #ifndef and #else part of the code, it compiles fine. Please let me know if there is a better solution so that I don't have to use my asio patch (https://github.com/eProsima/Fast-RTPS/issues/272#issuecomment-444694893) . Just curious.
Thanks Anup
//
// This code was compiled using the following command
//
// qnx700/host/linux/x86_64/usr/bin/qcc -lang-c++ -D__DEBUG -Wp,-isystem,-Vgcc_ntox86_64 -g -D__USESRCVERSION -D_QNX_SOURCE -DQNX -fsized-deallocation -Wall -pedantic -Wextra -Wno-unknown-pragmas -g -fPIC -std=c++14 -o test_bind test_bind.cpp
#include <memory>
#include <string>
// Example allocator, doesn't do anything but implements std::allocator_traits
template<typename T>
struct null_allocator {
using value_type = T;
null_allocator() {}
template<typename U>
null_allocator(const null_allocator<U>&) {}
T* allocate(size_t size) {
(void) size;
return NULL;
}
void deallocate(T* ptr, size_t size) {
(void) ptr;
(void) size;
}
};
template<typename T, typename U>
constexpr bool operator== (const null_allocator<T>&, const null_allocator<U>&) noexcept {
return true;
}
template<typename T, typename U>
constexpr bool operator!= (const null_allocator<T>&, const null_allocator<U>&) noexcept {
return false;
}
//
// NOTE: Uncomment the ifndef-else belows (lines 43 and 46-49) for the code to compile without errors
//
//#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template<typename T>
using RebindAlloc = typename std::allocator_traits<null_allocator<void>>::template rebind_alloc<T>;
//#else
//template<typename T>
//using RebindAlloc = typename std::allocator_traits<null_allocator<void>>::template rebind_alloc<T>::other;
//#endif
using MyString = std::basic_string<char, std::char_traits<char>, RebindAlloc<char>>;
int main(int /*argc*/, char ** /*argv*/)
{
// check that null_allocator follows allocator_traits
null_allocator<void> alloc;
void * ptr = std::allocator_traits<null_allocator<void>>::allocate(alloc, 1);
MyString string;
}
You can build it against GNU c++ library as the following:
qcc -Vgcc_ntox86_64_gpp -g -fsized-deallocation -Wall -pedantic -Wextra -Wno-unknown-pragmas -vv -Wfatal-errors -o test_bind test_bind.cpp
Have you been able to built it against LLVM c++ library on linux?
@anup-pem : qnx sdp7 qcc toolchain only supports gcc compiler (version 5.4.0) which has no built-in macro __had_feature()
defined (it is a Clang thing). Therefore in $QNX_TARGET//usr/include/c++/v1/__config, it is set to 0 as the following:
...
#define _LIBCPP_VERSION 3700
...
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
...
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
...
The gcc compiler has __has_cpp_attribute
defined for this purpose. Hope this info can help you a bit.
@jilinzhou
You can build it against GNU c++ library as the following: qcc -Vgcc_ntox86_64_gpp -g -fsized-deallocation -Wall -pedantic -Wextra -Wno-unknown-pragmas -vv -Wfatal-errors -o test_bind test_bind.cpp
Yes, it works for libstdc++ with Vgcc_ntox86_64_gpp or -stdlib=libstdc++. The issue is with the LLVM C++.
Have you been able to built it against LLVM c++ library on linux?
Have not tested on Linux. But we do OS X build with LLVM C++ lib and it works fine
The gcc compiler has __has_cpp_attribute defined for this purpose. Hope this info can help you a bit.
Not sure how it will help in fixing the std::allocator_traits::rebind_alloc
alias error. Could you show me how can I use it either with the test_bind.cpp example or the newer version of Fast-RTPS so that I don't get the compile error with lib LLVM C++ (libc++) library? Might be I am missing something.
@anup-pem : With this combination of gcc 5.4.0 compiler and libc++ 3.7.0, we are pretty much out of luck but use your patch. Here is a link which talks about the similar issue: https://android.googlesource.com/platform/ndk/+/a6aa439%5E!/
FYI, I created chriskohlhoff/asio#353 adding the SO_REUSEPORT option for QNX
@MiguelCompany : Thanks!
For problems with QNX SDP 7.0 and LLVM backend (cxx
runtime) see here: https://github.com/boostorg/boost/issues/208#issuecomment-498182528
I am having some trouble compiling FastRTPS for QNX. ‘fastcdr’ builds but compiling ‘fastrtps’ errors out complaining about asio related issues. I noticed that you have listed QNX as one of the platforms for which FastRTPS has been built so wanted to check if I am missing something.
I am cross compiling through CMAKE using a QNX toolchain file. The workflow is described in the PDF file that is in the attached ZIP file. It also contains the toolchain file that I am using. Any help is appreciated, please let me know if you need any more information. FastRTPS_QNX_build_issue.zip