zsh-workers
 help / color / mirror / code / Atom feed
* #include problem for generated files included in system.h
@ 2011-05-09 10:44 Peter Stephenson
  2011-05-09 14:25 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2011-05-09 10:44 UTC (permalink / raw)
  To: Zsh Hackers' List

Next problem found by compiling somewhere I haven't done for a while.

My Solaris 8 (ancient but still working) set-up uses separate source and
build trees.  This is falling over when system.h tries to include
zshterm.h and zshcurses.h: system.h is included in the build tree from
the source tree (<somer-relative-path-added-to-zsh.mdd>/system.h) which
causes it not to find zshterm.h and zshcurses.h in the build tree itself.

I could copy or link (but we have systems where either hard links or
soft links don't work) system.h into the build tree if it's different,
but that's not very nice.

I think the fix is probably to move the stuff from system.h into a
separate header and #include that after system.h.  However, maybe
someone can see a simpler fix.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #include problem for generated files included in system.h
  2011-05-09 10:44 #include problem for generated files included in system.h Peter Stephenson
@ 2011-05-09 14:25 ` Bart Schaefer
  2011-05-10 16:36   ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Schaefer @ 2011-05-09 14:25 UTC (permalink / raw)
  To: Zsh Hackers' List

On May 9, 11:44am, Peter Stephenson wrote:
} 
} My Solaris 8 (ancient but still working) set-up uses separate source and
} build trees.  This is falling over when system.h tries to include
} zshterm.h and zshcurses.h: system.h is included in the build tree from
} the source tree (<somer-relative-path-added-to-zsh.mdd>/system.h) which
} causes it not to find zshterm.h and zshcurses.h in the build tree itself.

Thanks for running into this before I did. ;-)  I've used separate source
and build trees for years on my primary zsh test system, because I build
the shell both static and dynamic link from the same source tree.

} I think the fix is probably to move the stuff from system.h into a
} separate header and #include that after system.h.  However, maybe
} someone can see a simpler fix.

Rather than generate <some-relative-path-added-to-zsh.mdd>/system.h
why not add -Isome-relative-path-added-to-zsh.mdd to CLFAGS?  Is the
path being generated at a poor place relative to building Makefiles?

While we're at it the name "system.h" has always seemed a bit generic
to me, and therefore likely to clash with something.

-- 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #include problem for generated files included in system.h
  2011-05-09 14:25 ` Bart Schaefer
@ 2011-05-10 16:36   ` Peter Stephenson
  2011-05-10 16:45     ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2011-05-10 16:36 UTC (permalink / raw)
  To: Zsh Hackers' List

On Mon, 9 May 2011 07:25:16 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Rather than generate <some-relative-path-added-to-zsh.mdd>/system.h
> why not add -Isome-relative-path-added-to-zsh.mdd to CLFAGS?  Is the
> path being generated at a poor place relative to building Makefiles?

The problem is that if you don't tell it explicitly where each file is,
then you need to give it a whole load of possibilities of where a header
might be relative to the current directory.
- It might be in the current directory.
- It might be generated in the build version of the Src directory.
- It might be in the original Src directory.
- It might be in the original Src/Zle directory (needed to get comp.h
  in zutil).
- It might be in the source directory corresponding to the current build
  directory.

The following seemed to do the trick.  The ordering of the -I arguments
may not be entirely logical but was the first thing that worked
everywhere I tried it.

> While we're at it the name "system.h" has always seemed a bit generic
> to me, and therefore likely to clash with something.

I'll see if I can do that separately.

Index: Src/Makemod.in.in
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Makemod.in.in,v
retrieving revision 1.8
diff -p -u -r1.8 Makemod.in.in
--- Src/Makemod.in.in	9 Jan 2011 16:57:02 -0000	1.8
+++ Src/Makemod.in.in	10 May 2011 16:28:21 -0000
@@ -47,8 +47,8 @@ dir_src       = $(dir_top)/Src
 
 DNCFLAGS =
 
-COMPILE     = $(CC) -c -I. $(CPPFLAGS) $(DEFS) $(CFLAGS) $(D@L@CFLAGS)
-DLCOMPILE   = $(CC) -c -I. $(CPPFLAGS) $(DEFS) -DMODULE $(CFLAGS) $(DLCFLAGS)
+COMPILE     = $(CC) -c -I. -I$(dir_top)/Src -I$(sdir_top)/Src -I$(sdir_top)/Src/Zle -I$(sdir) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(D@L@CFLAGS)
+DLCOMPILE   = $(CC) -c -I. -I$(dir_top)/Src -I$(sdir_top)/Src -I$(sdir_top)/Src/Zle -I$(sdir) $(CPPFLAGS) $(DEFS) -DMODULE $(CFLAGS) $(DLCFLAGS)
 LINK        = $(CC) $(LDFLAGS) $(EXELDFLAGS) $(EXTRA_LDFLAGS) -o $@
 DLLINK      = $(DLLD) $(LDFLAGS) $(LIBLDFLAGS) $(DLLDFLAGS) -o $@
 
Index: Src/mkmakemod.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkmakemod.sh,v
retrieving revision 1.17
diff -p -u -r1.17 mkmakemod.sh
--- Src/mkmakemod.sh	30 Jan 2008 10:03:49 -0000	1.17
+++ Src/mkmakemod.sh	10 May 2011 16:28:22 -0000
@@ -383,11 +383,7 @@ if $first_stage; then
 	if test -n "$headers"; then
 	    echo "	    echo '/* Extra headers for this module */'; \\"
 	    echo "	    for hdr in $headers; do \\"
-	    echo "		if test -f \$\$hdr; then \\"
-	    echo "		    echo '# include \"'\$\$hdr'\"'; \\"
-	    echo "		else \\"
-	    echo "		    echo '# include \"\$(sdir)/'\$\$hdr'\"'; \\"
-	    echo "		fi; \\"
+	    echo "		echo '# include \"'\$\$hdr'\"'; \\"
 	    echo "	    done; \\"
 	    echo "	    echo; \\"
 	fi
Index: Src/zsh.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.mdd,v
retrieving revision 1.24
diff -p -u -r1.24 zsh.mdd
--- Src/zsh.mdd	9 May 2011 10:38:02 -0000	1.24
+++ Src/zsh.mdd	10 May 2011 16:28:22 -0000
@@ -127,7 +127,7 @@ clean.zsh:
 
 # This is not properly part of this module, but it is built as if it were.
 main.o: main.c zsh.mdh main.epro
-	$(CC) -c -I. $(CPPFLAGS) $(DEFS) $(CFLAGS) -o $@ $(sdir)/main.c
+	$(CC) -c -I. -I$(sdir_top)/Src $(CPPFLAGS) $(DEFS) $(CFLAGS) -o $@ $(sdir)/main.c
 
 main.syms: $(PROTODEPS)
 proto.zsh: main.epro


-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK




Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #include problem for generated files included in system.h
  2011-05-10 16:36   ` Peter Stephenson
@ 2011-05-10 16:45     ` Peter Stephenson
  2011-05-10 21:04       ` Alexey I. Froloff
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Stephenson @ 2011-05-10 16:45 UTC (permalink / raw)
  To: Zsh Hackers' List

On Tue, 10 May 2011 17:36:29 +0100
Peter Stephenson <Peter.Stephenson@csr.com> wrote:
> > While we're at it the name "system.h" has always seemed a bit
> > generic to me, and therefore likely to clash with something.
> 
> I'll see if I can do that separately.

Seems trivial, so I've renamed it to zsh_system.h.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #include problem for generated files included in system.h
  2011-05-10 16:45     ` Peter Stephenson
@ 2011-05-10 21:04       ` Alexey I. Froloff
  2011-05-11  8:53         ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Alexey I. Froloff @ 2011-05-10 21:04 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 914 bytes --]

