pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

/bin/pwd defaults (Re: devel/gobject-introspection build can't find 'glib/gmacros.h')



On Thu, May 21, 2015 at 02:39:27PM -0400, Chuck Cranor wrote:
> On Wed, May 20, 2015 at 10:38:12PM -0400, Chuck Cranor wrote:
> >   GISCAN   GLib-2.0.gir
> > In file included from <stdin>:4:
> > /private/tmp/ptest/lib/glib-2.0/include/glibconfig.h:9:10: fatal error: 
> >       'glib/gmacros.h' file not found
> > #include <glib/gmacros.h>
> >          ^
> > 1 error generated.
> > Error while processing the source.
> > gnumake[2]: *** [GLib-2.0.gir] Error 1
> 
> 
> 
> I figured out the cause of this error.  The pkgsrc wrapper scripts 
> are getting confused by /tmp being a symbolic link (on MacOSX /tmp 
> points to /private/tmp).



Here's the root of the problem.  It looks like buildlink3 et al. assume 
that the "pwd" command returns the real physical path:

[from buildlink3/bsd.buildlink3.mk ]
# Resolve some important directories to their phyiscal paths as symlinks
# tend to confuse buildlink3.
#
_BLNK_PHYSICAL_PATH_VARS?=      WRKDIR LOCALBASE
.for _var_ in ${_BLNK_PHYSICAL_PATH_VARS}
.  if !defined(_BLNK_PHYSICAL_PATH.${_var_})
_BLNK_PHYSICAL_PATH.${_var_}!=                                          \
        if [ -d ${${_var_}} ]; then                                     \
                cd ${${_var_}}; ${PWD_CMD};                             \
        else                                                            \
                ${ECHO} ${${_var_}};                                    \
        fi
.  endif



But Darwin ${$PWD_CMD} (aka "/bin/pwd") does not resolve symbolic
links by default.   You have to specify "-P" to do that:


# cd /
cwd: /
# ls -ld tmp
lrwxr-xr-x@ 1 root  wheel  11 May  8 22:13 tmp -> private/tmp
# cd tmp
cwd: /tmp
# /bin/pwd
/tmp
# /bin/pwd -P
/private/tmp
# uname -a
Darwin xxxcdc 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
# 


so when building the devel/gobject-introspection code, the buildlink3
stuff does not resolve the symlink (e.g. "fgrep -R /private/tmp work"
returns no matches).  But the devel/gobject-introspection code uses 
a python scanner script that calls out to realpath(3) with the -I cflags
and that does resolve the link.   Then when the python script calls
"clang" wrapper script, it does so with the resolved (from realpath)
-I flags.   That doesn't match the symlink path that buildlink3 used,
so it discards the flag and you get "'glib/gmacros.h' file not found"
errors.


Looking at the pwd(1) man page, it has two flags:
 "-L" - logical path
 "-P" - physical path (symlinks resolved)

Now, if you look at the pwd(1) man page on NetBSD it says:

    The default for the pwd command is -P.

but on Darwin the man page says:

     If no options are specified, the -L option is assumed.

so the default behavior is the opposite between the two platforms.

I wonder if this means TOOLS_PLATFORM.pwd should be set to "pwd -P"
in tools/tools.Darwin.mk ?


chuck


Home | Main Index | Thread Index | Old Index