public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Compiling gnu diction on Cygwin
@ 2022-04-05 13:27 Keith Christian
  2022-04-05 17:35 ` Brian Inglis
  2022-04-06 12:04 ` Csaba Raduly
  0 siblings, 2 replies; 5+ messages in thread
From: Keith Christian @ 2022-04-05 13:27 UTC (permalink / raw)
  To: cygwin

Hi Cygwin fans,

Version info:
Windows 10:10.0.19043 N/A Build 19043
Cygwin: CYGWIN_NT-10.0  3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin

I successfully compiled diction and style from this tar file, but with errors:
https://ftp.gnu.org/gnu/diction/diction-1.11.tar.gz

Diction and style both work, but I am looking for suggestions for how
to clean up the compile errors in lines 48 - 60 below:

     1  ./configure; make; make install
     2  Tue, Apr  5, 2022  7:09:05 AM
     3  checking build system type... x86_64-unknown-cygwin
     4  checking host system type... x86_64-unknown-cygwin
     5  checking for gcc... gcc
     6  checking for C compiler default output file name... a.exe
     7  checking whether the C compiler works... yes
     8  checking whether we are cross compiling... no
     9  checking for suffix of executables... .exe
    10  checking for suffix of object files... o
    11  checking whether we are using the GNU C compiler... yes
    12  checking whether gcc accepts -g... yes
    13  checking for gcc option to accept ISO C89... none needed
    14  checking for a BSD-compatible install... /usr/bin/install -c
    15  checking for strerror... yes
    16  checking for library containing regcomp... none required
    17  checking for broken realloc... no
    18  checking for msgfmt... yes
    19  checking how to run the C preprocessor... gcc -E
    20  checking for grep that handles long lines and -e... /usr/bin/grep
    21  checking for egrep... /usr/bin/grep -E
    22  checking for ANSI C header files... yes
    23  checking for sys/types.h... yes
    24  checking for sys/stat.h... yes
    25  checking for stdlib.h... yes
    26  checking for string.h... yes
    27  checking for memory.h... yes
    28  checking for strings.h... yes
    29  checking for inttypes.h... yes
    30  checking for stdint.h... yes
    31  checking for unistd.h... yes
    32  checking libintl.h usability... yes
    33  checking libintl.h presence... yes
    34  checking for libintl.h... yes
    35  checking for library containing gettext... -lintl
    36  configure: creating ./config.status
    37  config.status: creating Makefile
    38  config.status: creating diction.1
    39  config.status: creating diction.texi
    40  config.status: creating diction.spec
    41  config.status: creating style.1
    42  config.status: creating test/rundiction
    43  config.status: creating config.h
    44  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
diction.c
    45  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
sentence.c
    46  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
misc.c
    47  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
getopt.c
    48  getopt.c:147:1: warning: function declaration isnt a prototype
[-Wstrict-prototypes]
    49    147 | extern char *getenv ();
    50        | ^~~~~~
    51  getopt.c: In function _getopt_internal_r:
    52  getopt.c:444:23: warning: cast discards const qualifier from
pointer target type [-Wcast-qual]
    53    444 |             exchange ((char **) argv, d);
    54        |                       ^
    55  getopt.c:467:23: warning: cast discards const qualifier from
pointer target type [-Wcast-qual]
    56    467 |             exchange ((char **) argv, d);
    57        |                       ^
    58  getopt.c:774:27: warning: cast discards const qualifier from
pointer target type [-Wcast-qual]
    59    774 |           d->__nextchar = (char *) "";
    60        |                           ^
    61  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
getopt1.c
    62  gcc -o diction -g diction.o sentence.o misc.o \
    63          getopt.o getopt1.o -lintl
    64  gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wno-unused