On Tue, May 10, 2011 at 05:45:10PM +0100, Peter Stephenson wrote:
> > > While we're at it the name "system.h" has always seemed a bit
> > > generic to me, and therefore likely to clash with something.
> > I'll see if I can do that separately.
> Seems trivial, so I've renamed it to zsh_system.h.
Have you tried to build a fresh cvs/git checkout?  I am getting:

make[2]: Entering directory `/usr/src/RPM/BUILD/zsh-4.3.11/Src'
i586-alt-linux-gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -I/usr/include/pcre -DHAVE_CONFIG_H -pipe -Wall -g -O2 -march=i586 -mtune=i686  -o builtin.o builtin.c
In file included from zsh.mdh:17:0,
                 from builtin.c:33:
zsh_system.h:868:26: fatal error: zshcurses.h: No such file or directory
compilation terminated.
make[2]: *** [builtin.o] Error 1

Attached patch fixes this.

-- 
Regards,    --
Sir Raorn.   --- http://thousandsofhate.blogspot.com/

[-- Attachment #1.2: zsh-generated-headers.patch --]
[-- Type: text/plain, Size: 421 bytes --]

diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index a1c0edc..1dc017b 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -98,6 +98,8 @@ zshpaths.h: Makemod $(CONFIG_INCS)
 	    echo "Updated \`zshpaths.h'." ; \
 	fi
 
+zsh_system.h: zshcurses.h zshterm.h
+
 bltinmods.list: modules.stamp mkbltnmlst.sh $(dir_top)/config.modules
 	srcdir='$(sdir)' CFMOD='$(dir_top)/config.modules' \
 	  $(SHELL) $(sdir)/mkbltnmlst.sh $@

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #include problem for generated files included in system.h
  2011-05-10 21:04       ` Alexey I. Froloff
