Re: Build failure with clx/new-clx module on Cygwin (was: Build failure with fastcgi module)

Ken Brown <[email protected]> Sat, 24 Feb 2018 15:46:19 -0500
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
On 3/5/2017 2:40 PM, Bruno Haible wrote:
> Hi Ken,
> 
>> I also tried using angle brackets instead of double quotes around config.h.  But I still got an error:
>>
>> ../../ccmp2c /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/src/clisp/modules/clx/new-clx/clx.f > genclx.c
>> gcc -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/src/clisp/src -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/build/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/src/clisp/src/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/build/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/src/clisp/src/gllib -I. -ggdb -O2 -pipe -Wimplicit-function-declaration -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -O -fno-strict-aliasing -DENABLE_UNICODE -DDYNAMIC_MODULES  -DDLL_EXPORT -DPIC -DWANT_XPM=1 -DWANT_XSHAPE=1 genclx.c -o genclx
>> In file included from /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/build/gllib/stdlib.h:96:0,
>>                   from genclx.c:3:
>> /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/build/gllib/unistd.h:139:3: error: #error "Please include config.h first."
>>    #error "Please include config.h first."
>>     ^
>> In file included from /usr/include/sys/types.h:68:0,
>>                   from /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.x86_64/build/gllib/sys/types.h:28,
>>                   from /usr/include/stdio.h:61,
>>                   from genclx.c:2:
>>
>>
>> Am I doing something wrong?  There's no "config.h not found" error, so I'm puzzled by the error message.
> 
> It's a constraint imposed by gnulib that config.h needs to be the first
> include file to be included in a compilation unit.
> 
> But more fundamentally, the use of gnulib is fundamentally broken regarding
> clisp modules:
>    - The clx module should not even see build/gllib/unistd.h.
>    - The syscalls module should not rely on the getloadavg module from the
>      clisp core. This is most evidently seen by a link error on AIX.
> So, you cannot do anythere here until this fundamental mistake is fixed.
> clisp's modules are designed as separately compilable units; therefore they
> must use *independent* autoconf configurations; therefore their uses of
> gnulib must be independent as well.

For the record, I found a simple workaround (attached) that allows me to 
build clx/new-clx on Cygwin.

Ken

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
cygwin_clx_workaround.patch (text/plain, 875 B)
diff -r 87cf29627c28 modules/clx/new-clx/Makefile.in
--- a/modules/clx/new-clx/Makefile.in	Mon Feb 19 19:46:09 2018 -0500
+++ b/modules/clx/new-clx/Makefile.in	Sat Feb 24 15:37:45 2018 -0500
@@ -35,16 +35,18 @@
 
 clx.d: $(srcdir)/clx.f
 	$(CCMP2C) $(srcdir)/clx.f > genclx.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(WANTS) genclx.c -o genclx
+	sed -i '1s/^/#include <config.h>\n/' genclx.c
+	$(CC) $(CPPFLAGS) -I../.. $(CFLAGS) $(WANTS) genclx.c -o genclx
 	./genclx -l -o clx.d > clx.d
 	$(RM) genclx.c
 	$(RM) genclx
 
 clx.c: clx.d
 	$(CLISP) -C $(CLISP_LINKKIT)/modprep clx.d clx.c
+	sed -i '1s/^/#include <config.h>\n/' clx.c
 
 clx.o: clx.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(X_CFLAGS) -I$(CLISP_LINKKIT) -c clx.c
+	$(CC) $(CPPFLAGS) -I../.. $(CFLAGS) $(X_CFLAGS) -I$(CLISP_LINKKIT) -c clx.c
 
 clx-preload.lisp : $(srcdir)/clx-preload.lisp
 	$(LN_S) $(srcdir)/clx-preload.lisp .