如何解决“relocation truncated to fit:R_X86_64_PC32 against undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'” [英] How to resolve "relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xercesc_3_1::AbstractDOMParser::adoptDocument()'"

查看:7453
本文介绍了如何解决“relocation truncated to fit:R_X86_64_PC32 against undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Eclipse中构建一个使用库xerces-c-3.1.1-x86_64-linux-gcc-3.4(二进制)的C ++程序。我看到以下错误...







  1. 重新定位截断以适应:R_X86_64_PC32 undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'


  2. 未定义引用`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'

    / li>






通过stackoverflow上的链接(这个GCC错误...重定位截断以适合... / a>),并了解什么类型的错误是这个,但没有得到解决方案如何解决它。



环境我使用:Cygwin64在Windows8.1和Eclipse配置为使用Cygwin C ++编译器。试了xerces-c-3.1.1-x86_64-linux-gcc-3.4以及xerces-c-3.1.1-x86-linux-gcc-3.4,并得到相同的错误。
我错过了什么?

解决方案

部分解决我的问题。
早些时候我只是提供了include文件,不知道是否提供库文件(在我的case libxerces-c.a)或不。以上错误现在已经消失,但现在显示新错误,如下所示。



- 错误输出 -


$ b b


构建目标:MyXmlProject.exe
调用:Cygwin C ++链接器
g ++ -LC:\cppLib\xerces- c-3.1 .1-x86_64-linux-gcc-3.4 \lib-oMyXmlProject.exe./xmldom/XmlDomDocument.o ./xmldom/main.o -lxerces-c
collect2:错误: ld以信号11 [分段错误]终止,内核转储
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64 -pc-cygwin / bin / ld:BFD(GNU Binutils)2.25断言失败/cygdrive/i/szsz/tmpp/cygwin64/binutils/binutils-2.25-1.x86_64/src/binutils-gdb/bfd/cofflink.c: 264
makefile:48:目标'MyXmlProject.exe'失败的食谱
make:*** [MyXmlProject.exe]错误1






在网络上搜索了很多,包括stackoverflow,cyberciti.biz,dreamincode.net,linuxquestions.org,linux.about.com和experts-exchange.com说,要么你必须更新你的gcc / g ++或者您使用的库版本错误(在其他环境下编译,如linux,并试图在Windows上使用)。尽可能的,我想避免更新/重新安装gcc / g ++,我以前安装通过Cygwin64和因为我害怕这样做(很多其他工作,我要做的Cygwin),我也不确定将解决问题。这也引发另一个问题 - 如果今天我已经下载了一个项目的编译库(这里是xerces-c)和tommorow如果我必须使用另一个库开发一些程序,我必须更新gcc吗?我不明白为什么要更新gcc。



现在来验证库的正确编译版本的第二个选项 - 我已从 http://archive.apache.org/dist/xerces/c/3/binaries/ a。 xerces-c-3.1.1-x86_64-linux-gcc-3.4和b。 xerces-c-3.1.1-x86-linux-gcc-3.4都导致相同的错误-ld终止与信号11 [分割故障],核心转储
有人可以告诉我,如果我使用正确的版本库或应该我使用其他版本适合我的环境(这里的eclipse,cygwin64在windows8.1)?在同一页面上有其他版本,但我不确定使用哪一个?



最后一个选项是编译库(源代码,在我的情况下,并跳过./configure,就像您通常对下载的项目所做的那样)。如果我必须获取xerces-c的源文件,再次有这么多版本(请检查 http://archive.apache.org/dist/xerces/c/3/sources/ )我有麻烦,需要采取和做./configure,然后包括那些作为库和包含文件。



有人可以告诉我从哪里和正确的版本(我考虑约3.1.1)xerces-c应该运行没有错误? - ld以信号11 [分段错误]终止,内核转储。
感谢您耐心等待长时间问题。


I am trying build a C++ program in Eclipse that uses a library xerces-c-3.1.1-x86_64-linux-gcc-3.4 (binary). I see below errors ...


  1. relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xercesc_3_1::AbstractDOMParser::adoptDocument()'

  2. undefined reference to `xercesc_3_1::AbstractDOMParser::adoptDocument()'


Gone thru a link on stackoverflow (What does this GCC error "... relocation truncated to fit..." mean?) and understood what type of error is this but did not get a solution on how to resolve it.

Environment I am using: Cygwin64 on Windows8.1 and Eclipse configured to use Cygwin C++ compiler. Tried both xerces-c-3.1.1-x86_64-linux-gcc-3.4 as well as xerces-c-3.1.1-x86-linux-gcc-3.4 and got the same error. Am I missing something?

解决方案

Solved my problem partly. Earlier I just provided the include files and didn't know whether to provide library file(in my case libxerces-c.a) or not. The above errors have gone now, but it is now showing new error as shown below.

--Error output--


Building target: MyXmlProject.exe Invoking: Cygwin C++ Linker g++ -L"C:\cppLib\xerces-c-3.1.1-x86_64-linux-gcc-3.4\lib" -o "MyXmlProject.exe" ./xmldom/XmlDomDocument.o ./xmldom/main.o -lxerces-c collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: BFD (GNU Binutils) 2.25 assertion fail /cygdrive/i/szsz/tmpp/cygwin64/binutils/binutils-2.25-1.x86_64/src/binutils-gdb/bfd/cofflink.c:264 makefile:48: recipe for target 'MyXmlProject.exe' failed make: *** [MyXmlProject.exe] Error 1


Searched a lot on net including stackoverflow, cyberciti.biz, dreamincode.net, linuxquestions.org, linux.about.com and experts-exchange.com that says that either you have to update your gcc/g++ or you are using the wrong version of library(compiled on other environment such as linux and trying to use on Windows). As far as possible I want to avoid updating/re-installing gcc/g++, that I had previously installed thru Cygwin64 and because I m afraid of doing that(lot other work I have to do with Cygwin) and also I m not sure that will solve the problem. This also pounces another question-if today I had downloaded a compiled library of one project(here xerces-c) and tommorow if I have to develope some program using another library, will I have to update the gcc again? I havn't understood why to update gcc.

Now coming to second option of verifying correct compiled version of library- I had downloaded from http://archive.apache.org/dist/xerces/c/3/binaries/ a. xerces-c-3.1.1-x86_64-linux-gcc-3.4 and b. xerces-c-3.1.1-x86-linux-gcc-3.4 both result in same error-ld terminated with signal 11 [Segmentation fault], core dumped Can someone tell me if I am using correct version of library or should I have used other version suitable for my environment(here eclipse, cygwin64 on windows8.1)? There are other versions on same page but I m not sure of using which one?

Last option is to compile the library(source code, in my case I had taken binaries and skipped ./configure as you would normally do for downloaded project). If I have to take the source file of xerces-c, again there are so many versions(check http://archive.apache.org/dist/xerces/c/3/sources/) I am in trouble which to take and do ./configure and then include those as library and include files.

Can someone please tell me from where and correct version(I m taking about 3.1.1) of xerces-c should be taken that will run without errors?-ld terminated with signal 11 [Segmentation fault], core dumped. Thanks for your patience reading long question.

这篇关于如何解决“relocation truncated to fit:R_X86_64_PC32 against undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