Subject: pkg/31491: Compilations fail with pkgsrc on solaris 9
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <freebsd@generalresources.com>
List: pkgsrc-bugs
Date: 10/06/2005 10:21:00
>Number:         31491
>Category:       pkg
>Synopsis:       Compilations fail with pkgsrc on solaris 9
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 06 10:21:00 +0000 2005
>Originator:     C. Hall
>Release:        pkgsrc on Solaris 9
>Organization:
>Environment:
SunOS 5.9 Generic_117171-11 sun4u sparc SUNW,UltraAX-i2
>Description:
many compilations fail in particular
  perl5
  patch
  cvs
  nbsed
  rsync

The workaround below allowed me to compile perl and patch
and I will try with the others
>How-To-Repeat:
cd /usr/pkgsrc/lang/perl5
bmake

>Fix:
  Many Solaris headers have lines like:

    #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)

  Programs like perl need the "__STDC__ - 0 == 0" to be true

  lang/gcc34 creates the following directory (and some sub directories)

    /usr/pkg/gcc34/lib/gcc/sparc-sun-solaris2.9/3.4.4/include/

  These files are generated from Solaris headers

  gcc handles the __STDC__ definition in a special way

    if the file is in one of the "System" directories
    then __STDC__ == 0
    else __STDC__ == 1

  pkgsrc has a process called buildlink3 which creates a directory tree
  e.g.
    /tmp/work-pkg/lang/perl5/work/.buildlink/gcc34
  this is populated by symbolic links to the actual files

  The result is that compiling under pkgsrc the gcc compiler picks files from:
    /tmp/work-pkg/lang/perl5/work/.buildlink/gcc34/lib/gcc/sparc-sun-solaris2.9/3.4.4/include/
  instead of the one under /usr/pkg gcc does not consider these symbolic links to be
  system files, therefore __STDC__ == 1

  lang/perl5 compiled successfully by doing:

    rm -rf /tmp/work-pkg/lang/perl5/work/.buildlink/gcc34/lib/gcc/sparc-sun-solaris2.9/3.4.4/include
  prior to starting compiles.

  Possible workarounds:

    1) do not create links this directory tree (best solution?)

    2) create actual files that contain one line:
         #include "/absolute/path/to/file.h"

    3) modify gcc to resolve symbolic links to find actual file name
       then it will match them as system files

    4) The workaround I am trying for the other failed programs is:

cd /usr/pkgsrc/some/prog
bmake configure
rm -rf work/.buildlink/gcc34/lib/gcc/sparc-sun-solaris2.9/3.4.4/include
bmake