Discussion:
pkg/48587: libffi does not build on IRIX
d***@shangtai.net
2014-02-10 16:45:00 UTC
Permalink
Number: 48587
Category: pkg
Synopsis: libffi does not build on IRIX
Confidential: no
Severity: serious
Priority: medium
Responsible: pkg-manager
State: open
Class: sw-bug
Submitter-Id: net
Arrival-Date: Mon Feb 10 16:45:00 +0000 2014
Release: pkgsrc-2013Q4
System: IRIX64 halo 6.5 6.5.29m 01090133 IP30
Architecture: mips
Machine: IP30
libffi from pkgsrc-2013Q4 fails to build on IRIX with multiple problems
Try to build libffi on IRIX with MIPSpro 7.4(.4)
First, use bash and gmake to have a shell that the shellscript bodge they have
in the Makefile to run, and gmake to be able to pass a SHELL variable along
(perhaps this would work with bsd make as well? I didn't test)

Add this to the pkgsrc Makefile:
--8<--
.if !empty(OPSYS:MIRIX)
USE_TOOLS+= bash gmake
MAKE_FLAGS+=SHELL=${TOOLS_DIR}/bin/bash
.endif
--8<--

Change patches/patch-aa to the following (the change is for allowing the
config.guess string to be "mipseb"):
--8<--
--- configure.orig Mon Mar 18 00:36:19 2013
+++ configure Sun Feb 9 20:00:41 2014
@@ -651,6 +651,8 @@
XTENSA_TRUE
TILE_FALSE
TILE_TRUE
+VAX_FALSE
+VAX_TRUE
PA64_HPUX_FALSE
PA64_HPUX_TRUE
PA_HPUX_FALSE
@@ -13331,7 +13333,7 @@
TARGET=FRV; TARGETDIR=frv
;;

- hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*)
+ hppa*-*-linux* | hppa*-*-netbsd* | parisc*-*-linux* | hppa*-*-openbsd*)
TARGET=PA_LINUX; TARGETDIR=pa
;;
hppa*64-*-hpux*)
@@ -13425,10 +13427,10 @@
TARGET=METAG; TARGETDIR=metag
;;

- mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
+ mips*-sgi-irix5.* | mips*-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS; TARGETDIR=mips
;;
- mips*-*-linux* | mips*-*-openbsd*)
+ mips*-*-linux* | mips*-*-netbsd* | mips*-*-openbsd*)
# Support 128-bit long double for NewABI.
HAVE_LONG_DOUBLE='defined(__mips64)'
TARGET=MIPS; TARGETDIR=mips
@@ -13449,7 +13451,7 @@
powerpc-*-aix* | rs6000-*-aix*)
TARGET=POWERPC_AIX; TARGETDIR=powerpc
;;
- powerpc-*-freebsd* | powerpc-*-openbsd*)
+ powerpc-*-freebsd* | powerpc-*-netbsd* | powerpc-*-openbsd*)
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
;;
powerpc64-*-freebsd*)
@@ -13463,7 +13465,7 @@
TARGET=S390; TARGETDIR=s390
;;

- sh-*-* | sh[34]*-*-*)
+ sh-*-* | shle-*-* | sh[34]*-*-*)
TARGET=SH; TARGETDIR=sh
;;
sh64-*-* | sh5*-*-*)
@@ -13478,6 +13480,10 @@
TARGET=TILE; TARGETDIR=tile
;;

+ vax-*-*)
+ TARGET=VAX; TARGETDIR=vax
+ ;;
+
xtensa*-*)
TARGET=XTENSA; TARGETDIR=xtensa
;;
@@ -13747,6 +13753,14 @@
TILE_FALSE=
fi

+ if test x$TARGET = xVAX; then
+ VAX_TRUE=
+ VAX_FALSE='#'
+else
+ VAX_TRUE='#'
+ VAX_FALSE=
+fi
+
if test x$TARGET = xXTENSA; then
XTENSA_TRUE=
XTENSA_FALSE='#'
@@ -14661,7 +14675,7 @@
$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h

;;
- *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
+ *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-netbsd* | *-*-openbsd* | *-pc-solaris*)

$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h

