Bug #824

Is this a compiler error?

Added by wa1ter about 7 years ago. Updated almost 6 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

While trying to build pkgsrc/emacs on HEAD with the default gcc41 I'm
getting an error that just doesn't make sense. This is taken from
'dragonfly.h' in the emacs sources:

#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ == 4
# ifndef DFLY_PRE_17_CRT
#define START_FILES pre-crt0.o /usr/lib/gcc34/crt1.o /usr/lib/gcc34/crti.o /usr/lib/gcc34/crtbegin.o
#define LIB_STANDARD -L/usr/lib/gcc34 -lgcc -lc -lgcc /usr/lib/gcc34/crtend.o /usr/lib/gcc34/crtn.o
# else
#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
#define LIB_STANDARD -L/usr/lib/gcc34 -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
# endif
#else
#error "Add compiler version magic"
#endif

The problem is that 'error' is triggered no matter what that first 'if'
checks for. E.g. that first line can be changed to #if 0 and that same
'error' is still triggered.

Either gcc41 is broken or I am. Which is it?

History

#1 Updated by dillon about 7 years ago

:While trying to build pkgsrc/emacs on HEAD with the default gcc41 I'm
:getting an error that just doesn't make sense. This is taken from
:'dragonfly.h' in the emacs sources:
:
:#if defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ == 4
:# ifndef DFLY_PRE_17_CRT
:#define START_FILES pre-crt0.o /usr/lib/gcc34/crt1.o /usr/lib/gcc34/crti.o /usr/lib/gcc34/crtbegin.o
:#define LIB_STANDARD -L/usr/lib/gcc34 -lgcc -lc -lgcc /usr/lib/gcc34/crtend.o /usr/lib/gcc34/crtn.o
:# else
:#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
:#define LIB_STANDARD -L/usr/lib/gcc34 -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
:# endif
:#else
:#error "Add compiler version magic"
:#endif
:
:The problem is that 'error' is triggered no matter what that first 'if'
:checks for. E.g. that first line can be changed to #if 0 and that same
:'error' is still triggered.
:
:Either gcc41 is broken or I am. Which is it?

Nothing wrong with gcc41. If you set the first if to #if 0 then
the error will be triggered because it's in the else clause.

The conditionals simply do not check for gcc 4.1. It is only checking
for gcc 3.4, not finding it, and throwing up its hands.

-Matt
Matthew Dillon
<>

#2 Updated by wa1ter about 7 years ago

On Fri, 5 Oct 2007, Matthew Dillon wrote:

Yes, I completely misunderstood the intentions of the programmer who wrote
that test. I'm asked to supply the missing info, and this is my attempt:

#else
#define START_FILES pre-crt0.o /usr/lib/gcc41/crt1.o /usr/lib/gcc41/crti.o /usr/lib/gcc41/crtbegin.o
#define LIB_STANDARD -L/usr/lib/gcc41 -lgcc -lc -lgcc /usr/lib/gcc41/crtend.o /usr/lib/gcc41/crtn.o
#endif

However, here is yet another twist to my tale. The pkgsrc top-level
Makefile.common for emacs includes this test:

.if ${OPSYS} == "DragonFly" && exists(/usr/lib/crtbegin.o)
CPPFLAGS+= -DDFLY_PRE_17_CRT
.endif

I notice that all of my /usr/lib/crt*.o files were built in January,
while all the other files were built yesterday. This makes me
suspect that those files from January probably should be deleted
because they cause the CPPFLAGS to be wrong for gcc41 (I think).

#3 Updated by dillon about 7 years ago

:.if ${OPSYS} == "DragonFly" && exists(/usr/lib/crtbegin.o)
:CPPFLAGS+= -DDFLY_PRE_17_CRT
:.endif
:
:I notice that all of my /usr/lib/crt*.o files were built in January,
:while all the other files were built yesterday. This makes me
:suspect that those files from January probably should be deleted
:because they cause the CPPFLAGS to be wrong for gcc41 (I think).

I'll fix make upgrade to remove those files. They don't belong in
/usr/lib any more (not for a long time):

crater:/home/dillon> ls -la /usr/lib/crt*
-r--r--r-- 1 root wheel 1431 Mar 23 2006 /usr/lib/crt1.o
-r--r--r-- 1 root wheel 2113 Mar 23 2006 /usr/lib/crtbegin.o
-r--r--r-- 1 root wheel 2300 Mar 23 2006 /usr/lib/crtbeginS.o
-r--r--r-- 1 root wheel 865 Mar 23 2006 /usr/lib/crtend.o
-r--r--r-- 1 root wheel 865 Mar 23 2006 /usr/lib/crtendS.o
-r--r--r-- 1 root wheel 657 Mar 23 2006 /usr/lib/crti.o
-r--r--r-- 1 root wheel 621 Mar 23 2006 /usr/lib/crtn.o
crater:/home/dillon>

test28# ls -la /usr/lib/crt*
ls: No match.
test28#

-Matt
Matthew Dillon
<>

#4 Updated by hasso almost 6 years ago

This should be fixed long time ago in pkgsrc.

Also available in: Atom PDF