-Wshadow -Wbad-function-cast -Wmissing-prototypes -Wstrict-prototypes
-Wcast-align -Wcast-qual -Wpointer-arith -Wcast-align -Wwrite-strings
-Wmissing-declarations -Wnested-externs -Wundef -pedantic -fno-common
style.c
    65  gcc -o style -g style.o sentence.o misc.o \
    66          getopt.o getopt1.o -lm -lintl
    67  msgfmt -o de.mo de.po
    68  msgfmt -o en_GB.mo en_GB.po
    69  msgfmt -o nl.mo nl.po

Have a great day and thanks!

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

* Re: Compiling gnu diction on Cygwin
  2022-04-05 13:27 Compiling gnu diction on Cygwin Keith Christian
@ 2022-04-05 17:35 ` Brian Inglis
  2022-04-06 12:04 ` Csaba Raduly
  1 sibling, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2022-04-05 17:35 UTC (permalink / raw)
  To: cygwin

On 2022-04-05 07:27, Keith Christian wrote:
> I successfully compiled diction and style from this tar file, but with errors:
> https://ftp.gnu.org/gnu/diction/diction-1.11.tar.gz
> Diction and style both work, but I am looking for suggestions for how
> to clean up the compile errors in lines 48 - 60 below:
...
>      48  getopt.c:147:1: warning: function declaration isnt a prototype
> [-Wstrict-prototypes]
>      49    147 | extern char *getenv ();
>      50        | ^~~~~~
>      51  getopt.c: In function _getopt_internal_r:
>      52  getopt.c:444:23: warning: cast discards const qualifier from
> pointer target type [-Wcast-qual]
>      53    444 |             exchange ((char **) argv, d);
>      54        |                       ^
>      55  getopt.c:467:23: warning: cast discards const qualifier from
> pointer target type [-Wcast-qual]
>      56    467 |             exchange ((char **) argv, d);
>      57        |                       ^
>      58  getopt.c:774:27: warning: cast discards const qualifier from
> pointer target type [-Wcast-qual]
>      59    774 |           d->__nextchar = (char *) "";
>      60        |                           ^

#include <stdlib.h>
remove casts (should not normally be required or used in C)

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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

* Re: Compiling gnu diction on Cygwin
  2022-04-05 13:27 Compiling gnu diction on Cygwin Keith Christian
  2022-04-05 17:35 ` Brian Inglis
@ 2022-04-06 12:04 ` Csaba Raduly
  2022-04-06 14:59   ` Keith Christian
  1 sibling, 1 reply; 5+ messages in thread
From: Csaba Raduly @ 2022-04-06 12:04 UTC (permalink / raw)
  To: Keith Christian; +Cc: cygwin list

On Tue, 5 Apr 2022 at 15:27, Keith Christian  wrote:
>
> Hi Cygwin fans,
>
> Version info:
> Windows 10:10.0.19043 N/A Build 19043
> Cygwin: CYGWIN_NT-10.0  3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin
>
> I successfully compiled diction and style from this tar file, but with errors:
> https://ftp.gnu.org/gnu/diction/diction-1.11.tar.gz
>
> Diction and style both work, but I am looking for suggestions for how
> to clean up the compile errors in lines 48 - 60 below:
>
>      1  ./configure; make; make install
(snip)

Works just fine for me:

$ uname -a
CYGWIN_NT-10.0 AMDAHL 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin

(configure ouptput elided)
(edit makefile to add missing -Wall -Wpedantic -Wextra)
$ make
gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wall -Wpedantic
-Wextra -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes
-Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith
-Wcast-align -Wwrite-strings -Wmissing-declarations -Wnested-externs
-Wundef -pedantic -fno-common ../diction.c
../getopt.h:59:14: warning: ‘optarg’ redeclared without dllimport
attribute: previous dllimport ignored [-Wattributes]
../diction.c:190:31: warning: array subscript has type ‘char’
[-Wchar-subscripts]
  190 |         if (s>sent && isalpha(*(s-1))) continue;
      |                               ^~~~~~
gcc -c -I. -DSHAREDIR=\"/usr/local/share\"
-DLOCALEDIR=\"/usr/local/share/locale\" -g -O2 -pipe -Wall -Wpedantic
-Wextra -Wno-unused -Wshadow -Wbad-function-cast -Wmissing-prototypes
-Wstrict-prototypes -Wcast-align -Wcast-qual -Wpointer-arith
-Wcast-align -Wwrite-strings -Wmissing-declarations -Wnested-externs
-Wundef -pedantic -fno-common ../getopt.c
../getopt.c:147:1: warning: function declaration isn’t a prototype
[-Wstrict-prototypes]
  147 | extern char *getenv ();
      | ^~~~~~
../getopt.c: In function ‘_getopt_internal_r’:
../getopt.c:444:23: warning: cast discards ‘const’ qualifier from
pointer target type [-Wcast-qual]
  444 |             exchange ((char **) argv, d);
      |                       ^
../style.c:1191:18: warning: unknown conversion type character ‘(’ in
format [-Wformat=]
 1191 |         printf(_("        nominalizations %1.f% (%d)\n"),
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../style.c:40:19: note: in definition of macro ‘_’
   40 | #define _(String) String
      |                   ^~~~~~
../style.c:1191:49: note: format string is defined here
 1191 |         printf(_("        nominalizations %1.f% (%d)\n"),
      |                                                 ^
gcc -o style -g style.o sentence.o misc.o \
        getopt.o getopt1.o -lm

Both diction.exe and style.exe are created successfully.

Csaba
-- 
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformant way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

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

* Re: Compiling gnu diction on Cygwin
  2022-04-06 12:04 ` Csaba Raduly
