bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / code / Atom feed
* "rpl_fprintf" not found if compiled with options "-ggdb -Og"
@ 2021-07-28 20:42 Bjarni Ingi Gislason
  2021-07-28 21:37 ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Bjarni Ingi Gislason @ 2021-07-28 20:42 UTC (permalink / raw)
  To: bug-gnulib

Software: groff
  and
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.


Error:

  CCLD     gxditview
/usr/bin/ld: src/devices/xditview/gxditview-device.o: in function `open_device_file':
/home/bg/git/groff/build/../src/devices/xditview/device.c:535: undefined reference to `rpl_fprintf'
/usr/bin/ld: src/devices/xditview/gxditview-device.o: in function `error':
/home/bg/git/groff/build/../src/devices/xditview/device.c:546: undefined reference to `rpl_fprintf'
/usr/bin/ld: /home/bg/git/groff/build/../src/devices/xditview/device.c:548: undefined reference to `rpl_fprintf'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:6472: gxditview] Error 1


Code in groff:

535       fprintf(stderr, "can't find device file '%s'\n", file_name);

546		fprintf(stderr, "%s:", current_filename);

Defined GNULIB* containing "FPRINTF" in Makefile:

GL_GNULIB_FPRINTF = 1
GL_GNULIB_FPRINTF_POSIX = 1
GL_GNULIB_VFPRINTF = 1
GL_GNULIB_VFPRINTF_POSIX = 0
REPLACE_FPRINTF = 1
REPLACE_VFPRINTF = 0

Code in gnulib/lib/stdio.in.h (groff/gnulib/stdio.in.h):

#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@
# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \
     || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@))
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   define fprintf rpl_fprintf
#  endif
#  define GNULIB_overrides_fprintf 1
#  if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@
_GL_FUNCDECL_RPL (fprintf, int,
                  (FILE *restrict fp, const char *restrict format, ...)
                  _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3)
                  _GL_ARG_NONNULL ((1, 2)));
#  else
_GL_FUNCDECL_RPL (fprintf, int,
                  (FILE *restrict fp, const char *restrict format, ...)
                  _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3)
                  _GL_ARG_NONNULL ((1, 2)));
#  endif
_GL_CXXALIAS_RPL (fprintf, int,
                  (FILE *restrict fp, const char *restrict format, ...));
# else
_GL_CXXALIAS_SYS (fprintf, int,
                  (FILE *restrict fp, const char *restrict format, ...));
# endif


-- 
Bjarni I. Gislason


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

* Re: "rpl_fprintf" not found if compiled with options "-ggdb -Og"
  2021-07-28 20:42 "rpl_fprintf" not found if compiled with options "-ggdb -Og" Bjarni Ingi Gislason
@ 2021-07-28 21:37 ` Paul Eggert
  2021-07-31  1:43   ` Bjarni Ingi Gislason
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2021-07-28 21:37 UTC (permalink / raw)
  To: Bjarni Ingi Gislason; +Cc: bug-gnulib

I'm not seeing this problem when building groff 1.22.4 (the latest 
version) on Ubuntu 21.04, which has GCC Ubuntu 10.3.0-1ubuntu1. I built 
by doing this:

wget https://ftp.gnu.org/pub/gnu/groff/groff-1.22.4.tar.gz
cd groff-1.22.4/
./configure
make

What happens when you try the above steps on your platform?


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

* Re: "rpl_fprintf" not found if compiled with options "-ggdb -Og"
  2021-07-28 21:37 ` Paul Eggert
@ 2021-07-31  1:43   ` Bjarni Ingi Gislason
  2021-07-31  8:31     ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Bjarni Ingi Gislason @ 2021-07-31  1:43 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

On Wed, Jul 28, 2021 at 02:37:00PM -0700, Paul Eggert wrote:
> I'm not seeing this problem when building groff 1.22.4 (the latest version)
> on Ubuntu 21.04, which has GCC Ubuntu 10.3.0-1ubuntu1. I built by doing
> this:
> 
> wget https://ftp.gnu.org/pub/gnu/groff/groff-1.22.4.tar.gz
> cd groff-1.22.4/
> ./configure
> make
> 
> What happens when you try the above steps on your platform?

  The compilation of this version of "groff" and thus the used "gnulib"
version of that, resulted in no error.

  Actually I am using the current repository of both "groff" and
"gnulib".

  I compiled these versions with the option "-O" instead of "-ggdb -Og"
and got the same error.

  Compilation with

gcc-9 (Debian 9.3.0-22) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.

  showed the same error.

-- 
Bjarni I. Gislason


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

* Re: "rpl_fprintf" not found if compiled with options "-ggdb -Og"
  2021-07-31  1:43   ` Bjarni Ingi Gislason
@ 2021-07-31  8:31     ` Paul Eggert
  2021-08-01  1:33       ` Bjarni Ingi Gislason
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2021-07-31  8:31 UTC (permalink / raw)
  To: Bjarni Ingi Gislason; +Cc: bug-gnulib

On 7/30/21 6:43 PM, Bjarni Ingi Gislason wrote:
>    Actually I am using the current repository of both "groff" and
> "gnulib".

I can't reproduce the problem that way, either. I'm using Ubuntu 21.04. 
I clone Savannah's latest groff 
(7ae6d67b7c310c54bb7176c761b1f9719e64201a), run this:

./bootstrap --gnulib-srcdir=$HOME/src/gnu/gnulib-savannah
./configure
make CFLAGS='-ggdb -Og'