@@ -14840,11 +14854,6 @@
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
toolexeclibdir='$(libdir)'
fi
- multi_os_directory=`$CC -print-multi-os-directory`
- case $multi_os_directory in
- .) ;; # Avoid trailing /.
- ../*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
- esac

else
toolexeclibdir='$(libdir)'
@@ -15135,6 +15144,10 @@
as_fn_error $? "conditional \"TILE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${VAX_TRUE}" && test -z "${VAX_FALSE}"; then
+ as_fn_error $? "conditional \"VAX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${XTENSA_TRUE}" && test -z "${XTENSA_FALSE}"; then
as_fn_error $? "conditional \"XTENSA\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15661,6 +15674,8 @@
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ : Avoid regenerating within pkgsrc
+ exit 0
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
@@ -16734,13 +16749,13 @@
/-all-all/d
a\\
@ HOST="\$(HOST)\" \\\\\\
- ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\
- ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\
- ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\
- ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" -eq "0" ; then : \\\\\\
- ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\
+ ; test ".\$\$HOST" = "." && HOST="$x sh $ax_enable_builddir_auxdir/config.guess $x" \\\\\\
+ ; BUILD="$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x" \\\\\\
+ ; use="$x basename "\$\@" -all $x"; n="$x echo \$\$BUILD | wc -w $x" \\\\\\
+ ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test \$\$n = "0" ; then : \\\\\\
+ ; BUILD="$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x" ; fi \\\\\\
; test ".\$\$BUILD" = "." && BUILD="." \\\\\\
- ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\
+ ; test "\$\$use" = "\$\@" && BUILD="$x echo "\$\$BUILD" | tail -1 $x" \\\\\\
; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\
; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done
/dist-all *:/a\\
--8<--

As well as the corresponding patch-configure.ac...

--8<--
--- configure.ac.orig Mon Mar 18 00:36:15 2013
+++ configure.ac Sun Feb 9 19:48:21 2014
@@ -191,6 +191,10 @@
TARGET=M68K; TARGETDIR=m68k
;;

+ m88k-*-*)
+ TARGET=M88K; TARGETDIR=m88k
+ ;;
+
microblaze*-*-*)
TARGET=MICROBLAZE; TARGETDIR=microblaze
;;
@@ -203,7 +207,7 @@
TARGET=METAG; TARGETDIR=metag
;;

- mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
+ mips*-sgi-irix5.* | mips*-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS; TARGETDIR=mips
;;
mips*-*-linux* | mips*-*-openbsd*)
@@ -256,6 +260,10 @@
TARGET=TILE; TARGETDIR=tile
;;

+ vax-*-*)
+ TARGET=VAX; TARGETDIR=vax
+ ;;
+
xtensa*-*)
TARGET=XTENSA; TARGETDIR=xtensa
;;
@@ -281,6 +289,7 @@
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
AM_CONDITIONAL(M32R, test x$TARGET = xM32R)
AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
+AM_CONDITIONAL(M88K, test x$TARGET = xM88K)
AM_CONDITIONAL(MICROBLAZE, test x$TARGET = xMICROBLAZE)
AM_CONDITIONAL(METAG, test x$TARGET = xMETAG)
AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE)
@@ -301,6 +310,7 @@
AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX)
AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX)
AM_CONDITIONAL(TILE, test x$TARGET = xTILE)
+AM_CONDITIONAL(VAX, test x$TARGET = xVAX)
AM_CONDITIONAL(XTENSA, test x$TARGET = xXTENSA)

AC_HEADER_STDC
--8<--

Change patches/patch-ae to test for defined(__sgi) instead of defined(irix).
The latter is _not_ defined on an IRIX system (though possibly with gcc?).

--8<--
--- src/mips/ffitarget.h.orig Sat Mar 16 13:19:39 2013
+++ src/mips/ffitarget.h Mon Feb 10 16:12:23 2014
@@ -32,7 +32,7 @@
#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
#endif

-#ifdef linux
+#if defined(linux)
# include <asm/sgidefs.h>
#elif defined(__rtems__)
/*
@@ -41,8 +41,10 @@
#define _MIPS_SIM_ABI32 1
#define _MIPS_SIM_NABI32 2
#define _MIPS_SIM_ABI64 3
-#elif !defined(__OpenBSD__)
+#elif defined(__sgi)
# include <sgidefs.h>
+#else
+# include <sys/cdefs.h>
#endif

# ifndef _ABIN32
@@ -54,6 +56,12 @@
# ifndef _ABIO32
# define _ABIO32 _MIPS_SIM_ABI32
# endif
+
+#ifdef __NetBSD__
+/* Let's cheat a bit... */
+# define _ABIO32 1
+# define _MIPS_SIM _ABIO32
+#endif

