texinfo-devel
[Top][All Lists]
Advanced

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

Re: Using Perl's cc


From: Gavin Smith
Subject: Re: Using Perl's cc
Date: Sat, 4 Jul 2015 18:32:33 +0100

On 4 July 2015 at 18:09, Eli Zaretskii <address@hidden> wrote:
>> Please try the latest.
>
> Thanks.
>
> Some progress:
>
>   /bin/sh ./libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> -DPACKAGE_STRING=\"texinfo\6.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" 
> -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 
> -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 
> -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
> -DLT_OBJDIR=\".libs/\" -I.    -DPERL_USE_SAFE_PUTENV -DDEBUGGING    
> -DVERSION=\"6.0\"  -DXS_VERSION=\"6.0\" "-I/usr/lib/perl5/5.8/msys/CORE" 
> -gdwarf-4 -g3 -O2 -MT XSParagraph_la-XSParagraph.lo -MD -MP -MF 
> .deps/XSParagraph_la-XSParagraph.Tpo -c -o XSParagraph_la-XSParagraph.lo 
> `test -f 'XSParagraph.c' || echo './'`XSParagraph.c
>   libtool: compile:  gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> "-DPACKAGE_STRING=\"texinfo 6.0\"" -DPACKAGE_BUGREPORT=\"\" 
> -DPACKAGE_URL=\"\" -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 
> -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
> -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
> -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -DPERL_USE_SAFE_PUTENV 
> -DDEBUGGING -DVERSION=\"6.0\" -DXS_VERSION=\"6.0\" 
> -I/usr/lib/perl5/5.8/msys/CORE -gdwarf-4 -g3 -O2 -MT 
> XSParagraph_la-XSParagraph.lo -MD -MP -MF 
> .deps/XSParagraph_la-XSParagraph.Tpo -c XSParagraph.c  -DDLL_EXPORT -DPIC -o 
> .libs/XSParagraph_la-XSParagraph.o
>   In file included from XSParagraph.xs:3:0:
>   D:/usr/MSYS/lib/perl5/5.8/msys/CORE/perl.h:925:27: fatal error: 
> netinet/in.h: No such file or directory
>    #   include <netinet/in.h>
>                              ^
>   compilation terminated.
>   Makefile:448: recipe for target `XSParagraph_la-XSParagraph.lo' failed
>   make[4]: *** [XSParagraph_la-XSParagraph.lo] Error 1
>
> This is the incompatibility between MSYS and MinGW toolchains: the
> latter doesn't have netinet/in.h.  I could try hacking CORE/config.h
> to undefine the corresponding CPP guard, but I think it would be
> better to provide a way for the user to specify, at configure time,
> where to look for the "right" Perl installation and for the header
> files belonging to that installation, in this case the native build of
> Perl.  That is, if you still want to try to pursue this, and see if
> the extension can be successfully built on Windows.

Yes, if it cannot be determined automatically a configure option would
be necessary.

>
> Just to see if that will fly, I tried:
>
>   $ cd tp/Texinfo/Convert/XSParagraph/
>   $ make PERL_INC=/d/usr/Perl/lib/CORE
>
> and got as far as this:
>
>   /bin/sh ./libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> -DPACKAGE_STRING=\"texinfo\6.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" 
> -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 
> -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 
> -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
> -DLT_OBJDIR=\".libs/\" -I.    -DPERL_USE_SAFE_PUTENV -DDEBUGGING    
> -DVERSION=\"6.0\"  -DXS_VERSION=\"6.0\" "-I/d/usr/Perl/lib/CORE" -gdwarf-4 
> -g3 -O2 -MT XSParagraph_la-XSParagraph.lo -MD -MP -MF 
> .deps/XSParagraph_la-XSParagraph.Tpo -c -o XSParagraph_la-XSParagraph.lo 
> `test -f 'XSParagraph.c' || echo './'`XSParagraph.c
>   libtool: compile:  gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> "-DPACKAGE_STRING=\"texinfo 6.0\"" -DPACKAGE_BUGREPORT=\"\" 
> -DPACKAGE_URL=\"\" -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 
> -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
> -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
> -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -DPERL_USE_SAFE_PUTENV 
> -DDEBUGGING -DVERSION=\"6.0\" -DXS_VERSION=\"6.0\" -I/d/usr/Perl/lib/CORE 
> -gdwarf-4 -g3 -O2 -MT XSParagraph_la-XSParagraph.lo -MD -MP -MF 
> .deps/XSParagraph_la-XSParagraph.Tpo -c XSParagraph.c  -DDLL_EXPORT -DPIC -o 
> .libs/XSParagraph_la-XSParagraph.o
>   libtool: compile:  gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> "-DPACKAGE_STRING=\"texinfo 6.0\"" -DPACKAGE_BUGREPORT=\"\" 
> -DPACKAGE_URL=\"\" -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 
> -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
> -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
> -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -DPERL_USE_SAFE_PUTENV 
> -DDEBUGGING -DVERSION=\"6.0\" -DXS_VERSION=\"6.0\" -I/d/usr/Perl/lib/CORE 
> -gdwarf-4 -g3 -O2 -MT XSParagraph_la-XSParagraph.lo -MD -MP -MF 
> .deps/XSParagraph_la-XSParagraph.Tpo -c XSParagraph.c -o 
> XSParagraph_la-XSParagraph.o >/dev/null 2>&1
>   mv -f .deps/XSParagraph_la-XSParagraph.Tpo 
> .deps/XSParagraph_la-XSParagraph.Plo
>   /bin/sh ./libtool  --tag=CC   --mode=compile gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> -DPACKAGE_STRING=\"texinfo\6.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" 
> -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 
> -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 
> -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
> -DLT_OBJDIR=\".libs/\" -I.    -DPERL_USE_SAFE_PUTENV -DDEBUGGING    
> -DVERSION=\"6.0\"  -DXS_VERSION=\"6.0\" "-I/d/usr/Perl/lib/CORE" -gdwarf-4 
> -g3 -O2 -MT mylib/XSParagraph_la-xspara.lo -MD -MP -MF 
> mylib/.deps/XSParagraph_la-xspara.Tpo -c -o mylib/XSParagraph_la-xspara.lo 
> `test -f 'mylib/xspara.c' || echo './'`mylib/xspara.c
>   libtool: compile:  gcc -DPACKAGE_NAME=\"texinfo\" 
> -DPACKAGE_TARNAME=\"texinfo\" -DPACKAGE_VERSION=\"6.0\" 
> "-DPACKAGE_STRING=\"texinfo 6.0\"" -DPACKAGE_BUGREPORT=\"\" 
> -DPACKAGE_URL=\"\" -DPACKAGE=\"texinfo\" -DVERSION=\"6.0\" -DSTDC_HEADERS=1 
> -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
> -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
> -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -DPERL_USE_SAFE_PUTENV 
> -DDEBUGGING -DVERSION=\"6.0\" -DXS_VERSION=\"6.0\" -I/d/usr/Perl/lib/CORE 
> -gdwarf-4 -g3 -O2 -MT mylib/XSParagraph_la-xspara.lo -MD -MP -MF 
> mylib/.deps/XSParagraph_la-xspara.Tpo -c mylib/xspara.c  -DDLL_EXPORT -DPIC 
> -o mylib/.libs/XSParagraph_la-xspara.o
>   mylib/xspara.c:9:22: fatal error: langinfo.h: No such file or directory
>    #include <langinfo.h>
>                         ^
>   compilation terminated.
>   Makefile:455: recipe for target `mylib/XSParagraph_la-xspara.lo' failed
>   make[1]: *** [mylib/XSParagraph_la-xspara.lo] Error 1
>
> MinGW doesn't have langinfo.h.  Where does this come from?  If it (and
> the related code that gets put in xspara.c, which calls setlocale
> trying to set a UTF-8 codeset for the locale) comes from Perl, then
> the Windows port is in trouble, since Windows doesn't support UTF-8 as
> a locale's codeset.

I wrote all of xspara.c myself - it doesn't come from Perl.

Note that the XSParagraph subdirectory is a self-contained
subdirectory with it's own configure script, and there is no Gnulib
integration at the moment. This can change, but it might be useful to
keep it separate in order to make it easy to use a different compiler
to compile the extension from that used for the rest of the project.

It relies on a UTF-8 codeset being in the locale to be able to use the
C standard library functions to operate on UTF-8 data, like mbrtowc.
The UTF-8 data is coming from the Perl instance. (Perl strings have
two possible internal encodings: one is UTF-8, the other is either
Latin-1 or "native". The second's not reliable so I forced the UTF-8
representation.) If we can't do that, then it shouldn't be a big
problem to write or copy from elsewhere code to process UTF-8 data,
because the encoding isn't that complicated.

Another problem would be the use of functions that operate on wide
characters: iswupper, iswspace, and wcwidth. It'd be too much to
replicate these completely. It should be possible to write "good
enough" fall-back functions, where iswspace only recognizes space and
tab and maybe a handful of others with code points < 256, iswupper
only recognizes ASCII upper-case characters, and wcwidth never returns
2, and returns 1 for all characters except a select few.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]