@ 2022-04-06 14:59   ` Keith Christian
  2022-04-06 18:31     ` Brian Inglis
  0 siblings, 1 reply; 5+ messages in thread
From: Keith Christian @ 2022-04-06 14:59 UTC (permalink / raw)
  To: cygwin

Brian, Csaba, I was able to complete the compile with your assistance.

Brian: I'll experiment with your suggestions of:  #include <stdlib.h>
and remove casts (should not normally be required or used in C) as
well.
Csaba:  Adding the -Wall -Wpedantic -Wextra fixed the issue, thanks.

This will help a great deal as I pursue troubleshooting failed C compiles.

THANKS!

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

* Re: Compiling gnu diction on Cygwin
  2022-04-06 14:59   ` Keith Christian
@ 2022-04-06 18:31     ` Brian Inglis
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2022-04-06 18:31 UTC (permalink / raw)
  To: cygwin

On 2022-04-06 08:59, Keith Christian wrote:
> Brian, Csaba, I was able to complete the compile with your assistance.
> Brian: I'll experiment with your suggestions of:  #include <stdlib.h>
> and remove casts (should not normally be required or used in C) as
> well.
> Csaba:  Adding the -Wall -Wpedantic -Wextra fixed the issue, thanks.
> This will help a great deal as I pursue troubleshooting failed C compiles.

The easiest way to build is using cygport - you need to provide only the 
minimum necessary definitions in your .cygport script, and run:

	$ cygport *package*.cygport get prep

to download and patch sources, and run:

	$ cygport *package*.cygport all

to compile, build, stage, and package for Cygwin.

To apply patches, edit sources under pkg-ver-rel.arch/src/...,
diff edited files against files under pkg-ver-rel.arch/origsrc/...
to generate each patch, and add to the PATCH_URI list in each cygport.
This allows you to reuse your patches on later releases, or submit them 
upstream, so you do not need to apply them to later releases.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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

end of thread, other threads:[~2022-04-06 18:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 13:27 Compiling gnu diction on Cygwin Keith Christian
2022-04-05 17:35 ` Brian Inglis
2022-04-06 12:04 ` Csaba Raduly
2022-04-06 14:59   ` Keith Christian
2022-04-06 18:31     ` Brian Inglis

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 read-only IMAP folder(s) and NNTP newsgroup(s).