#if !defined(_MIPS_SIM)
# error -- something is very wrong --
--8<--

Add a patch file to include a --tag for the assembly files:

--8<--
--- Makefile.in.orig Sun Feb 9 21:35:26 2014
+++ Makefile.in Sun Feb 9 21:35:39 2014
@@ -240,7 +240,7 @@
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
-LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+LTCPPASCOMPILE = $(LIBTOOL) --tag=AS $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--8<--

These fixes seem to not interfere with building libffi on NetBSD (just tested
on my alpha running 5.1_STABLE)
David A. Holland
2014-02-11 07:25:01 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: "David A. Holland" <***@netbsd.org>
To: gnats-***@gnats.NetBSD.org
Cc:
Subject: PR/48587 CVS commit: pkgsrc/devel/libffi
Date: Tue, 11 Feb 2014 07:21:28 +0000

Module Name: pkgsrc
Committed By: dholland
Date: Tue Feb 11 07:21:28 UTC 2014

Modified Files:
pkgsrc/devel/libffi: Makefile distinfo
pkgsrc/devel/libffi/patches: patch-aa patch-ae patch-configure.ac

Log Message:
Fixes for IRIX from Staffan Thomén in PR 48587.
This is all of it except for one bit pertaining to libtool, which is
going to require some additional flailing.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 pkgsrc/devel/libffi/Makefile
cvs rdiff -u -r1.30 -r1.31 pkgsrc/devel/libffi/distinfo
cvs rdiff -u -r1.18 -r1.19 pkgsrc/devel/libffi/patches/patch-aa
cvs rdiff -u -r1.5 -r1.6 pkgsrc/devel/libffi/patches/patch-ae
cvs rdiff -u -r1.1 -r1.2 pkgsrc/devel/libffi/patches/patch-configure.ac

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
David Holland
2014-02-11 07:30:01 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: David Holland <dholland-***@netbsd.org>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Tue, 11 Feb 2014 07:28:27 +0000
Post by d***@shangtai.net
--8<--
--- Makefile.in.orig Sun Feb 9 21:35:26 2014
+++ Makefile.in Sun Feb 9 21:35:39 2014
@@ -240,7 +240,7 @@
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
-LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+LTCPPASCOMPILE = $(LIBTOOL) --tag=AS $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--8<--
This part conflicts with an existing patch for Makefile.am; and, since
it's changing something that's spewed out by automake, it can't be
fixed in Makefile.am. So I'm not immediately sure what to do about it.

If libtool doesn't recognize what ends up in CCAS in Irix as an
assembler, maybe it needs fixing?

