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

Re: [MiNT] mintlib Makefile requires bash as shell



Thomas Huth wrote:
m68k-atari-mint-gcc -Wall -O2 -fomit-frame-pointer -O3
-fexpensive-optimizations -nostdinc -I../crypt -I.. -I../include
-I../mintlib -I../stdlib -I$(<../includepath) -DHAVE_CONFIG_H -D_LIBC
-D_REENTRANT -c ../crypt/crypt-entry.c -o crypt-entry.o In file
included from ../crypt/crypt-entry.c:32: ../include/string.h:17:20:
error: stddef.h: No such file or directory

After some investigation, I've found out that the problem is due
to /bin/sh not being the bash on Ubuntu (and Debian), but an
alternative shell called "dash".
When I compile the mintlib with "make SHELL=/bin/bash", everything
works fine.

The problem seems to be the -I$(<../includepath): When I type "echo
$(<../includepath)" in the bash, I get the paths. When I type it in
dash, I get no output at all.

This problem is very annoying because from time to time people try to cross-compile the MiNTLib and it fails like this (mainly on Ubuntu). And the error is totally incomprehensible.

Here is a possible patch for fixing this issue. It is more user friendly, too, because it prints the expanded value of includepath on the screen while compiling. I really like this feature because it makes debugging easier.

Unfortunately this patch makes compilation a bit slower, because before compiling each file make has to run SHELL and cat.

An alternative would be to keep things as is, but with a smart detection of the problem and an explicit message asking the user to compile with "make SHELL=/bin/bash".

Another solution would be to hardcode SHELL=/bin/bash into the makefiles, but I don't know if it would be good when compiling on MiNT (slower ? no bash ?)

Comments welcome.

--
Vincent Rivière
diff -aurN mintlib-CVS-20091017.orig/buildrules mintlib-CVS-20091017/buildrules
--- mintlib-CVS-20091017.orig/buildrules	2009-10-17 10:38:36.718750000 +0200
+++ mintlib-CVS-20091017/buildrules	2009-10-17 12:24:37.812500000 +0200
@@ -28,7 +28,7 @@
 DIRSTEM=$(notdir $(<D))
 
 INCLUDES = -nostdinc -I$(<D) -I$(top_srcdir) -I$(top_srcdir)/include \
--I$(top_srcdir)/mintlib -I$(top_srcdir)/stdlib -I$$(<$(top_srcdir)/includepath) 
+-I$(top_srcdir)/mintlib -I$(top_srcdir)/stdlib -I$(INCLUDEPATH)
 DEFS += -DHAVE_CONFIG_H -D_LIBC -D_REENTRANT
 
 COMPILE = $(filter-out $(NOCFLAGS-$(<F)), $(filter-out $(nocflags),\
diff -aurN mintlib-CVS-20091017.orig/checkrules mintlib-CVS-20091017/checkrules
--- mintlib-CVS-20091017.orig/checkrules	2009-10-17 10:38:36.718750000 +0200
+++ mintlib-CVS-20091017/checkrules	2009-10-17 12:24:51.750000000 +0200
@@ -30,7 +30,7 @@
 TESTLDFLAGS = $(cflags) -s -nostartfiles -nostdlib
 TESTDEFS = -D_GNU_SOURCE -D_REENTRANT
 
-INCLUDES = -nostdinc -I$$(<$(top_srcdir)/includepath) \
+INCLUDES = -nostdinc -I$(INCLUDEPATH) \
 -I$(top_srcdir)/include -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/time
 COMPILE = $(CC) $(TESTCFLAGS) $(CFLAGS-$(<F)) $(DEFS) $(DEFS-$(<F)) $(TESTDEFS)\
 $(INCLUDES)
diff -aurN mintlib-CVS-20091017.orig/configvars mintlib-CVS-20091017/configvars
--- mintlib-CVS-20091017.orig/configvars	2009-10-17 10:38:36.734375000 +0200
+++ mintlib-CVS-20091017/configvars	2009-10-17 12:24:06.203125000 +0200
@@ -235,6 +235,16 @@
 # system.  Usually the default "/bin/bash" is alright.
 KSH=/bin/bash
 
+# This variable contains the compiler's standard include path.
+# It must be evaluated dynamically because the file includepath
+# may not exist when make is run for the first time.
+# The following version is compatible and shows the fully expanded
+# includepath when compiling.
+INCLUDEPATH = $(shell cat $(top_srcdir)/includepath)
+# The following version is faster, but it works only if SHELL is bash
+# and it does not show the contents of includepath while compiling.
+#INCLUDEPATH = $$(<$(top_srcdir)/includepath)
+
 #####################################################################
 # End of time zone stuff.
 #####################################################################