and it builds (there are quite a few warnings, which should get fixed, 
but nothing fatal to the build). $HOME/src/gnu/gnulib-savannah contains 
a copy of Savannah's latest Gnulib (commit 
804ac808a9b17d7ee7cf49f7c713c4a4e4d6423f).

The symptoms you're reporting are that of a partial build that isn't 
being resumed correctly somehow.

By the way, I've not had much luck with -Og. I have better luck with -O0 
when debugging. But then, I mostly debug C code, not C++.


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

* Re: "rpl_fprintf" not found if compiled with options "-ggdb -Og"
  2021-07-31  8:31     ` Paul Eggert
@ 2021-08-01  1:33       ` Bjarni Ingi Gislason
  2021-08-01  2:11         ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Bjarni Ingi Gislason @ 2021-08-01  1:33 UTC (permalink / raw)
  To: Paul Eggert; +Cc: bug-gnulib

On Sat, Jul 31, 2021 at 01:31:55AM -0700, Paul Eggert wrote:
> On 7/30/21 6:43 PM, Bjarni Ingi Gislason wrote:
> >    Actually I am using the current repository of both "groff" and
> > "gnulib".
> 
> I can't reproduce the problem that way, either. I'm using Ubuntu 21.04. I
> clone Savannah's latest groff (7ae6d67b7c310c54bb7176c761b1f9719e64201a),
> run this:
> 
> ./bootstrap --gnulib-srcdir=$HOME/src/gnu/gnulib-savannah
> ./configure
> make CFLAGS='-ggdb -Og'
> 
> and it builds (there are quite a few warnings, which should get fixed, but
> nothing fatal to the build). $HOME/src/gnu/gnulib-savannah contains a copy
> of Savannah's latest Gnulib (commit
> 804ac808a9b17d7ee7cf49f7c713c4a4e4d6423f).
> 
> The symptoms you're reporting are that of a partial build that isn't being
> resumed correctly somehow.
> 
> By the way, I've not had much luck with -Og. I have better luck with -O0
> when debugging. But then, I mostly debug C code, not C++.

  Thanks for testing.

  I compile in the directory "groff/build".

  I have two branches, my own and master.

  The error is in my branch.

  It is caused by having simultaneously

CFLAGS='-O...'

  and 

CPPFLAGS=-D_FORTIFY_SOURCE=2

  Changing the value from 2 to 0 or 1, eliminates the error.

  My version of glibc is 2.31-13 (Debian, testing).

  As Debian uses both '-O2' and "-D_FORTIFY_SOURCE=2" for its
compilation,
a fix seems to be necessary.

###

  In the master branch I get, with the default output from "configure",
this

  CC       src/devices/xditview/gxditview-page.o
In file included from /usr/include/X11/Xos.h:89,
                 from ../src/devices/xditview/page.c:7:
./lib/unistd.h:663:3: error: #error "Please include config.h first."
  663 |  #error "Please include config.h first."
      |   ^~~~~
./lib/unistd.h:665:24: error: expected ';' before 'extern'
  665 | _GL_INLINE_HEADER_BEGIN
      |                        ^
      |                        ;
./lib/unistd.h:2815:22: error: expected ';' before 'struct'
 2815 | _GL_INLINE_HEADER_END
      |                      ^
      |                      ;
make[1]: *** [Makefile:7219: src/devices/xditview/gxditview-page.o]
Error 1
make[1]: Leaving directory '/home/bg/git/groff/build'

  In my branch I have added the missing '#include "config.h"' in
../src/devices/xditview/page.c
and other missing "config.h" lines in other source files.

-- 
Bjarni I. Gislason


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

* Re: "rpl_fprintf" not found if compiled with options "-ggdb -Og"
  2021-08-01  1:33       ` Bjarni Ingi Gislason
@ 2021-08-01  2:11         ` Paul Eggert
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggert @ 2021-08-01  2:11 UTC (permalink / raw)
  To: Bjarni Ingi Gislason; +Cc: bug-gnulib

On 7/31/21 6:33 PM, Bjarni Ingi Gislason wrote:
>                   from ../src/devices/xditview/page.c:7:
> ./lib/unistd.h:663:3: error: #error "Please include config.h first."
>    663 |  #error "Please include config.h first."
>        |   ^~~~~

That's a problem. page.c should include config.h first. This is required 
of all Autoconf-using code.

>   In my branch I have added the missing '#include "config.h"' in
> ../src/devices/xditview/page.c
> and other missing "config.h" lines in other source files.

That sounds like the right thing to do, yes.

> CPPFLAGS=-D_FORTIFY_SOURCE=2
> 
>   Changing the value from 2 to 0 or 1, eliminates the error.

I suggest configuring with the same flags that you build with, and if 
the flags seriously alter the API or ABI then putting them into CC. 
Something like this, perhaps.

   ./configure CC='gcc -D_FORTIFY_SOURCE=2'

This sort of thing can be needed if the -D option changes the API or 
ABI. The idea is that you want to configure with the same flags that you 
build with.


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

end of thread, other threads:[~2021-08-01  2:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-28 20:42 "rpl_fprintf" not found if compiled with options "-ggdb -Og" Bjarni Ingi Gislason
2021-07-28 21:37 ` Paul Eggert
2021-07-31  1:43   ` Bjarni Ingi Gislason
2021-07-31  8:31     ` Paul Eggert
2021-08-01  1:33       ` Bjarni Ingi Gislason
2021-08-01  2:11         ` Paul Eggert

Code repositories for project(s) associated with this inbox:

	../../../mirrors/gnulib.git

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).