(I've committed the rest.)

--
David A. Holland
***@netbsd.org
Staffan Thomén
2014-02-11 13:55:00 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: Staffan =?iso-8859-1?Q?Thom=E9n?= <***@shangtai.net>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Tue, 11 Feb 2014 15:51:37 +0200
Post by David A. Holland
The following reply was made to PR pkg/48587; it has been noted by GNATS.
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Tue, 11 Feb 2014 07:28:27 +0000
Post by d***@shangtai.net
--8<--
--- Makefile.in.orig Sun Feb 9 21:35:26 2014
+++ Makefile.in Sun Feb 9 21:35:39 2014
@@ -240,7 +240,7 @@
am__mv = mv -f
CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
-LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+LTCPPASCOMPILE = $(LIBTOOL) --tag=AS $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
--8<--
This part conflicts with an existing patch for Makefile.am; and, since
it's changing something that's spewed out by automake, it can't be
fixed in Makefile.am. So I'm not immediately sure what to do about it.
If libtool doesn't recognize what ends up in CCAS in Irix as an
assembler, maybe it needs fixing?
(I've committed the rest.)
First, thanks for still caring about IRIX. :-)

I must say I'm not terribly familiar with the inner workings of libtool
and its ilk. Presumably the correct course of action would be to tell it about
.S (and .s) files... Or should it be handled at the Makefile.in-generation
stage to add the appropriate tag (any tag will do apparently since an invalid
tag defaults to "CC" but no tag bombs)? From what I saw, $CCAS is "cc" on IRIX,
but either "cc" or "as" can be used.

I seem to get the same response (can't infer, need --tag) when I try to run
libtool manually on NetBSD.

% libtool --mode=compile as test.s
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'

How is this handled in other packages that have assembly bits?

Staffan

--
Staffan Thomén - ADB3 455F 10D5 86D1 78D6 048D 11BB D66E 7C7E 2EF8
Aleksej Saushev
2014-02-11 14:15:00 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: Aleksej Saushev <***@inbox.ru>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Tue, 11 Feb 2014 18:12:31 +0400
I seem to get the same response (can't infer, need --tag) when I try to =
run=20
libtool manually on NetBSD.
=20=20
% libtool --mode=3Dcompile as test.s
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
=20=20
How is this handled in other packages that have assembly bits?
Patch Makefile.in to use "--tag=3DCC" there.
Joerg Sonnenberger
2014-02-11 14:15:01 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: Joerg Sonnenberger <***@britannica.bec.de>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Tue, 11 Feb 2014 15:14:35 +0100
Post by Staffan Thomén
I seem to get the same response (can't infer, need --tag) when I try to run
libtool manually on NetBSD.
% libtool --mode=compile as test.s
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
How is this handled in other packages that have assembly bits?
It is strongly recommented to not run as explicitly, but use ${CC}.

Joerg
David Holland
2014-02-12 05:00:01 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: David Holland <dholland-***@netbsd.org>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Wed, 12 Feb 2014 04:54:59 +0000
Post by Joerg Sonnenberger
Post by Staffan Thomén
I seem to get the same response (can't infer, need --tag) when I
try to run libtool manually on NetBSD.
% libtool --mode=compile as test.s
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
How is this handled in other packages that have assembly bits?
It is strongly recommented to not run as explicitly, but use ${CC}.
Is it the package or automake that's inserting "as" (or whatever)
instead of ${CC}?

--
David A. Holland
***@netbsd.org
Staffan Thomén
2014-02-15 01:55:01 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: Staffan =?iso-8859-1?Q?Thom=E9n?= <***@shangtai.net>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Sat, 15 Feb 2014 03:51:44 +0200
Post by David A. Holland
The following reply was made to PR pkg/48587; it has been noted by GNATS.
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Wed, 12 Feb 2014 04:54:59 +0000
Post by Joerg Sonnenberger
Post by Staffan Thomén
I seem to get the same response (can't infer, need --tag) when I
try to run libtool manually on NetBSD.
% libtool --mode=compile as test.s
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
How is this handled in other packages that have assembly bits?
It is strongly recommented to not run as explicitly, but use ${CC}.
Is it the package or automake that's inserting "as" (or whatever)
instead of ${CC}?
Err, somehow this PR seems to have slid sideways into a detail that never
happened. I copypasted that line with libtool --mode=compile as from my console
where I was testing how libtool reacted to .s files with both "cc" and "as".

From what I could see as it flashed past, the CC variable (well, CCAS) was
properly "cc" in the build.

The point was that to .s files, libtool reacts the same on netbsd and irix;
which is to complain that it doesn't know how to handle them without a tag.

Presumably there's a correct way to handle this in pkgsrc. My initial approach
was to patch Makefile.in to include a tag, but this apparently wasn't right.

So how?

--
Staffan Thomén - ADB3 455F 10D5 86D1 78D6 048D 11BB D66E 7C7E 2EF8
David Holland
2014-10-16 06:55:00 UTC
Permalink
The following reply was made to PR pkg/48587; it has been noted by GNATS.

From: David Holland <dholland-***@netbsd.org>
To: gnats-***@NetBSD.org
Cc:
Subject: Re: pkg/48587: libffi does not build on IRIX
Date: Thu, 16 Oct 2014 06:54:26 +0000
Post by Staffan Thomén
Post by David Holland
Is it the package or automake that's inserting "as" (or whatever)
instead of ${CC}?
Err, somehow this PR seems to have slid sideways into a detail
that never happened. I copypasted that line with libtool
--mode=compile as from my console where I was testing how libtool
reacted to .s files with both "cc" and "as".
From what I could see as it flashed past, the CC variable (well, CCAS) was
properly "cc" in the build.
Hrm. I thought that if it was running cc, libtool would figure it out;
but I guess not.
Post by Staffan Thomén
Presumably there's a correct way to handle this in pkgsrc. My
initial approach was to patch Makefile.in to include a tag, but
this apparently wasn't right.
Well, that's fine in general. It just isn't going to work with
this package in this case.

(although... nothing in the package seems to rerun automake after
patching Makefile.am. so I wonder if that logic's really working.)

However, maybe something like the existing workaround for OSF/1 would
serve.

--
David A. Holland
***@netbsd.org

Loading...