@ 2011-05-11  8:53         ` Peter Stephenson
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Stephenson @ 2011-05-11  8:53 UTC (permalink / raw)
  To: zsh-workers

On Wed, 11 May 2011 01:04:37 +0400
"Alexey I. Froloff" <raorn@altlinux.org> wrote:
> make[2]: Entering directory `/usr/src/RPM/BUILD/zsh-4.3.11/Src'
> i586-alt-linux-gcc -c -I. -I../Src -I../Src -I../Src/Zle -I.
> -I/usr/include/pcre -DHAVE_CONFIG_H -pipe -Wall -g -O2 -march=i586
> -mtune=i686  -o builtin.o builtin.c In file included from
> zsh.mdh:17:0, from builtin.c:33: zsh_system.h:868:26: fatal error:
> zshcurses.h: No such file or directory compilation terminated.
> make[2]: *** [builtin.o] Error 1
> 
> Attached patch fixes this.

That's because the main shell now depends on zshcurses.h and zshterm.h
which it didn't used to; however, they still shouldn't be included
unconditionally, so aren't in the headers list.

There's actually a special may of indicating extra header dependencies
in the .mdd file...

Index: Src/zsh.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.mdd,v
retrieving revision 1.26
diff -p -u -r1.26 zsh.mdd
--- Src/zsh.mdd	10 May 2011 16:44:39 -0000	1.26
+++ Src/zsh.mdd	11 May 2011 08:51:11 -0000
@@ -16,6 +16,7 @@ signames.o sort.o string.o subst.o text.
 
 headers="../config.h zsh_system.h zsh.h sigcount.h signals.h \
 prototypes.h hashtable.h ztype.h"
+hdrdeps="zshcurses.h zshterm.h"
 
 :<<\Make
 @CONFIG_MK@
@@ -35,9 +36,6 @@ init.o params.o parse.o: version.h
 
 params.o: patchlevel.h
 
-# The main shell doesn't currently need zshcurses.h and zshterm.h,
-# but make sure these are built with the headers.
-# If it did need need them they would be in headers at the top instead.
 version.h: $(sdir_top)/Config/version.mk zshcurses.h zshterm.h
 	echo '#define ZSH_VERSION "'$(VERSION)'"' > $@
 


-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-11  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-09 10:44 #include problem for generated files included in system.h Peter Stephenson
2011-05-09 14:25 ` Bart Schaefer
2011-05-10 16:36   ` Peter Stephenson
2011-05-10 16:45     ` Peter Stephenson
2011-05-10 21:04       ` Alexey I. Froloff
2011-05-11  8:53         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).