Error building mkbuiltins on ia64-hp-hpux11.23

2011-04-20 Thread Daniel Richard G.
Building bash 4.2 on an HP-UX/Itanium system:

gmake[1]: Entering directory `/tmp/bash-4.2.build/builtins'
rm -f mkbuiltins.o
cc -c  -DHAVE_CONFIG_H -DSHELL  -I. -I..  -I/tg/freeport/src/bash/bash--4.2 
-I/tg/freeport/src/bash/bash--4.2/include -I/tg/freeport/src/bash/bash--4.2/lib 
-I/tg/freeport/src/bash/bash--4.2/builtins  -DHPUX  -D_HPUX_API_LEVEL=20040821 
-D_HPUX_SOURCE  -g  /tg/freeport/src/bash/bash--4.2/builtins/mkbuiltins.c
cc  +DD64 +DO11.00 +DSblended +Olit=all -mt +w -z +p -Wl,+k +O1 +Onofltacc 
+Onolimit +Onosize  -g  -o mkbuiltins mkbuiltins.o -ldl 
ld: Can't find library or mismatched ABI for -ldl
Fatal error.
gmake[1]: *** [mkbuiltins] Error 1
gmake[1]: Leaving directory `/tmp/bash-4.2.build/builtins'
gmake: *** [builtins/builtext.h] Error 1

The attached patch (against the 4.2 source) fixes the problem for me.


--Daniel


-- 
NAME = Daniel Richard G. _\|/_Remember, skunks
MAIL = sk...@iskunk.org (/o|o\) _- don't smell bad---
MAIL+= sk...@alum.mit.edu   < (^),> it's the people who
WWW  = (not there yet!)  /   \  annoy us that do!
diff -ru bash-4.2/builtins/Makefile.in bash--4.2/builtins/Makefile.in
--- bash-4.2/builtins/Makefile.in	2010-12-21 08:37:18.0 -0500
+++ bash--4.2/builtins/Makefile.in	2011-04-20 10:51:16.0 -0400
@@ -56,7 +56,7 @@
 
 PROFILE_FLAGS = @PROFILE_FLAGS@
 CFLAGS = @CFLAGS@
-CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ @CROSS_COMPILE@ $(CFLAGS)
 CPPFLAGS = @CPPFLAGS@
 CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
 LOCAL_CFLAGS = @LOCAL_CFLAGS@ ${DEBUG}


Re: Error building mkbuiltins on ia64-hp-hpux11.23

2011-04-21 Thread Daniel Richard G.
On Thu, 2011 Apr 21 16:36-0400, Chet Ramey wrote:
>
> What is the part of CFLAGS that fixes this, and why not just add it to
> CFLAGS_FOR_BUILD?  CFLAGS_FOR_BUILD is for the `build tools' part of
> the builtins library.

I believe the "+DD64" bit is salient. (Generate 64-bit instead of
32-bit code.)

The problem here is that the makefile is compiling without CFLAGS
(a.k.a. with CFLAGS_FOR_BUILD), and then linking with CFLAGS. Whether
it's CFLAGS or CFLAGS_FOR_BUILD isn't the issue; it's that the makefile
is using one and then the other on the same object.

That said, I'm not sure why CFLAGS and CFLAGS_FOR_BUILD should be
different, given that this is a "simple" build where build = host =
target.


--Daniel


-- 
NAME = Daniel Richard G. _\|/_Remember, skunks
MAIL = sk...@iskunk.org (/o|o\) _- don't smell bad---
MAIL+= sk...@alum.mit.edu   < (^),> it's the people who
WWW  = (not there yet!)  /   \  annoy us that do!



Re: Error building mkbuiltins on ia64-hp-hpux11.23

2011-04-22 Thread Daniel Richard G.
On Fri, 2011 Apr 22 10:08-0400, Chet Ramey wrote:
>
> That's not what actually happens.  CCFLAGS and CCFLAGS_FOR_BUILD share
> a common set of options but differ in their use of CPPFLAGS and
> CFLAGS. The link is done with LDFLAGS_FOR_BUILD.  It's hard to tell
> where the DD64 is coming from, since it doesn't get added by anything
> in the bash configure scripts, but I suspect it gets put into
> LOCAL_DEFS somehow.

+DD64 is from CFLAGS in the environment prior to configuration.

Broadly speaking, linking needs to be done with CFLAGS + LDFLAGS (not
just LDFLAGS) precisely because of flags like this. This is already how
Automake does things; the bug comes down to bash's build system not
following existing convention. It's not reasonable to have to duplicate
CFLAGS in LDFLAGS to avoid the reported link error.


--Daniel


-- 
NAME = Daniel Richard G. _\|/_Remember, skunks
MAIL = sk...@iskunk.org (/o|o\) _- don't smell bad---
MAIL+= sk...@alum.mit.edu   < (^),> it's the people who
WWW  = (not there yet!)  /   \  annoy us that do!