Discussion:
relocation truncated to fit: R_X86_64_PC32 against undefined symbol `len'
Richard
2014-04-05 16:51:56 UTC
Permalink
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. However, a thorough search revealed no uses of just 'len',
yet I don't deny I could possibly have overlooked it. 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'
/usr/bin/ld: ctjc.o: bad reloc address 0x0 in section `.pdata'
/usr/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status

Any assistance greatly appreciated.

Richard
Marco Atzeri
2014-04-05 16:52:59 UTC
Permalink
Post by Richard
Hello Everyone,
Any assistance greatly appreciated.
Richard
Hello Richard,
please start from here
Post by Richard
Problem reports: http://cygwin.com/problems.html
Specially the "Run cygcheck -s -v -r > cygcheck.out and include that
file as an attachment in your report."

so at least we can check that nothing is wrong on your system.

About your build problem, is it source available than we can try ?

Regards
Marco
Richard
2014-04-05 17:18:31 UTC
Permalink
(don't know why a reply to your message had no text content - you must
have sent it as an attachment!)

Marco,

I have the source available, but it's proprietary, so I can't share it,
no. However, I can dig through to look for things - and make changes if
absolutely necessary.

Richard
Richard
2014-04-05 18:53:34 UTC
Permalink
Post by Ken Brown
binutils 2.24.51-1 OK
There were some problems with this release of binutils. You might try
updating to 2.24.51-2.
Ken
Great suggestion but unfortunately it didn't cure the problem. -frown-

Richard
Ken Brown
2014-04-05 19:14:47 UTC
Permalink
Post by Richard
Post by Ken Brown
binutils 2.24.51-1 OK
There were some problems with this release of binutils. You might try
updating to 2.24.51-2.
Ken
Great suggestion but unfortunately it didn't cure the problem. -frown-
Too bad. In that case I think you should check again for `len' in
ctjc.c or in some file that it includes. The only other thing I can
Post by Richard
$ gcc -o ctjc.exe ctjc.o hashc.o sha1.o;
Is there a missing library?

Ken
Richard
2014-04-05 17:15:29 UTC
Permalink
cygcheck.out attached, as requested.
Post by Richard
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.
However, a thorough search revealed no uses of just 'len', yet I don't deny I
could possibly have overlooked it. 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.
$ 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'
/usr/bin/ld: ctjc.o: bad reloc address 0x0 in section `.pdata'
/usr/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Any assistance greatly appreciated.
Richard
Richard Troy, Founder & current President
The Karmann Ghia Club of North America
4200 Park Blvd, #151, Oakland CA 94602, USA

***@KarmannGhia.org, http://KarmannGhia.org/Richard/
Ken Brown
2014-04-05 17:48:59 UTC
Permalink
binutils 2.24.51-1 OK
There were some problems with this release of binutils. You might try
updating to 2.24.51-2.

Ken
Csaba Raduly
2014-04-07 07:37:47 UTC
Permalink
Hi Richard,
Post by Richard
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?
Post by Richard
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'
Post by Richard
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.
$ 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

Csaba
--
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
Corinna Vinschen
2014-04-07 08:45:10 UTC
Permalink
Post by Richard
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. However, a
thorough search revealed no uses of just 'len', yet I don't deny I
could possibly have overlooked it. 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.
$ gcc -o ctjc.exe ctjc.o hashc.o sha1.o;
ctjc.o:ctjc.c:(.text+0x2287): undefined reference to `len'
R_X86_64_PC32 against undefined symbol `len'
/usr/bin/ld: ctjc.o: bad reloc address 0x0 in section `.pdata'
/usr/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Any assistance greatly appreciated.
As I outlined in other mail to this list just a couple of days ago,
the "relocation truncated to fit" stuff is a red herring. It's just
a side-effect of the way addressing and relocation on x86_64 works.

The important part of the message is the first one: undefined reference
to `len'. That's what you have to look for.


Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
Loading...