gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 98a0490 3/3: --enable-debug disables shared li


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 98a0490 3/3: --enable-debug disables shared libraries also
Date: Wed, 8 Aug 2018 07:11:23 -0400 (EDT)

branch: master
commit 98a0490901ce330d1ad691a12874031d33a1eab7
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    --enable-debug disables shared libraries also
    
    Until now the configure-time `--enable-debug' option would only disable
    optimization and add debugging flags. But when debugging, shared libraries
    can also cause a lot of trouble/pain. Therefore in the manual, we had
    always also included `--disable-shared' with the `--enable-debug' option.
    
    Since its almost always necessary, the `--enable-debug' option also
    disables shared libraries. In the explanations of this option, a
    description has been given for the rare occasions that shared libraries are
    necessary for the debug.
---
 configure.ac      | 16 +++++++++++++---
 developer-build   | 14 ++------------
 doc/gnuastro.texi | 32 +++++++++++++++++++++-----------
 3 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index bd3264f..d4562d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,11 +112,11 @@ AM_CONDITIONAL([COND_CHECK_WITH_VALGRIND], [test 
"x$enable_check_with_valgrind"
 # Set the compilation flags.
 AC_ARG_ENABLE(debug,
               [AS_HELP_STRING([--enable-debug],
-                              [No optimization, build with debug flags.])],
+                              [No optimization, debug flags, no shared lib.])],
               [AS_IF([test "x$enable_debug" != xno], [enable_debug=yes])],
               [enable_debug=no])
 AS_IF([test "x$enable_debug" = "xyes"],
-      [cflags_add="-g -O0"],
+      [cflags_add="-g -O0"; enable_shared=no],
       [cflags_add="-O3"])
 CFLAGS="-Wall $cflags_add $CFLAGS"
 CXXFLAGS="-Wall $cflags_add $CXXFLAGS"
@@ -395,10 +395,14 @@ libtool_shell="none"
 AS_IF([test "x$has_gnulibtool" = "xyes"],
       [
         AC_MSG_CHECKING(for shell to use with libtool)
+
+        # Make a C source file and run Libtool on it with the specified
+        # shells.
+        outname=libtool_shell_test
         cprog=libtool_shell_test.c
         echo "#include <stdio.h>"                                 > $cprog
         echo "int main(void){printf(\"success\\n\"); return 0;}" >> $cprog
-        ltargs="--quiet --tag=CC --mode=link $CC $cprog -O3 -o test"
+        ltargs="--quiet --tag=CC --mode=link $CC $cprog -O3 -o $outname"
         AS_IF( sh -c "$gnulibtool_exec $ltargs" > /dev/null 2>&1,
                [libtool_shell="sh"],
                [AS_IF([test "x$has_bash" = "xyes"],
@@ -409,7 +413,13 @@ AS_IF([test "x$has_gnulibtool" = "xyes"],
                                     [libtool_shell="zsh"]) ])
                        ] )
                ] )
+
+        # Clean up: note that no output might have been generated (when no
+        # proper shell was found). Therefore, for deleting the output file,
+        # we'll call `rm' with `-f' so it doesn't complain with an error in
+        # such cases.
         rm $cprog
+        rm -f $outname
         AC_MSG_RESULT($libtool_shell)
       ])
 
diff --git a/developer-build b/developer-build
index f6769cc..63b622f 100755
--- a/developer-build
+++ b/developer-build
@@ -401,24 +401,14 @@ cd $build_dir
 
 
 # If a 'Makefile' doesn't exist, then configure Gnuastro.
-#
-# FOR DEBUGGING: uncomment the second half of this line. Gnuastro uses GNU
-# Libtool to build shared libraries for highly portable and maintainable
-# usage on a wide variety of systems. While this is great for binaries,
-# shared libraries can be a pain when debuggin. For this reason,
-# compilation of shared libraries can be turned off by specifying the
-# --disable-shared option to configure. With static libraries, compilation
-# (the 'make' command) will also significantly speed up. Also, by default
-# (in 'configure.ac'), we have set optimization flags which have to be
-# cancelled in debugging.
 if [ ! -f Makefile ]; then
 
     # Set the proper flags.
     if [ x$debug = x1 ]; then
-        confopts="--enable-debug --disable-shared"
+        confopts="--enable-debug"
     fi
     if [ x$valgrind = x1 ]; then
-        confopts="--enable-check-with-valgrind --disable-shared"
+        confopts="--enable-check-with-valgrind"
     fi
 
     # Run the configure script.
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 559673b..c2f5c30 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5758,14 +5758,24 @@ program using the GNU build system (through the 
configure script).
 @cindex Valgrind
 @cindex Debugging
 @cindex GNU Debugger
-Compile/build Gnuastro with debugging information and no optimization. In
-order to allow more efficient programs when using Gnuastro (after the
+Compile/build Gnuastro with debugging information, no optimization and
+without shared libraries.
+
+In order to allow more efficient programs when using Gnuastro (after the
 installation), by default Gnuastro is built with a 3rd level (a very high
-level) optimization and no debugging information. But when there are
-crashes or unexpected behavior, debugging flags and disabling optimization
-can greatly help in localizing the problem. This configuration option is
-identical to manually calling the configuration script with
address@hidden"-g -O0"}.
+level) optimization and no debugging information. By default, libraries are
+also built for static @emph{and} shared linking (see
address@hidden). However, when there are crashes or unexpected behavior,
+these three features can hinder the process of localizing the problem. This
+configuration option is identical to manually calling the configuration
+script with @code{CFLAGS="-g -O0" --disable-shared}.
+
+In the (rare) situations where you need to do your debugging on the shared
+libraries, don't use this option. Instead run the configure script by
+explicitly setting @code{CFLAGS} like this:
address@hidden
+$ ./configure CFLAGS="-g -O0"
address@hidden example
 
 @item --enable-check-with-valgrind
 @cindex Valgrind
@@ -5773,8 +5783,8 @@ Do the @command{make check} tests through Valgrind. 
Therefore, if any
 crashes or memory-related issues (segmentation faults in particular) occur
 in the tests, the output of Valgrind will also be put in the
 @file{tests/test-suite.log} file without having to manually modify the
-check scripts. This option will also build Gnuastro with no optimization
-and enable debugging flags (as if you also call @option{--enable-debug}).
+check scripts. This option will also activate Gnuastro's debug mode (see
+the @option{--enable-debug} configure-time option described above).
 
 Valgrind is free software. It is a program for easy checking of
 memory-related issues in programs. It runs a program within its own
@@ -6460,7 +6470,7 @@ as GDB, or Valgrind), disable optimization and also the 
building of shared
 libraries. Similar to running the configure script of below
 
 @example
-$ ./configure --enable-debug --disable-shared
+$ ./configure --enable-debug
 @end example
 
 Besides all the debugging advantages of building with this option, it will
@@ -29249,7 +29259,7 @@ significantly slow down the compilation (the 
@command{make} command). So
 during development it is recommended to configure Gnuastro as follows:
 
 @example
-$ ./configure --enable-debug --disable-shared
+$ ./configure --enable-debug
 @end example
 
 @noindent



reply via email to

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