Re: Build failure with fastcgi module

Ken Brown <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <[email protected]>
On 3/3/2017 6:48 PM, Ken Brown wrote:
> On 3/3/2017 3:11 PM, Ken Brown wrote:
>> On 2/22/2017 7:44 PM, Bruno Haible wrote:
>>> Re https://sourceforge.net/p/clisp/mailman/message/35677912/
>>>
>>> Hi Jerry,
>>>
>>>> The clisp package is currently failing to build in Fedora Rawhide,
>>>> due to this build failure in the fastcgi module:
>>>
>>> Thanks. Should be fixed now.
>>>
>>> Please continue reporting if something else breaks / broke too.
>>
>> A similar problem occurs in the clx/new-clx module, but this time it's 
>> the generated file genclx.c that fails to include config.h early enough. 
>>   Should ccmp2c.c be changed so that generated files always include 
>> config.h first?
> 
> I tried this, as follows:
> 
> --- a/utils/ccmp2c.c    2017-03-03 11:11:58.000000000 -0500
> +++ b/utils/ccmp2c.c    2017-03-03 17:20:57.229793700 -0500
> @@ -1037,6 +1037,7 @@ main (int argc, char *argv[])
>    infilename = argv[1];
>  
>    /* Emit prologue. */
> +  printf ("#include \"config.h\"\n");
>    printf ("#include <stdio.h>\n");
>    printf ("#include <stdlib.h>\n");
>    printf ("#include <string.h>\n");
> --- a/modules/clx/new-clx/Makefile.in   2017-03-03 11:11:57.000000000 -0500
> +++ b/modules/clx/new-clx/Makefile.in   2017-03-03 18:17:51.478051000 -0500
> @@ -35,7 +35,7 @@ resource.fas: $(srcdir)/resource.lisp cl
>  
>  clx.d: $(srcdir)/clx.f
>         $(CCMP2C) $(srcdir)/clx.f > genclx.c
> -       $(CC) $(CPPFLAGS) $(CFLAGS) $(WANTS) genclx.c -o genclx
> +       $(CC) $(CPPFLAGS) -I. $(CFLAGS) $(WANTS) genclx.c -o genclx
>         ./genclx -l -o clx.d > clx.d
>         $(RM) genclx.c
>         $(RM) genclx
> 
> 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:

The problem is that clisp.h isn't included.  The following patch fixes the problem with the compilation of genclx.c.  I don't know if it causes problems elsewhere.

--- a/modules/clx/new-clx/Makefile.in   2017-03-03 11:11:57.000000000 -0500
+++ b/modules/clx/new-clx/Makefile.in   2017-03-04 17:02:50.218383300 -0500
@@ -35,7 +35,7 @@ resource.fas: $(srcdir)/resource.lisp cl
 
 clx.d: $(srcdir)/clx.f
        $(CCMP2C) $(srcdir)/clx.f > genclx.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) $(WANTS) genclx.c -o genclx
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(WANTS) -I$(CLISP_LINKKIT) genclx.c -o genclx
        ./genclx -l -o clx.d > clx.d
        $(RM) genclx.c
        $(RM) genclx
--- a/utils/ccmp2c.c    2017-03-03 11:11:58.000000000 -0500
+++ b/utils/ccmp2c.c    2017-03-04 17:01:23.397830600 -0500
@@ -1037,6 +1037,8 @@ main (int argc, char *argv[])
   infilename = argv[1];
 
   /* Emit prologue. */
+  printf ("#include \"clisp.h\"\n");
+  printf ("#include \"config.h\"\n");
   printf ("#include <stdio.h>\n");
   printf ("#include <stdlib.h>\n");
   printf ("#include <string.h>\n");


This allows genclx to be built, but then the resulting clx.c fails to compile on my platform (Cygwin):

gcc -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/src/clisp/src -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/build/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/src/clisp/src/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/build/gllib -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/src/clisp/src/gllib -ggdb -O2 -pipe -Wimplicit-function-declaration -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -fno-strict-aliasing -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES  -DDLL_EXPORT -DPIC  -I/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/build/linkkit -c clx.c
In file included from /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/build/gllib/stdlib.h:96:0,
                 from /usr/include/w32api/combaseapi.h:129,
                 from /usr/include/w32api/objbase.h:14,
                 from /usr/include/w32api/ole2.h:17,
                 from /usr/include/w32api/wtypes.h:12,
                 from /usr/include/w32api/winscard.h:10,
                 from /usr/include/w32api/windows.h:97,
                 from /usr/include/X11/Xwindows.h:75,
                 from /home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/src/clisp/modules/clx/new-clx/clx.f:413:
/home/kbrown/src/cygclisp/clisp-2.49-1.20170303hg15769.i686/build/gllib/unistd.h:139:3: error: #error "Please include config.h first."
  #error "Please include config.h first."

This problem is Cygwin-specific and happens because the system header <X11/Xwindows.h> is included before clisp.h in clx.c.  Including clisp.h first doesn't work, because then we get the typedef conflicts mentioned in the comment in clx.f:412.

Does anyone see a way around this?  If not, I'd like to try removing all uses of '#include <windows.h>' from the Cygwin build.  Cygwin is a Posix platform, and trying to mix the Posix API with the Windows API often causes problems.

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.