Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Relocation truncated to R_X86_64_32(Relocation truncated to R_X86_64_32 error arises when i try to link the static and dynamic libraries of MySQL)
Relocation truncated to R_X86_64_32 [message #1735476] Mon, 20 June 2016 05:36 Go to next message
Eclipse UserFriend
Hello,

I am trying to build a connection to MySQL Database through Eclipse using C++.

When i try to link the mysqlcppconn library i get the following exact error

relocation truncated to fit: R_X86_64_32 against symbol `__imp_get_driver_instance' defined in .idata$5 section in C:\Program Files\MySQL\Connector.C++1.1\lib\opt\static/mysqlcppconn.lib(mysqlcppconn.dll.b)

I have tried using the -fPIC Option in the compiler and linker option but with no success

The code is a simple code just to set up the connection

Can anyone help me out to resolve this issue?

I think the problem might be with the way i am linking the libraries maybe
Re: Relocation truncated to R_X86_64_32 [message #1735521 is a reply to message #1735476] Mon, 20 June 2016 10:28 Go to previous messageGo to next message
Eclipse UserFriend
I don't have a solution, but you can resolve it yourself, have a start with http://stackoverflow.com/a/10486230/2796832
Re: Relocation truncated to R_X86_64_32 [message #1735550 is a reply to message #1735521] Tue, 21 June 2016 02:44 Go to previous messageGo to next message
Eclipse UserFriend
I have already checked this link and a load of other links. tried the methods listed there.
But didnt have any success yet
Re: Relocation truncated to R_X86_64_32 [message #1735585 is a reply to message #1735550] Tue, 21 June 2016 06:41 Go to previous messageGo to next message
Eclipse UserFriend
This isn't a CDT problem, However some things to think about.

It means your program is too large for the memory model being used.
The standard model assumes the sum of all statically allocated data + code cannot be greater than 2GB for x86_64.

This often happens if you have a large static array.
You could try using -mcmodel=large
or allocate any such array on the heap.

Sometimes this happens if a symbol is missing in from a library often caused by a mismatch with library definitions (e.g. a Windows .lib for a DLL) or a bad relocation offset in a library.


This thread may help give you some insight into your problem:
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/270714
It's for the Intel Fortran compiler but the problem is language independent.

Again, just something to think about. The issue is OT for this forum.
Good luck!
Re: Relocation truncated to R_X86_64_32 [message #1736162 is a reply to message #1735585] Mon, 27 June 2016 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the help guys!

It was a problem with the image base of the dll files

Adding "-Wl,--image-base -Wl,0x10000000" to the Linker command helped me solve the issue.
Hope this solution can help someone with a similar problem.

Cheers!
Re: Relocation truncated to R_X86_64_32 [message #1753902 is a reply to message #1735476] Sat, 11 February 2017 22:02 Go to previous message
Eclipse UserFriend
Try changing your build mode from debug to release
Previous Topic:Internal Errors using Profilers
Next Topic:Content of <random> not resolved
Goto Forum:
  


Current Time: Sun Jul 20 18:43:51 EDT 2025

Powered by FUDForum. Page generated in 0.04005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top