|
From: | Lobron, David |
Subject: | Re: Crash occurs when catching std::exception in Objective-C++ code compiled with clang on Linux and using libobjc2 |
Date: | Mon, 4 Dec 2017 17:49:33 +0000 |
Hey All-
The -fgnu-runtime is for using the runtime that comes with the GNU compiler (gcc). I did encounter one other issue: the linker complained that it could not find libobjcxx.so.4.6, needed by libobjc.so, even though those are in the same directory, and there is a "libobjcxx.so" symlink that points to libobjcxx.so.4.6. The directory
is being specified in the -L options, and it's clearly being found, because libobjc.so is found there:
$ ls -l libobj*
lrwxrwxrwx 1 dlobron staff 14 Dec 1 16:08 libobjc.so -> libobjc.so.4.6 -rw-r--r-- 1 dlobron staff 246455 Dec 1 16:08 libobjc.so.4.6 lrwxrwxrwx 1 dlobron staff 16 Dec 1 16:08 libobjcxx.so -> libobjcxx.so.4.6 -rw-r--r-- 1 dlobron staff 19112 Dec 1 16:08 libobjcxx.so.4.6 I worked around this by adding "-l :libobjcxx.so" to my link options, which fixed the problem. However, I'm curious as to why the linker doesn't find libobjcxx.so on its own, without the explicit -l prompt. I've copied the link command and error
below, in case any compiler/linker expert has knowledge of this.
Thanks again for all the help here.
--David
Linker error that occurs when linking my program:
/home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++ -rdynamic -m64 -rdynamic -pthread -fexceptions -fobjc-runtime=gnustep-1.8 -fblocks -o obj/mapmaker \
./obj/mapmaker.obj/FirstPointDomainAdditions.m.o ./obj/mapmaker.obj/PropertyInstanceAdditions.m.o ./obj/mapmaker.obj/DsaRebaser.mm.o ./obj/mapmaker.obj/DynamicConfig.mm.o ./obj/mapmaker.obj/GeoTreeParser.mm.o ./obj/mapmaker.obj/FallBackTreeRebaser.mm.o ./obj/mapmaker.obj/IpWatchRebaser.mm.o ./obj/mapmaker.obj/LivenessModificationRebaser.mm.o ./obj/mapmaker.obj/LoadBalancer_config.mm.o ./obj/mapmaker.obj/LoadBalancer.mm.o ./obj/mapmaker.obj/LocalityTreeRebaser.mm.o ./obj/mapmaker.obj/MapMaker.mm.o ./obj/mapmaker.obj/MapMakerMainFunc.mm.o ./obj/mapmaker.obj/MappingDecision.mm.o ./obj/mapmaker.obj/NameserverAssociationMessage.mm.o ./obj/mapmaker.obj/NameserverAssociationRebaser.mm.o ./obj/mapmaker.obj/NSDemandsRebaser.mm.o ./obj/mapmaker.obj/PingScoresRebaser.mm.o ./obj/mapmaker.obj/PingState.mm.o ./obj/mapmaker.obj/RegionSelector.mm.o ./obj/mapmaker.obj/ResourceAdditions.mm.o ./obj/mapmaker.obj/ResourceInstanceAdditions.mm.o ./obj/mapmaker.obj/RunningAverage.mm.o ./obj/mapmaker.obj/ScoreList.mm.o ./obj/mapmaker.obj/SelectCenters.mm.o ./obj/mapmaker.obj/Statistics.mm.o ./obj/mapmaker.obj/StatisticsXMLWriter.mm.o ./obj/mapmaker.obj/TimeOfDayRebaser.mm.o ./GeoMap/obj/subproject.o ./Resources/obj/subproject.o ./Utils/obj/subproject.o \ -L../common/lib -L/home/dlobron/GNUstep/Library/Libraries -L/home/dlobron/build/clangport/akamai/common/GNUstep/Local/Library/Libraries -L/home/dlobron/build/clangport/akamai/common/GNUstep/System/Library/Libraries -lFirstPointKit -lAkamaiKit -lXMLKit -lgtmcidrdbv6 -lloadbalancer -lmapmessagestracecollector -lmapdispatch -lcci -lmapmessagesdatacenterstate -lmapmessagesmapmakerheavymappingsummary -lmapmessagesnameserverassociation -lmapmessagesrdp -lswanslib -lmaputils -lmapuuid -lmapfilelog -lradtreev6 -lakamai -lasci -laks -lakautil -lakastack -lopenssl -lz -lunwind -lbfd -liberty -lresolv -lpthread -lgnustep-base -lpthread -lobjc -fobjc-nonfragile-abi -lm /usr/bin/ld.bfd.real: ./obj/mapmaker.obj/DsaRebaser.mm.o: undefined reference to symbol '_ZTVN7gnustep7libobjc22__objc_class_type_infoE' /home/dlobron/build/clangport/akamai/common/lib/libobjcxx.so.4.6: error adding symbols: DSO missing from command line clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) The symbol is in libobjcxx.so:
$ nm -C ../common/lib/libobjcxx.so|grep -i objc_class_type_i|grep typeinfo
0000000000202d20 D typeinfo for gnustep::libobjc::__objc_class_type_info 0000000000001d40 R typeinfo name for gnustep::libobjc::__objc_class_type_info Linking works when "-l :libobjcxx.so" is added:
$ cat link.sh
#!/bin/bash /home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++ -rdynamic -m64 -rdynamic -pthread -fexceptions -fobjc-runtime=gnustep-1.8 -fblocks -o obj/mapmaker \ ./obj/mapmaker.obj/FirstPointDomainAdditions.m.o ./obj/mapmaker.obj/PropertyInstanceAdditions.m.o ./obj/mapmaker.obj/DsaRebaser.mm.o ./obj/mapmaker.obj/DynamicConfig.mm.o ./obj/mapmaker.obj/GeoTreeParser.mm.o ./obj/mapmaker.obj/FallBackTreeRebaser.mm.o ./obj/mapmaker.obj/IpWatchRebaser.mm.o ./obj/mapmaker.obj/LivenessModificationRebaser.mm.o ./obj/mapmaker.obj/LoadBalancer_config.mm.o ./obj/mapmaker.obj/LoadBalancer.mm.o ./obj/mapmaker.obj/LocalityTreeRebaser.mm.o ./obj/mapmaker.obj/MapMaker.mm.o ./obj/mapmaker.obj/MapMakerMainFunc.mm.o ./obj/mapmaker.obj/MappingDecision.mm.o ./obj/mapmaker.obj/NameserverAssociationMessage.mm.o ./obj/mapmaker.obj/NameserverAssociationRebaser.mm.o ./obj/mapmaker.obj/NSDemandsRebaser.mm.o ./obj/mapmaker.obj/PingScoresRebaser.mm.o ./obj/mapmaker.obj/PingState.mm.o ./obj/mapmaker.obj/RegionSelector.mm.o ./obj/mapmaker.obj/ResourceAdditions.mm.o ./obj/mapmaker.obj/ResourceInstanceAdditions.mm.o ./obj/mapmaker.obj/RunningAverage.mm.o ./obj/mapmaker.obj/ScoreList.mm.o ./obj/mapmaker.obj/SelectCenters.mm.o ./obj/mapmaker.obj/Statistics.mm.o ./obj/mapmaker.obj/StatisticsXMLWriter.mm.o ./obj/mapmaker.obj/TimeOfDayRebaser.mm.o ./GeoMap/obj/subproject.o ./Resources/obj/subproject.o ./Utils/obj/subproject.o \ -l :libobjcxx.so \ -L../common/lib -L/home/dlobron/GNUstep/Library/Libraries -L/home/dlobron/build/clangport/akamai/common/GNUstep/Local/Library/Libraries -L/home/dlobron/build/clangport/akamai/common/GNUstep/System/Library/Libraries -lFirstPointKit -lAkamaiKit -lXMLKit -lgtmcidrdbv6 -lloadbalancer -lmapmessagestracecollector -lmapdispatch -lcci -lmapmessagesdatacenterstate -lmapmessagesmapmakerheavymappingsummary -lmapmessagesnameserverassociation -lmapmessagesrdp -lswanslib -lmaputils -lmapuuid -lmapfilelog -lradtreev6 -lakamai -lasci -laks -lakautil -lakastack -lopenssl -lz -lunwind -lbfd -liberty -lresolv -lpthread -lgnustep-base -lpthread -lobjc -fobjc-nonfragile-abi -lm $ ./link.sh
$ |
[Prev in Thread] | Current Thread | [Next in Thread] |