question on running make check when debugging option is turned on

Marco Bodrato bodrato at mail.dm.unipi.it
Wed Aug 3 19:29:34 CEST 2022


Ciao,

Il 2022-08-01 21:12 American Citizen ha scritto:
> Following the guide, I turned on complete debugging for gmp v6.2.1 and
> ran "configure" and "make" with no errors.
> 
> page 25 states:
> 
>> Maximum Debuggability
>> To summarize the above, a GMP build for maximum debuggability would be
>> ./configure --disable-shared --enable-assert \
>> --enable-alloca=debug --disable-assembly CFLAGS=-g
>> For C++, add ‘--enable-cxx CXXFLAGS=-g’.

We should probably add a few more lines to that paragraph.
In "2.1 Build Options - CC, CFLAGS" we suggest that CFLAGS should not be
simply overridden, but you should check the flags chosen by a plain
-/configure, then adapt it.

> However when I run "make check", then over 250 lines of errors come up
> and the compile fails.

Maybe, in your environment you disabled (by setting CFLAGS) something
essential for a working library?

> Is this a limitation that "make check" cannot have debug turned on?

No, it is not a limitation of "make check".

It's not the cleanest solution, but... if the debugger can work even
with optimizations (-O2 and -fomit-frame-pointer), the easiest way
probably is to set CPPFLAGS=-g instead of setting CFLAGS.

The clean solution is to follow "2.1 Build Options - CC, CFLAGS":
"The ‘CC’ and ‘CFLAGS’ used are printed during ‘./configure’,
and can be found in each generated Makefile".
Take that value of CFLAGS, consider removing any '-O' option,
consider removing the '-fomit-frame-pointer' option,
add '-g', and pass that value as CFLAGS.

Without any -O and with --disable-assembly, you should expect a
much slower library.

Ĝis,
m

-- 
http://bodrato.it/papers/


More information about the gmp-discuss mailing list