This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: relocation truncated to fit: R_X86_64_PC32 against undefined symbol `len'

Hi Richard,

On Sat, Apr 5, 2014 at 6:51 PM, Richard  wrote:
> Hello Everyone,
> I recently (two weeks ago or so) upgraded the cygwin installation on an XP
> 64 bit (corp edition) box and in getting things running on it again I've
> been having various troubles, even though I was VERY careful to watch for
> any installation errors - none were noticed. Normally I don't do development
> on this box but copy over from other systems. I had at least one program
> that was not behaving correctly - it would apparently hide output sent to
> stdout among other mysteries. After fiddling with things I decided to just
> rebuild on that box from sources - it's almost all gnu c. (Note that this
> code needs to run unchanged on many different platforms.)
> At some point I get to the gcc call to bind together three object files into
> an executable - all the object files having just been built with zero errors
> - and I get this particular "undefined reference to `len'" error. Of course
> I went hunting for the use of 'len' - which is a pretty absurd effort as a
> simple grep matches on coutless noise such as 'filename' or 'strlen', etc.

Have you tried the -w option of grep?

> However, a thorough search revealed no uses of just 'len', yet I don't deny
> I could possibly have overlooked it.

Try the following in the directory where the object files are:

nm *.o | grep -P '\.o:|\blen\b'

> Even so, this directory was taken
> wholesale from a 64 bit system (Win 7) with an older cygwin installation
> where the code compiles and runs fine. So somehow I don't think it's
> actually in my code but rather a library reference problem somehow.
> The specific set of error output from make is:
> $ gcc -o ctjc.exe ctjc.o hashc.o sha1.o;
> ctjc.o:ctjc.c:(.text+0x2287): undefined reference to `len'
> ctjc.o:ctjc.c:(.text+0x2287): relocation truncated to fit: R_X86_64_PC32
> against undefined symbol `len'

You may have a mix of 32-bit and 64-bit object files.
What does the following command print?

file *.o

GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]