Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
On 07/17/2011 05:10 PM, Thomas Dickey wrote:
> fwiw, I routinely build with warnings enabled (and don't have a use for
> -Werror).
>
> For the rest - I'm typically seeing only extra warnings that
> you wouldn't see with -Wall (such as const mismatches, which are
> problematic).
>
> That's for ncurses itself, plus lynx and dialog.
>
> curses.h isn't including <wctype.h>, since none of its declarations need it.
> That's iswgraph and iswspace.
>
> You're seeing implicit for get_wch, since there's no _XOPEN_SOURCE_EXTENDED
> in the compile line. Quoting from man ncurses
Wait, the compile line? I took the documentation you quote for ncurses
below....
> You must also define _XOPEN_SOURCE_EXTENDED when compiling for the
> wide-character library to use the extended (wide-character) func-
> tions.
.... to mean #define _X_OPEN_SOURCE_EXTENDED in the c file before
including headers, as shown in the head of the c file I submitted
with the bug report. That seems to work for me to make these functions
visible - provided I do NOT use --Wall or --Werror. If it's only
possible to define it on the command line, isn't that a bug too?
I'll check and see if I can use --Wall or --Werror with the ncursesw
library if I include _X_OPEN_SOURCE_EXTENDED on the gcc command line
instead of (or in addition to) in the file. But it still can't be
correct behavior for these compile options to have an effect on what
functions are visible/linkable.
Bear
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4E23BE37.80801@sonic.net">http://lists.debian.org/4E23BE37.80801@sonic.net
07-18-2011, 05:35 AM
Ray Dillinger
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 07/17/2011 05:10 PM, Thomas Dickey wrote:
> You're seeing implicit for get_wch, since there's no _XOPEN_SOURCE_EXTENDED
> in the compile line.
using the compile line to specify the option (in this case in addition
to #define _XOPEN_SOURCE_EXTENDED at the beginning of the file) bypasses
the problem.
These two methods of establishing a compile option are supposed to be
equivalent according to gcc's online docs, but here we have a case where
specifying the option on the compile line seems to make the functions
linkable even with -Wall and -Werror, while specifying it by #define at
the start of the file instead exposes a bug where -Wall or -Werror
prevent linking.
This is a clearly superior workaround, since it leaves the functionality
of -Wall and -Werror intact. But this is still a bug;
these things are supposed to be equivalent, and neither is supposed
to be affected by these "unrelated" build options.
Bear
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4E23C612.4090307@sonic.net">http://lists.debian.org/4E23C612.4090307@sonic.net
07-18-2011, 08:08 AM
Thomas Dickey
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
On Sun, 17 Jul 2011, Ray Dillinger wrote:
On 07/17/2011 05:10 PM, Thomas Dickey wrote:
fwiw, I routinely build with warnings enabled (and don't have a use for
-Werror).
For the rest - I'm typically seeing only extra warnings that
you wouldn't see with -Wall (such as const mismatches, which are
problematic).
That's for ncurses itself, plus lynx and dialog.
curses.h isn't including <wctype.h>, since none of its declarations need it.
That's iswgraph and iswspace.
You're seeing implicit for get_wch, since there's no _XOPEN_SOURCE_EXTENDED
in the compile line. Quoting from man ncurses
Wait, the compile line? I took the documentation you quote for ncurses
below....
The standard implies that, and some implementations (I've been burned by
gcc with cygwin as well as more than one vendor Unix) put their predefined
stuff _outside_ any #includes). Best practice puts that on the compile
line.
I'll check and see if I can use --Wall or --Werror with the ncursesw
library if I include _X_OPEN_SOURCE_EXTENDED on the gcc command line
instead of (or in addition to) in the file. But it still can't be
correct behavior for these compile options to have an effect on what
functions are visible/linkable.
yes - but in the report all I saw was the implied declaration aspect,
which is enough for -Werror to whine and die. That's not really the
same as linkable.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110718040419.X1277@mail101.his.com">http://lists.debian.org/20110718040419.X1277@mail101.his.com
07-18-2011, 08:57 AM
Matthias Klose
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
On 07/18/2011 07:35 AM, Ray Dillinger wrote:
> On 07/17/2011 05:10 PM, Thomas Dickey wrote:
>
>> You're seeing implicit for get_wch, since there's no _XOPEN_SOURCE_EXTENDED
>> in the compile line.
>
> Okay, after checking:
>
> bear@janus:~/src/xxh$ make display.o
> gcc -D_XOPEN_SOURCE_EXTENDED -Wall -Werror -lncursesw -c -o display.o
> display.c
> bear@janus:~/src/xxh$
should't the ncursesw headers be used? pkg-config --cflags ncursesw
plus, your example will fail when using -Wl,--as-needed. move the library behind
the objects.
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4E23F591.9030908@debian.org">http://lists.debian.org/4E23F591.9030908@debian.org
07-18-2011, 09:01 AM
Thomas Dickey
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
On Mon, 18 Jul 2011, Matthias Klose wrote:
On 07/18/2011 07:35 AM, Ray Dillinger wrote:
On 07/17/2011 05:10 PM, Thomas Dickey wrote:
You're seeing implicit for get_wch, since there's no _XOPEN_SOURCE_EXTENDED
in the compile line.
should't the ncursesw headers be used? pkg-config --cflags ncursesw
also --libs
actually, ncurses5-config is the flavor that's more likely to work.
I use that. pkg-config isn't available on more than a minority of
the platforms that I build on (and probably never will be). I see
some differences in the output, now that my attention is drawn there.
plus, your example will fail when using -Wl,--as-needed. move the library behind
the objects.
...
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20110718045817.Y1277@mail101.his.com">http://lists.debian.org/20110718045817.Y1277@mail101.his.com
07-18-2011, 02:39 PM
Ray Dillinger
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>> bear@janus:~/src/xxh$ make display.o
>> gcc -D_XOPEN_SOURCE_EXTENDED -Wall -Werror -lncursesw -c -o display.o
>> display.c
>> bear@janus:~/src/xxh$
>
> should't the ncursesw headers be used?
Sorry, don't understand your message. The ncursesw header is invoked
by the -lncursesw compile line option above, *and* by #include
<ncursesw/curses.h> in the file itself; isn't that enough?!
> pkg-config --cflags ncursesw
Can't use pkg-config on this project; it must be compilable on
machines that don't have it installed.
> plus, your example will fail when using -Wl,--as-needed. move the
library behind
> the objects.
Okay... The synopsis of gcc in the man page says the file to be
compiled should come last in the compile line. That's the only thing
I can see here that could be called an "object". The only thing that
could be called a "library" is specified by an -l option. Rearranging
according to the order of things given in the synopsis, I get:
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4E24458B.806@sonic.net">http://lists.debian.org/4E24458B.806@sonic.net
07-18-2011, 04:10 PM
Matthias Klose
Bug#634200: #634200 gcc -Wall -Werror -lncurses fails to link wide-character ncursesw functions.
On 07/18/2011 04:39 PM, Ray Dillinger wrote:
>> plus, your example will fail when using -Wl,--as-needed. move the
> library behind
>> the objects.
>
> Okay... The synopsis of gcc in the man page says the file to be
> compiled should come last in the compile line. That's the only thing
> I can see here that could be called an "object".
No, the manual page says "infile...".
--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4E245AE8.8060205@debian.org">http://lists.debian.org/4E245AE8.8060205@debian.org