Windows下OpenDDS编译测试

先从OpenDDS官方网站ACE/TAO官网获取源码。

前提

Windows 10 + Visual Studio 2010 Express + Perl 5.24.1 + OpenDDS 3.8 + ACE_TAO 2.2a

设置

Strawberry Perl官网下载最新版的程序,版本应该没什么要求。安装完成会自动设置环境变量。

设置环境变量

  • ACE_ROOT ACE源码的位置,一般是*/*/ACE_wrapers
  • DDS_ROOT DDS源码的位置
  • TAO_ROOT TAO源码位置,一般是%ACE_ROOT%/TAO

修改系统的hosts文件,添加

1
192.168.50.20 DESKTOP-666666.localhost DESKTOP-666666
  • 192.168.50.20是本机IP
  • DESKTOP-666666是本机名
  • localhost是本机的hostname

编译

打开VS2010的终端,进入DDS源码的位置

source

执行命令

1
configure

如果没有设置环境变量,脚本会自动下载2.2版本的ACE源码并自动解压。

执行会报错

1
2
D:\OpenDDS-DDS-3.8>configure
can't open TAO VERSION

我们打开configure文件查看一下,在第564行有

1
2
3
4
5
6
7
8
9
10
unless ($opts{'dry-run'} && $would_download) {
open TAOVER, $tao_src . '/VERSION' or die "can't open TAO VERSION\n";
while (<TAOVER>) {
if (/^This is TAO version (\d)/) {
$tao_maj = $1;
last;
}
}
close TAOVER;
}

它会查找TAO源码目录下得VERSION文件,并解析。

但是下载的源码中没有这个文件,我们直接创建一个,内容为

1
2.2a

继续执行命令输出为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
D:\OpenDDS-DDS-3.8>configure
ACE_ROOT/ace/config.h exists, skipping configuration of ACE+TAO
Running MPC to generate project files.
MPC_ROOT was set to D:\OpenDDS-DDS-3.8\ACE_wrappers\MPC.
Using .../OpenDDS-DDS-3.8/ACE_wrappers/bin/MakeProjectCreator/config/MPC.cfg
Generating 'vc10' output using DDS.mwc
Skipping Monitor_App (Monitor.mpc); it requires qt4.
Skipping ExcelRTD (ExcelRTD.mpc); it requires qt4.
Skipping dissector (dissector.mpc); it requires wireshark_any.
Skipping FaceUnitTests_SafetyProfilePool (FaceUnitTests.mpc); it avoids no_opendds_safety_profile.
Skipping qos_dump (qos_dump.mpc); it requires dds4ccm_opendds.
Skipping DDS_Inconsistent_Qos_Inconsistent_Qos (Inconsistent_Qos.mpc); it requires dds4ccm_opendds.
Skipping zerocopy_java_test (zerocopy.mpc); it requires java.
Skipping transport_config (transport_config.mpc); it requires java.
Skipping multirepo_test (multirepo_test.mpc); it requires java.
Skipping subscriber_idl_test (subscriber_idl_test.mpc); it requires java.
Skipping publisher_idl_test (publisher_idl_test.mpc); it requires java.
Skipping messenger_idl_test (messenger_idl_test.mpc); it requires java.
Skipping java_both_test (java_both_test.mpc); it requires java.
Skipping hello_java_client (hello_java_client.mpc); it requires java.
Skipping complex_idl_test (complex_idl_test.mpc); it requires java.
Skipping builtintopics_test (builtintopics_test.mpc); it requires java.
Skipping tao_java (tao_java.mpc); it requires java.
Skipping idl2jni_test_simple (idl2jni_test_simple.mpc); it requires java.
Skipping idl2jni_runtime (idl2jni_runtime.mpc); it requires java.
Skipping idl2jni_codegen (idl2jni_codegen.mpc); it requires java.
Skipping dcps_java (dcps_java.mpc); it requires java.
Skipping ishapes (ishapes.mpc); it requires qt4.
Skipping OpenDDS_XML_QOS_XSC_Generation (qos_xml_handler.mpc); it requires xsc.
Skipping OpenDDS_QOS_XML_XSC_Handler (qos_xml_handler.mpc); it requires xerces.
Skipping OpenDDS_CorbaSeq (CorbaSeq.mpc); it avoids no_opendds_safety_profile.
Skipping OpenDDS_Corba (OpenDDS_Corba.mpc); it avoids no_opendds_safety_profile.
Generation Time: 1m 7s
WARNING: overwriting existing D:\OpenDDS-DDS-3.8/setenv.cmd (saved a backup copy as D:\OpenDDS-DDS-3.8/setenv.cmd.bak.10264)
Completed configuring OpenDDS, next build 'DDS.sln' using the 'Debug' configuration to compile OpenDDS.
You can use the generated setenv.cmd script to set environment
variables for future shell sessions.
Start Visual Studio from this command prompt so that it inherits the correct
environment variables.

D:\OpenDDS-DDS-3.8>

在DDS源码文件夹中,会自动生成VS2010的工程文件(以及子工程文件)

project

用VS2010打开工程

open

编译,可能不会全部编译成功,但是至少应该在DDS的bin有opendds_idl.exe,在ACE源码的bin中有tao_idl.exe

找到DCPSInfoRepo_MainDCPSInfoRepo_ServDCPSInfoRepo_LibMessengerMinimal_PublisherMessenger_Subscriber等工程,编译。会得到DCPSInfoRepo.exe及其依赖DLL,Publisher.exe/Subscriber.exe。

测试

发现端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ ./DCPSInfoRepo -ORBListenEndpoints iiop://192.168.50.20:12345 -ORBDebugLevel 10
TAO (15936|14268) - Did not find default svc.conf
TAO (15936|14268) - Completed initializing the process-wide service context
TAO (15936|14268) - Default ORB services initialization begins
TAO (15936|14268) - Default ORB services initialization completed
TAO (15936|14268) - We are the default ORB ...
TAO (15936|14268) - Initializing the orb-specific services
TAO (15936|14268) - ORBInitializer_Registry::register_orb_initializer 0 @024B4540
TAO (15936|14268) - TAO_Time_Policy_Manager: loaded time policy strategy 'TAO_SYSTEM_TIME_POLICY'
TAO (15936|14268) - Default_Resource_Factory - codeset manager=024C2088
TAO (15936|14268) - Codeset_Manager_i::init_ccs, Loaded Codeset translator <UTF8_Latin1_Factory>, ncs = 00010001 tcs = 05010001
TAO (15936|14268) - UTF16_BOM_Translator: forceBE 0
TAO (15936|14268) - Loaded default protocol <IIOP_Factory>
TAO (15936|14268) - Created new ORB <>
TAO (15936|14268) - Waiting for the default ORB to complete the global initialization
TAO (15936|14268) - The default ORB must have completed the global initialization...
TAO (15936|14268) - Initializing the orb-specific services
TAO (15936|14268) - Default_Resource_Factory - codeset manager=024F4228
TAO (15936|14268) - Codeset_Manager_i::init_ccs, Loaded Codeset translator <UTF8_Latin1_Factory>, ncs = 00010001 tcs = 05010001
TAO (15936|14268) - Loaded protocol <IIOP_Factory>
TAO (15936|14268) - Created new ORB <dispatchingOnly>
TAO (15936|14268) - IIOP_Acceptor::open, address==192.168.50.20:12345, options=(null)
TAO (15936|14268) - IIOP_Acceptor::open, specified host=192.168.50.20:12345
TAO (15936|14268) - IIOP_Acceptor::open_i, trying to listen on port 12345
TAO (15936|14268) - IIOP_Acceptor::open_i, listening on: <192.168.50.20:12345>
TAO (15936|14268) - TAO_Unique_Id_Strategy::bind_using_user_id: type=IDL:OpenDDS/DCPS/DCPSInfo:1.0, id=0x496e666f526570
TAO (15936|14268) - Stub::base_profiles, acquired profile lock this = 0x250bae8

192.168.50.20是本机IP,12345是测试默认端口,ORBDebugLevel 10是输出日志等级

发布端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ ./publisher -DCPSInfoRepo corbaloc::192.168.50.20:12345/DCPSInfoRepo -DCPSDebugLevel 1
(3844|15444) NOTICE: not using file configuration - no configuration file specified.
(3844|15444) NOTICE: Service_Participant::intializeScheduling() - no scheduling policy specified, not setting policy.
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000107(f28dc31) remote 01030000.b795cab2.00000001.00000102(38e2526e)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 1
(3844|15444) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000207(24058ff2) remote 01030000.b795cab2.00000001.00000202(13cf01ad)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 2
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 1
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 2
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000307(3d1ebeb3) remote 01030000.b795cab2.00000001.00000402(4595a62b)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 3
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 3
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000407(725f2874) remote 01030000.b795cab2.00000001.00000302(ad430ec)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 4
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 4

订阅端

1
./subscriber -DCPSInfoRepo corbaloc::192.168.50.20:12345/DCPSInfoRepo -DCPSDebugLevel 1

订阅端未执行时,发布端是处于等待的状态。

订阅端执行后,输出为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
$  ./subscriber -DCPSInfoRepo corbaloc::192.168.50.20:12345/DCPSInfoRepo -DCPSDebugLevel 1
(6492|6164) NOTICE: not using file configuration - no configuration file specified.
(6492|6164) NOTICE: Service_Participant::intializeScheduling() - no scheduling policy specified, not setting policy.
(6492|15176) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000003.00000107(3248f581) remote 01030000.b795cab2.00000001.00000102(38e2526e)
(6492|6532) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 1
(6492|6164) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000003.00000207(1965a642) remote 01030000.b795cab2.00000001.00000202(13cf01ad)
(6492|6532) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 2
(6492|6532) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 1
(6492|6532) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 2
(6492|15176) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000003.00000307(7e9703) remote 01030000.b795cab2.00000001.00000402(4595a62b)
(6492|6532) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 3
(6492|6532) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 3
(6492|15176) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000003.00000407(4f3f01c4) remote 01030000.b795cab2.00000001.00000302(ad430ec)
(6492|6532) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 4
(6492|6532) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 4
(6492|15176) DataReaderImpl::add_association - bit 0 local 01030000.b795cab2.00000003.00000507(56243085) remote 01030000.b795cab2.00000002.00000102(7f4228be)
Msg: subject Review
subject_id 99
from Comic Book Guy
count 0
text Worst. Movie. Ever.
Msg: subject Review
subject_id 100
from Comic Book Guy
count 1
text Worst. Movie. Ever.
Msg: subject Review
subject_id 101
from Comic Book Guy
count 2
text Worst. Movie. Ever.
Msg: subject Review
subject_id 102
from Comic Book Guy
count 3
text Worst. Movie. Ever.
Msg: subject Review
subject_id 103
from Comic Book Guy
count 4
text Worst. Movie. Ever.
Msg: subject Review
subject_id 104
from Comic Book Guy
count 5
text Worst. Movie. Ever.
Msg: subject Review
subject_id 105
from Comic Book Guy
count 6
text Worst. Movie. Ever.
Msg: subject Review
subject_id 106
from Comic Book Guy
count 7
text Worst. Movie. Ever.
Msg: subject Review
subject_id 107
from Comic Book Guy
count 8
text Worst. Movie. Ever.
Msg: subject Review
subject_id 108
from Comic Book Guy
count 9
text Worst. Movie. Ever.
(6492|15176) DataReaderImpl::remove_associations: bit 0 local 01030000.b795cab2.00000003.00000507(56243085) remote 01030000.b795cab2.00000002.00000102(7f4228be) num remotes 1
(6492|6532) RemoveAssociationSweeper::ScheduleCommand::execute() - Scheduled sweeper 6
(6492|8992) TcpConnection::handle_close() called on transport: _OPENDDS_0500_TCP to 192.168.50.20:62635.
((6492|6532)) RemoveAssociationSweeper::handle_timeout reader: 01030000.b795cab2.00000003.00000507(56243085) waiting on writer: 01030000.b795cab2.00000002.00000102(7f4228be)
(6492|6532) DataReaderImpl::remove_associations: bit 0 local 01030000.b795cab2.00000003.00000507(56243085) remote 01030000.b795cab2.00000002.00000102(7f4228be) num remotes 1
(6492|6532) DataReaderImpl::remove_associations_i: bit 0 local 01030000.b795cab2.00000003.00000507(56243085) remote 01030000.b795cab2.00000002.00000102(7f4228be) num remotes 1
(6492|6532) RemoveAssociationSweeper::CancelCommand::execute() - Unscheduled sweeper 6
(6492|8992) DataLink::handle_exception() - (delay) scheduling timer for future release
Subscriber received 10 samples
(6492|6532) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000003.00000107(3248f581) remote 01030000.b795cab2.00000001.00000102(38e2526e) num remotes 1
(6492|6532) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000003.00000107(3248f581) remote 01030000.b795cab2.00000001.00000102(38e2526e) num remotes 1
(6492|6532) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000003.00000307(7e9703) remote 01030000.b795cab2.00000001.00000402(4595a62b) num remotes 1
(6492|6532) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000003.00000307(7e9703) remote 01030000.b795cab2.00000001.00000402(4595a62b) num remotes 1
(6492|6532) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000003.00000407(4f3f01c4) remote 01030000.b795cab2.00000001.00000302(ad430ec) num remotes 1
(6492|6532) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000003.00000407(4f3f01c4) remote 01030000.b795cab2.00000001.00000302(ad430ec) num remotes 1
(6492|6532) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000003.00000207(1965a642) remote 01030000.b795cab2.00000001.00000202(13cf01ad) num remotes 1
(6492|6532) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000003.00000207(1965a642) remote 01030000.b795cab2.00000001.00000202(13cf01ad) num remotes 1
(6492|16320) TcpConnection::handle_close() called on transport: _OPENDDS__BITTCPTransportInst_DEFAULT_REPO to 192.168.50.20:62627.
(6492|16320) DataLink::handle_exception() - delay already elapsed so handle_timeout now
09:47:16.557630 (6492|6164) DomainParticipantFactoryImpl::~DomainParticipantFactoryImpl()
09:47:16.558628 (6492|6164) Service_Participant::~Service_Participant()

hyper@DESKTOP-6VR0CQ2 MINGW64 /d/OpenDDS-DDS-3.8/bin

执行完毕自动退出

发布端输出为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$ ./publisher -DCPSInfoRepo corbaloc::192.168.50.20:12345/DCPSInfoRepo -DCPSDebugLevel 1
(3844|15444) NOTICE: not using file configuration - no configuration file specified.
(3844|15444) NOTICE: Service_Participant::intializeScheduling() - no scheduling policy specified, not setting policy.
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000107(f28dc31) remote 01030000.b795cab2.00000001.00000102(38e2526e)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 1
(3844|15444) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000207(24058ff2) remote 01030000.b795cab2.00000001.00000202(13cf01ad)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 2
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 1
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 2
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000307(3d1ebeb3) remote 01030000.b795cab2.00000001.00000402(4595a62b)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 3
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 3
(3844|18196) DataReaderImpl::add_association - bit 1 local 01030000.b795cab2.00000002.00000407(725f2874) remote 01030000.b795cab2.00000001.00000302(ad430ec)
(3844|8408) EndHistoricSamplesMissedSweeper::ScheduleCommand::execute() - Scheduled sweeper 4
(3844|8408) EndHistoricSamplesMissedSweeper::CancelCommand::execute() - Unscheduled sweeper 4
(3844|18196) DataWriterRemoteImpl::add_association - local 01030000.b795cab2.00000002.00000102(7f4228be) remote 01030000.b795cab2.00000003.00000507(56243085)
(3844|18196) DataWriterImpl::add_association - bit 0 local 01030000.b795cab2.00000002.00000102(7f4228be) remote 01030000.b795cab2.00000003.00000507(56243085)
(3844|18196) DataWriterImpl::transport_assoc_done: writer 01030000.b795cab2.00000002.00000102(7f4228be) succeeded in associating with reader 01030000.b795cab2.00000003.00000507(56243085)
(3844|18196) DataWriterImpl::transport_assoc_done: marked 01030000.b795cab2.00000003.00000507(56243085) as pending.
(3844|18196) DataWriterImpl::association_complete - bit 0 local 01030000.b795cab2.00000002.00000102(7f4228be) remote 01030000.b795cab2.00000003.00000507(56243085)
(3844|18196) DataWriterImpl::association_complete_i - bit 0 local 01030000.b795cab2.00000002.00000102(7f4228be) remote 01030000.b795cab2.00000003.00000507(56243085)
(3844|15444) DataWriterImpl::create_ack_token() - for sequence 20
(3844|15444) DataWriterImpl::wait_for_acknowledgments waiting for acknowledgment of sequence 20 at 09:47:14.540457
(3844|8408) DataWriterImpl::remove_associations: bit 0 local 01030000.b795cab2.00000002.00000102(7f4228be) remote 01030000.b795cab2.00000003.00000507(56243085) num remotes 1
(3844|4896) DataLink::handle_exception() - (delay) scheduling timer for future release
(3844|8408) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000002.00000107(f28dc31) remote 01030000.b795cab2.00000001.00000102(38e2526e) num remotes 1
(3844|8408) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000002.00000107(f28dc31) remote 01030000.b795cab2.00000001.00000102(38e2526e) num remotes 1
(3844|8408) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000002.00000307(3d1ebeb3) remote 01030000.b795cab2.00000001.00000402(4595a62b) num remotes 1
(3844|8408) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000002.00000307(3d1ebeb3) remote 01030000.b795cab2.00000001.00000402(4595a62b) num remotes 1
(3844|8408) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000002.00000407(725f2874) remote 01030000.b795cab2.00000001.00000302(ad430ec) num remotes 1
(3844|8408) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000002.00000407(725f2874) remote 01030000.b795cab2.00000001.00000302(ad430ec) num remotes 1
(3844|8408) DataReaderImpl::remove_associations: bit 1 local 01030000.b795cab2.00000002.00000207(24058ff2) remote 01030000.b795cab2.00000001.00000202(13cf01ad) num remotes 1
(3844|8408) DataReaderImpl::remove_associations_i: bit 1 local 01030000.b795cab2.00000002.00000207(24058ff2) remote 01030000.b795cab2.00000001.00000202(13cf01ad) num remotes 1
(3844|17144) TcpConnection::handle_close() called on transport: _OPENDDS__BITTCPTransportInst_DEFAULT_REPO to 192.168.50.20:62627.
(3844|17144) DataLink::handle_exception() - delay already elapsed so handle_timeout now
09:47:14.555419 (3844|15444) DomainParticipantFactoryImpl::~DomainParticipantFactoryImpl()
09:47:14.555419 (3844|15444) Service_Participant::~Service_Participant()

发布完10条信息并确定订阅端接受到10条信息自动退出

而此时DCPSInfoRepo依旧处于运行状态。

测试运行正常,那就表示程序和DLL没有问题,如果后续运行失败就只能是程序写错了,或者配置不对。

结果

好像只能编译32位,本文测试是VS2010 + OpenDDS 3.8 + ACE 2.2a Debug/Release Win32,压缩包为100M,解压后为1G。

CSDN下载地址:VS2010-OpenDDS3.8-Debug-Release-Win32


Windows下OpenDDS编译测试
https://feater.top/opendds/opendds-compile-and-test-under-windows10/
作者
JackeyLea
发布于
2021年12月17日
许可协议