问题描述
我正在尝试将其包裹在omniORB上,以准备使用它与将要使用CORBA的软件进行交互。我正在使用的策略是在omniORB中作为一个示例(回显示例,特别是eg3_impl和eg3_cc),然后将接收到的软件中的idl进行混合,直到达到我想要的效果为止。为了解决这个问题,我试图将我正在编写的软件与omniORB堆栈的其余部分隔离开(即,我试图编写一个依赖于编译库的独立makefile)。我正在使用从sourceforge下载的omniORB-4.2.3(通过omniORB-support.com链接)。
我要解决的问题是,从独立makefile编译的示例似乎存在内存问题,而树内编译示例则没有该问题;
- 从独立的Makefile编译的示例试图取消分配未进行“ malloc()”或“ new”处理的指针。 (很烦人,但不是风骚人物)
- 从独立Makefile编译的示例似乎未正确记录字符串指针。 (最热门)。
两个示例之间的源文件相同;唯一的区别是,非独立示例使用内置在omniORB树中的makefile结构,而独立软件则根据我在构建echo示例时观察到的makefile结构所做的工作,使用了我编写的编译脚本。>
这是我的脚本:
WHICH_BUILD_DIR=build2
WHICH_VERSION=omniORB-4.2.3
INCLUDE_G_PLUS_PLUS="-I./idl_artifacts/ -I../${WHICH_VERSION}/include -I. -I../${WHICH_VERSION}/${WHICH_BUILD_DIR}/include"
DEFInes_G_PLUS_PLUS="-D__OMNIORB4__ -D_REENTRANT -D__OsveRSION__=2 -D__linux__ -D__x86__"
LIBRARY_G_PLUS_PLUS="-L../${WHICH_VERSION}/${WHICH_BUILD_DIR}/lib -L/usr/lib"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/home/jasont/FACE_translator/omniORB-4.2.3/build2/lib
reset
if [ "~$1" == "~debug" ] ; then DEBUGGER_OPTION="-g"
else DEBUGGER_OPTION="" ; fi
rm -rf ./idl_artifacts *.o eg3_impl eg3_clt eg3_tieimpl
mkdir idl_artifacts
#compile idl file to skeleton files
../${WHICH_VERSION}/${WHICH_BUILD_DIR}/bin/omniidl -bcxx -Wba -Wbtp -C./idl_artifacts/ echo.idl
#regular compile
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFInes_G_PLUS_PLUS -o echoSK.o ./idl_artifacts/echoSK.cc
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFInes_G_PLUS_PLUS -o eg3_impl.o eg3_impl.cc
# g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFInes_G_PLUS_PLUS -o eg3_tieimpl.o eg3_tieimpl.cc
g++ -c $DEBUGGER_OPTION -O2 -Wall -Wno-unused -fexceptions $INCLUDE_G_PLUS_PLUS $DEFInes_G_PLUS_PLUS -o eg3_clt.o eg3_clt.cc
#regular link
# g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions eg3_impl.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
##g++ -o eg3_tieimpl -O2 -Wall -Wno-unused -fexceptions eg3_tieimpl.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
# g++ -o eg3_clt -O2 -Wall -Wno-unused -fexceptions eg3_clt.o echoSK.o $LIBRARY_G_PLUS_PLUS -lomniORB4 -lomnithread -lpthread
g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions eg3_impl.o echoSK.o $LIBRARY_G_PLUS_PLUS -static -lomniORB4 -lomnithread -lpthread
./eg3_impl
...这是我看到的独立软件的功能(通过将omniORB.cfg跟踪级别设置为最大值来生成)
...
omniORB: (0) 2020-11-06 12:50:37.443054: LocateRequest to remote: key<NameService>
omniORB: (1) 2020-11-06 12:50:37.443022: giopRendezvouser task execute for giop:tcp:10.0.0.247:57082
omniORB: (2) 2020-11-06 12:50:37.443166: AsyncInvoker: thread id 2 has started. Total threads = 2.
omniORB: (2) 2020-11-06 12:50:37.443199: AsyncInvoker: thread id 2 assigned to general tasks. Total general threads = 2.
omniORB: (2) 2020-11-06 12:50:37.443217: AsyncInvoker: thread id 2 performing immediate general task.
omniORB: (2) 2020-11-06 12:50:37.443232: Scavenger task execute.
omniORB: (1) 2020-11-06 12:50:37.493125: SocketCollection idle. Sleeping.
omniORB: (0) 2020-11-06 12:50:38.443279: Client attempt to connect to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:50:38.443411: Client opened connection to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:50:38.443423: sendChunky: to giop:tcp:10.0.0.247:2809 35 bytes
omniORB: (0) 2020-11-06 12:50:38.443432:
4749 4f50 0102 0103 1700 0000 0200 0000 GIOP............
0000 7665 0b00 0000 4e61 6d65 5365 7276 ..ve....NameServ
6963 65 ice
omniORB: (0) 2020-11-06 12:50:38.443236: omniORB: (0) 2020-11-06 12:50:37.443107: omniORB: (0) 2020-11-06 12:50:38.444269: inputMessage: from giop:tcp:10.0.0.247:2809 20 bytes
omniORB: (0) 2020-11-06 12:50:38.444312:
4749 4f50 0102 0104 0800 0000 0200 0000 GIOP............
0100 0000 ....
omniORB: (0) 2020-11-06 12:50:38.444395: Send codeset service context: (ISO-8859-1,UTF-16)
omniORB: (0) 2020-11-06 12:50:38.444426: sendChunky: to giop:tcp:10.0.0.247:2809 92 bytes
omniORB: (0) 2020-11-06 12:50:38.444439:
4749 4f50 0102 0100 5000 0000 0400 0000 GIOP....P.......
0300 0000 0000 0000 0b00 0000 4e61 6d65 ............Name
5365 7276 6963 6578 1100 0000 6269 6e64 Servicex....bind
5f6e 6577 5f63 6f6e 7465 7874 0069 4f52 _new_context.iOR
0100 0000 0100 0000 0c00 0000 0100 0000 ................
0100 0100 0901 0100 0000 0000 ............
omniORB: (0) 2020-11-06 12:50:38.444419: omniORB: (0) 2020-11-06 12:50:38.444414: JET052
omniORB: (0) 2020-11-06 12:50:38.444914: inputMessage: from giop:tcp:10.0.0.247:2809 80 bytes
omniORB: (0) 2020-11-06 12:50:38.444958:
4749 4f50 0102 0101 4400 0000 0400 0000 GIOP....D.......
0100 0000 0000 0000 3400 0000 4944 4c3a ........4...IDL:
6f6d 672e 6f72 672f 436f 734e 616d 696e omg.org/CosNamin
672f 4e61 6d69 6e67 436f 6e74 6578 742f g/NamingContext/
496e 7661 6c69 644e 616d 653a 312e 3000 InvalidName:1.0.
./go.sh: line 46: 28855 Segmentation fault (core dumped) ./eg3_impl
............这就是我正在看到的回声示例
omniORB: (0) 2020-11-06 12:59:50.031354: LocateRequest to remote: key<NameService>
omniORB: (2) 2020-11-06 12:59:50.031466: AsyncInvoker: thread id 2 has started. Total threads = 2.
omniORB: (2) 2020-11-06 12:59:50.031512: AsyncInvoker: thread id 2 assigned to general tasks. Total general threads = 2.
omniORB: (2) 2020-11-06 12:59:50.031552: AsyncInvoker: thread id 2 performing immediate general task.
omniORB: (2) 2020-11-06 12:59:50.031575: Scavenger task execute.
omniORB: (1) 2020-11-06 12:59:50.081241: SocketCollection idle. Sleeping.
omniORB: (0) 2020-11-06 12:59:51.031650: Client attempt to connect to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:59:51.031799: Client opened connection to giop:tcp:10.0.0.247:2809
omniORB: (0) 2020-11-06 12:59:51.031812: sendChunky: to giop:tcp:10.0.0.247:2809 35 bytes
omniORB: (0) 2020-11-06 12:59:51.031822:
4749 4f50 0102 0103 1700 0000 0200 0000 GIOP............
0000 206c 0b00 0000 4e61 6d65 5365 7276 .. l....NameServ
6963 65 ice
omniORB: (0) 2020-11-06 12:59:51.031607: omniORB: (0) 2020-11-06 12:59:50.031417: omniORB: (0) 2020-11-06 12:59:51.032369: inputMessage: from giop:tcp:10.0.0.247:2809 20 bytes
omniORB: (0) 2020-11-06 12:59:51.032405:
4749 4f50 0102 0104 0800 0000 0200 0000 GIOP............
0100 0000 ....
omniORB: (0) 2020-11-06 12:59:51.032463: Send codeset service context: (ISO-8859-1,UTF-16)
omniORB: (0) 2020-11-06 12:59:51.032505: sendChunky: to giop:tcp:10.0.0.247:2809 119 bytes
omniORB: (0) 2020-11-06 12:59:51.032512:
4749 4f50 0102 0100 6b00 0000 0400 0000 GIOP....k.......
0300 0000 0000 0000 0b00 0000 4e61 6d65 ............Name
5365 7276 6963 656f 1100 0000 6269 6e64 Serviceo....bind
5f6e 6577 5f63 6f6e 7465 7874 0072 6561 _new_context.rea
0100 0000 0100 0000 0c00 0000 0100 0000 ................
0100 0100 0901 0100 0100 0000 0500 0000 ................
7465 7374 006e 6563 0b00 0000 6d79 5f63 test.nec....my_c
6f6e 7465 7874 00 ontext.
omniORB: (0) 2020-11-06 12:59:51.032501: omniORB: (0) 2020-11-06 12:59:51.032496: JET052
omniORB: (0) 2020-11-06 12:59:51.033479: inputMessage: from giop:tcp:10.0.0.247:2809 81 bytes
omniORB: (0) 2020-11-06 12:59:51.033528:
4749 4f50 0102 0101 4500 0000 0400 0000 GIOP....E.......
0100 0000 0000 0000 3500 0000 4944 4c3a ........5...IDL:
6f6d 672e 6f72 672f 436f 734e 616d 696e omg.org/CosNamin
672f 4e61 6d69 6e67 436f 6e74 6578 742f g/NamingContext/
416c 7265 6164 7942 6f75 6e64 3a31 2e30 AlreadyBound:1.0
00 .
分析这两个运行,我注意到在断开的代码中,“ bind_new_context”消息中缺少“ test”和“ my_context”的字符串...(这就是命名服务以“无效名称”响应的原因例外)。在破损的代码中,消息较小,并且消息前面的size字段表示较小的大小。
这与在破碎的代码中不带任何参数(或带有NULL参数)的“ bind_new_context”函数一致。但是两个示例都使用相同的源代码。使用相同的rootContext和contextName变量调用相同的bind_new_context函数,并以相同的方式填充。因此,我想我的构建脚本会引入某种环境混乱,而这种混乱在omniORB内部编译的版本中是不存在的。这也可以解释为什么清理代码也已损坏。但是我花了2天的时间试图将其摇晃,但我还是空了。
有什么想法吗?
edit:这是我的构建脚本所基于的树的makefile的输出。有差异,但似乎没有实质意义。
[jasont@dodeca3 echo]$ make veryclean ; make VERBOSE=1
rm -f eg1 eg2_impl eg2_clt eg3_impl eg3_clt \
eg3_tieimpl
rm -f *.o *.a
rm -f *.d
rm -f *.pyc
rm -f ../../../stub/echo.idl ../../../stub/echo.hh ../../../stub/echoSK.cc ../../../stub/echoDynSK.cc ../../../stub/echoSK.o ../../../stub/echoDynSK.o ../../../stub/echoSK.d ../../../stub/echoDynSK.d ../../../stub/dir.mk
dir=../../../stub; if [ ! -d $dir ]; then (umask 022; set -x; ../../../../bin/scripts/omkdirhier $dir); fi
rm -f ../../../stub/echo.idl
../../../bin/omniidl -bcxx -Wba -Wbtp -C../../../stub ../../../../idl/echo.idl
../../../bin/omkdepend -D__cplusplus -D__GNUG__ -D__GNUC__ -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ ../../../../src/examples/echo/eg3_clt.cc ../../../../src/examples/echo/eg3_impl.cc ../../../../src/examples/echo/eg2_clt.cc ../../../../src/examples/echo/eg2_impl.cc ../../../../src/examples/echo/eg1.cc
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg1.o ../../../../src/examples/echo/eg1.cc
cd ../../../stub
make[1]: Entering directory `/home/jasont/FACE_translator/omniORB-4.2.3/build2/stub'
../bin/omkdepend -D__cplusplus -D__GNUG__ -D__GNUC__ -D__OMNIORB4__ -I../stub -D_REENTRANT -I. -I. -I../include -I/home/jasont/FACE_translator/omniORB-4.2.3/include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ echoDynSK.cc echoSK.cc
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../stub -D_REENTRANT -I. -I. -I../include -I/home/jasont/FACE_translator/omniORB-4.2.3/include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o echoSK.o echoSK.cc
make[1]: Leaving directory `/home/jasont/FACE_translator/omniORB-4.2.3/build2/stub'
+ rm -f eg1
+ g++ -o eg1 -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg1.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg2_impl.o ../../../../src/examples/echo/eg2_impl.cc
+ rm -f eg2_impl
+ g++ -o eg2_impl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg2_impl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg2_clt.o ../../../../src/examples/echo/eg2_clt.cc
+ rm -f eg2_clt
+ g++ -o eg2_clt -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg2_clt.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg3_impl.o ../../../../src/examples/echo/eg3_impl.cc
+ rm -f eg3_impl
+ g++ -o eg3_impl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_impl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg3_clt.o ../../../../src/examples/echo/eg3_clt.cc
+ rm -f eg3_clt
+ g++ -o eg3_clt -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_clt.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
g++ -c -O2 -Wall -Wno-unused -fexceptions -D__OMNIORB4__ -I../../../stub -D_REENTRANT -I. -I../../../../src/examples/echo -I../../../include -I../../../../include -D__OsveRSION__=2 -D__linux__ -D__x86_64__ -o eg3_tieimpl.o ../../../../src/examples/echo/eg3_tieimpl.cc
+ rm -f eg3_tieimpl
+ g++ -o eg3_tieimpl -O2 -Wall -Wno-unused -fexceptions -L../../../lib -L../../../../lib eg3_tieimpl.o ../../../stub/echoSK.o -lomniORB4 -lomnithread -lpthread
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)