* RE: undefined reference to `__errno_location(void)'
[not found] <616BE6A276E3714788D2AC35C40CD18D7D2511@whale.softwire.co.uk>
@ 2002-09-01 23:38 ` Rupert Wood
2002-09-02 10:06 ` GRE Spam Mail
2002-09-02 10:07 ` GRE Spam Mail
0 siblings, 2 replies; 11+ messages in thread
From: Rupert Wood @ 2002-09-01 23:38 UTC (permalink / raw)
To: 'GRE Spam Mail'; +Cc: gcc-help
Gordon Ellsworth wrote:
> /home/muvie/muvie/src/socket_class.c:211: undefined reference to
> `__errno_location(void)'
:
> And when you link make sure to add -lpthread,
> since the symbol for errno_location is defined
> in the libpthread library on Linux.
:
> I tried this, but it did not get rid of the problem.
Can I confirm that you tried the '-lpthread' in addition to the #include
in the PR comment? If so, can you confirm that you've got a libpthread.a
or libpthread.so in /lib or /usr/lib and that it contains the symbol
__errno_location?
As you said you haven't upgraded, the system *ought* to work as shipped.
But it's possible (albeit unlikely) that your C library was not build
with threading support or that you're missing the ptherad library -
maybe you need to install it as a separate package?
Good luck,
Rup.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-01 23:38 ` undefined reference to `__errno_location(void)' Rupert Wood
@ 2002-09-02 10:06 ` GRE Spam Mail
2002-09-02 10:14 ` undefined reference to `__errno_location(void)'x Der Herr Hofrat
2002-09-02 10:07 ` GRE Spam Mail
1 sibling, 1 reply; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-02 10:06 UTC (permalink / raw)
To: Rupert Wood; +Cc: gcc-help
On Mon, 2 Sep 2002 07:38:48 +0100
"Rupert Wood" <me@rupey.net> wrote:
> Gordon Ellsworth wrote:
>
> > /home/muvie/muvie/src/socket_class.c:211: undefined reference to
> > `__errno_location(void)'
> :
> > And when you link make sure to add -lpthread,
> > since the symbol for errno_location is defined
> > in the libpthread library on Linux.
> :
> > I tried this, but it did not get rid of the problem.
>
> Can I confirm that you tried the '-lpthread' in addition to the #include
> in the PR comment?
Which #include would that be? I think I missed it.
> If so, can you confirm that you've got a libpthread.a
> or libpthread.so in /lib or /usr/lib
Here's what I have:
./usr/lib/libpthread.a
./usr/lib/libpthread_p.a
./lib/libpthread-0.9.so
./usr/lib/libpthread.so
> and that it contains the symbol
> __errno_location?
>
How do I check for the symbol?
I tried this to see if the symbol was there, I don't know if this is the right
way to check:
[root@vaghn (/)] 01:02:53 $ grep "__errno_location" /usr/lib/libpthread.a
Binary file /usr/lib/libpthread.a matches
[root@vaghn (/)] 01:02:56 $ grep "__errno_location" /usr/lib/libpthread.so
Binary file /usr/lib/libpthread.so matches
> As you said you haven't upgraded, the system *ought* to work as shipped.
> But it's possible (albeit unlikely) that your C library was not build
> with threading support or that you're missing the ptherad library -
> maybe you need to install it as a separate package?
I installed every package that comes with Slackware 8.1 (I did a full install
from the Slackware CD) so there should be nothing missing.
>
> Good luck,
> Rup.
Thank you for your help.
Sincerely,
Gordon R. Ellsworth, Jr.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-01 23:38 ` undefined reference to `__errno_location(void)' Rupert Wood
2002-09-02 10:06 ` GRE Spam Mail
@ 2002-09-02 10:07 ` GRE Spam Mail
1 sibling, 0 replies; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-02 10:07 UTC (permalink / raw)
To: Rupert Wood; +Cc: gcc-help
On Mon, 2 Sep 2002 07:38:48 +0100
"Rupert Wood" <me@rupey.net> wrote:
> Gordon Ellsworth wrote:
>
> > /home/muvie/muvie/src/socket_class.c:211: undefined reference to
> > `__errno_location(void)'
> :
> > And when you link make sure to add -lpthread,
> > since the symbol for errno_location is defined
> > in the libpthread library on Linux.
> :
> > I tried this, but it did not get rid of the problem.
>
> Can I confirm that you tried the '-lpthread' in addition to the #include
> in the PR comment?
Which #include would that be? I think I missed it.
> If so, can you confirm that you've got a libpthread.a
> or libpthread.so in /lib or /usr/lib
Here's what I have:
./usr/lib/libpthread.a
./usr/lib/libpthread_p.a
./lib/libpthread-0.9.so
./usr/lib/libpthread.so
> and that it contains the symbol
> __errno_location?
>
How do I check for the symbol?
I tried this to see if the symbol was there, I don't know if this is the right
way to check:
[root@vaghn (/)] 01:02:53 $ grep "__errno_location" /usr/lib/libpthread.a
Binary file /usr/lib/libpthread.a matches
[root@vaghn (/)] 01:02:56 $ grep "__errno_location" /usr/lib/libpthread.so
Binary file /usr/lib/libpthread.so matches
> As you said you haven't upgraded, the system *ought* to work as shipped.
> But it's possible (albeit unlikely) that your C library was not build
> with threading support or that you're missing the ptherad library -
> maybe you need to install it as a separate package?
I installed every package that comes with Slackware 8.1 (I did a full install
from the Slackware CD) so there should be nothing missing.
>
> Good luck,
> Rup.
Thank you for your help.
Sincerely,
Gordon R. Ellsworth, Jr.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'x
2002-09-02 10:06 ` GRE Spam Mail
@ 2002-09-02 10:14 ` Der Herr Hofrat
2002-09-02 10:53 ` GRE Spam Mail
0 siblings, 1 reply; 11+ messages in thread
From: Der Herr Hofrat @ 2002-09-02 10:14 UTC (permalink / raw)
To: GRE Spam Mail; +Cc: Rupert Wood, gcc-help
>
> How do I check for the symbol?
>
> I tried this to see if the symbol was there, I don't know if this is the right
> way to check:
> [root@vaghn (/)] 01:02:53 $ grep "__errno_location" /usr/lib/libpthread.a
> Binary file /usr/lib/libpthread.a matches
> [root@vaghn (/)] 01:02:56 $ grep "__errno_location" /usr/lib/libpthread.so
> Binary file /usr/lib/libpthread.so matches
>
nm /usr/lib/libpthread.a | grep errno should be safe.
hofrat
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'x
2002-09-02 10:14 ` undefined reference to `__errno_location(void)'x Der Herr Hofrat
@ 2002-09-02 10:53 ` GRE Spam Mail
2002-09-03 13:09 ` GRE Spam Mail
0 siblings, 1 reply; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-02 10:53 UTC (permalink / raw)
To: Der Herr Hofrat; +Cc: me, gcc-help
On Mon, 2 Sep 2002 18:18:04 +0200 (CEST)
Der Herr Hofrat <der.herr@mail.hofr.at> wrote:
> >
> > How do I check for the symbol?
> >
> > I tried this to see if the symbol was there, I don't know if this is the right
> > way to check:
> > [root@vaghn (/)] 01:02:53 $ grep "__errno_location" /usr/lib/libpthread.a
> > Binary file /usr/lib/libpthread.a matches
> > [root@vaghn (/)] 01:02:56 $ grep "__errno_location" /usr/lib/libpthread.so
> > Binary file /usr/lib/libpthread.so matches
> >
> nm /usr/lib/libpthread.a | grep errno should be safe.
>
> hofrat
>
OK, I did that for libpthread.a and libpthread.so and this is the output:
root@vaghn (~)] 01:51:32 $ nm /usr/lib/libpthread.a | grep errno
U __errno_location
U __errno_location
U __errno_location
U __errno_location
U _errno
U _h_errno
U __errno_location
U __errno_location
errno.o:
00000000 T __errno_location
00000054 T __h_errno_location
U __errno_location
[root@vaghn (~)] 01:51:49 $ nm /usr/lib/libpthread.so | grep errno
00009c24 T __errno_location
00009ca0 T __h_errno_location
U _errno@@GLIBC_2.0
U _h_errno@@GLIBC_2.0
U errno@@GLIBC_2.0
U h_errno@@GLIBC_2.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'x
2002-09-02 10:53 ` GRE Spam Mail
@ 2002-09-03 13:09 ` GRE Spam Mail
2002-09-04 0:28 ` bjorn rohde jensen
0 siblings, 1 reply; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-03 13:09 UTC (permalink / raw)
To: gcc-help; +Cc: der.herr, me
On Mon, 2 Sep 2002 13:54:02 -0400
GRE Spam Mail <gre_spam@anora.org> wrote:
>
> OK, I did that for libpthread.a and libpthread.so and this is the output:
>
> root@vaghn (~)] 01:51:32 $ nm /usr/lib/libpthread.a | grep errno
> U __errno_location
> U __errno_location
> U __errno_location
> U __errno_location
> U _errno
> U _h_errno
> U __errno_location
> U __errno_location
> errno.o:
> 00000000 T __errno_location
> 00000054 T __h_errno_location
> U __errno_location
>
> [root@vaghn (~)] 01:51:49 $ nm /usr/lib/libpthread.so | grep errno
> 00009c24 T __errno_location
> 00009ca0 T __h_errno_location
> U _errno@@GLIBC_2.0
> U _h_errno@@GLIBC_2.0
> U errno@@GLIBC_2.0
> U h_errno@@GLIBC_2.0
>
Did you guys forget about me?
Sincerely,
GRE
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'x
2002-09-03 13:09 ` GRE Spam Mail
@ 2002-09-04 0:28 ` bjorn rohde jensen
2002-09-04 7:51 ` undefined reference to `__errno_location(void)' GRE Spam Mail
0 siblings, 1 reply; 11+ messages in thread
From: bjorn rohde jensen @ 2002-09-04 0:28 UTC (permalink / raw)
To: GRE Spam Mail; +Cc: gcc-help
Hi Gordon,
Could you post some (small) code demonstrating the problem?
I think, you might be confusing ld's in its handling of weak/strong
symbols during linking. It would be nice with some code to experiment
with:)
Yours sincerely,
Bjorn
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-04 0:28 ` bjorn rohde jensen
@ 2002-09-04 7:51 ` GRE Spam Mail
2002-09-04 9:03 ` Claudio Bley
0 siblings, 1 reply; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-04 7:51 UTC (permalink / raw)
To: bjensen; +Cc: gcc-help
On Wed, 04 Sep 2002 09:27:52 +0200
bjorn rohde jensen <bjensen@fastmail.fm> wrote:
> Hi Gordon,
>
> Could you post some (small) code demonstrating the problem?
> I think, you might be confusing ld's in its handling of weak/strong
> symbols during linking. It would be nice with some code to experiment
> with:)
>
> Yours sincerely,
>
> Bjorn
>
>
Sure enough! Here's the smallest code that I've written that has this problem.
===
#include <cstdio>
#include <cerrno>
#include <cstring>
int main(int argc, char **argv)
{
extern int errno;
FILE *fp;
errno = 0;
if(!(fp=fopen("Somestupidfile.txt","r"))) {
printf("File error: %s\n",strerror(errno));
}
else {
fclose(fp);
}
return 0;
}
===
This is just a stupid little code, but it demonstrates the problem.
If I try to compile it with g++ I get the following errors:
[root@vaghn (~/prog)] 10:42:17 $ g++ -Wall test.c -o test
/tmp/ccka9V3Q.o: In function `main':
/tmp/ccka9V3Q.o(.text+0x8): undefined reference to `__errno_location(void)'
/tmp/ccka9V3Q.o(.text+0x3d): undefined reference to `__errno_location(void)'
collect2: ld returned 1 exit status
Thank you for all your help.
Sincerely,
Gordon R. Ellsworth, Jr.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-04 7:51 ` undefined reference to `__errno_location(void)' GRE Spam Mail
@ 2002-09-04 9:03 ` Claudio Bley
2002-09-04 9:20 ` Rupert Wood
0 siblings, 1 reply; 11+ messages in thread
From: Claudio Bley @ 2002-09-04 9:03 UTC (permalink / raw)
To: GRE Spam Mail; +Cc: bjensen, gcc-help
>>>>> "GRE" == GRE Spam Mail <gre_spam@anora.org> writes:
GRE> On Wed, 04 Sep 2002 09:27:52 +0200 bjorn rohde jensen
GRE> <bjensen@fastmail.fm> wrote:
>> Hi Gordon,
>>
>> Could you post some (small) code demonstrating the problem? I
>> think, you might be confusing ld's in its handling of
>> weak/strong symbols during linking. It would be nice with some
>> code to experiment with:)
>>
>> Yours sincerely,
>>
>> Bjorn
>>
>>
GRE> Sure enough! Here's the smallest code that I've written that
GRE> has this problem.
GRE> extern int errno;
^^^^^^^^^^^^^^^^^
Remove this line from your source. You get the error because errno is
defined as a macro and the line is expanded to
extern int (*__errno_location ());
Claudio
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-04 9:03 ` Claudio Bley
@ 2002-09-04 9:20 ` Rupert Wood
2002-09-04 17:27 ` GRE Spam Mail
0 siblings, 1 reply; 11+ messages in thread
From: Rupert Wood @ 2002-09-04 9:20 UTC (permalink / raw)
To: Claudio Bley; +Cc: GRE Spam Mail, bjensen, gcc-help
Claudio Bley wrote:
> GRE> extern int errno;
> ^^^^^^^^^^^^^^^^^
>
> Remove this line from your source. You get the error because errno is
> defined as a macro and the line is expanded to
>
> extern int (*__errno_location ());
Which, in that scope, is defined as a C++ symbol. Which is why it
didn't match the C __errno_location in libpthread.
The "d'oh" here is that the clue was in the title: it wouldn't have said
"(void)" if it was trying to match a C symbol because it wouldn't have
that information.
Oh well, we learn. (And good spot, Claudio!)
Rup.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: undefined reference to `__errno_location(void)'
2002-09-04 9:20 ` Rupert Wood
@ 2002-09-04 17:27 ` GRE Spam Mail
0 siblings, 0 replies; 11+ messages in thread
From: GRE Spam Mail @ 2002-09-04 17:27 UTC (permalink / raw)
To: Rupert Wood; +Cc: bley, bjensen, gcc-help
On Wed, 4 Sep 2002 12:20:11 -0400 (EDT)
Rupert Wood <rup@kanat.pair.com> wrote:
> Claudio Bley wrote:
>
> > GRE> extern int errno;
> > ^^^^^^^^^^^^^^^^^
> >
> > Remove this line from your source. You get the error because errno is
> > defined as a macro and the line is expanded to
> >
> > extern int (*__errno_location ());
>
> Which, in that scope, is defined as a C++ symbol. Which is why it
> didn't match the C __errno_location in libpthread.
>
> The "d'oh" here is that the clue was in the title: it wouldn't have said
> "(void)" if it was trying to match a C symbol because it wouldn't have
> that information.
>
> Oh well, we learn. (And good spot, Claudio!)
>
> Rup.
>
>
I just wanted to thank you all for your help. The problem seems resolved.
I also want to thank the others that helped me that I didn't reply to in
this message, Such as Der Herr Hofrat.
Sincerely,
Gordon R. Ellsworth, Jr.
P.S. Now I feel stupid. "d'oh!"
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2002-09-05 0:27 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <616BE6A276E3714788D2AC35C40CD18D7D2511@whale.softwire.co.uk>
2002-09-01 23:38 ` undefined reference to `__errno_location(void)' Rupert Wood
2002-09-02 10:06 ` GRE Spam Mail
2002-09-02 10:14 ` undefined reference to `__errno_location(void)'x Der Herr Hofrat
2002-09-02 10:53 ` GRE Spam Mail
2002-09-03 13:09 ` GRE Spam Mail
2002-09-04 0:28 ` bjorn rohde jensen
2002-09-04 7:51 ` undefined reference to `__errno_location(void)' GRE Spam Mail
2002-09-04 9:03 ` Claudio Bley
2002-09-04 9:20 ` Rupert Wood
2002-09-04 17:27 ` GRE Spam Mail
2002-09-02 10:07 ` GRE Spam Mail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).