Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

library/2928:

From: <rob(at)pickering.org>
Date: Mon Sep 23 2002 - 09:32:43 EDT


>Number: 2928
>Category: library
>Synopsis:
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 07 13:14:04 MST 2002
>Closed-Date:
>Last-Modified:
>Originator: Rob Pickering
>Release: -current, was in 3.1 too as far as I recall, maybe even 3.0
>Organization:
>Environment:

        
        System      : OpenBSD 3.2
        Architecture: OpenBSD.i386
        Machine     : i386

>Description:
        

"make build" has been failing for me for some time (since at least OPENBSD_3_1) when I do a clean build with DESTDIR set to get a release tree. I finally got annoyed about this enough to try and work out why.

It fails when linking ld.so in /usr/src/gnu/usr/bin/ld due to a bug in bsd.prog.mk which compiles in {DESTDIR}/usr/lib/crt0.o, to avoid using the system C startup files.

The link of the ld.so binary doesn't want C startup files, and uses -nostartfiles flag at link time. This is fine for a normal link, but bsd.prog.mk overrides this when DESTDIR is set and it gets them anyway, resulting in link errors

>How-To-Repeat:

CVS checkout
setenv DESTDIR /var/tmp/foo
mkdir -p $DESTDIR
make build
>Fix:
        

Patch for bsd.prog.mk below omits ${DESTDIR}/usr/lib/crt0.o etc if original LDFLAGS had -nostartfiles also added -nostartfiles flag to new linker line if doing an ordinary DESTDIR build as I think this is more correct.



RCS file: /cvs/src/share/mk/bsd.prog.mk,v retrieving revision 1.33
diff -C3 -r1.33 bsd.prog.mk
*** bsd.prog.mk 2002/07/25 18:19:06     1.33
--- bsd.prog.mk 2002/09/23 13:01:13

  • 111,120 **** .endif

  .if defined(OBJS) && !empty(OBJS)
  .if defined(DESTDIR)   

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD} ! ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${CRTBEGIN} ${OBJS} ${LDADD} -lgcc - lc -lgcc ${CRTEND}   

Do you need help?X

  .else   

  • 111,128 ---- .endif

  .if defined(OBJS) && !empty(OBJS)

+ 
+ .if  !empty(LDFLAGS:M-nostartfiles)
+ 
+ ${PROG}: ${OBJS} ${LIBC} ${DPADD}
+       ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
+ 
+ .else
+ 

  .if defined(DESTDIR)   

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${CRTBEGIN} ${CRTEND} ${DPADD} ! ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostartfiles -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${CRTBEGIN} ${OBJS} ${ LDADD} -lgcc -lc -lgcc ${CRTEND}   

  .else   


  • 122,127 **** --- 130,136 ---- ${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
  .endif        # defined(DESTDIR)
+ .endif  # !empty(${LDFLAGS:M-nostartfiles})
  .endif        # defined(OBJS) && !empty(OBJS)
  

  .if !defined(MAN)

>Release-Note:
 rob@pickering.org
  Rob Pickering
 No
 /usr/src/gnu/usr.bin/ld compilation failes at ld.so link when $DESTDIR set in make build

    non-critical
 medium
 library
 sw-bug
 -current (was in 3.1 too as far as I recall) Received on Thu Nov 7 17:08:01 2002

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:29:37 EDT

Do you need more help?X

Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library