dropwatch icon indicating copy to clipboard operation
dropwatch copied to clipboard

Fixes for building on RHEL8

Open uli42 opened this issue 1 month ago • 1 comments

  • RedHat EL 8 has only readline-devel 7.0.0 which comes without pkgconfig file. So I commented the check in =configure= for now
diff -u configure configure.fixed
--- configure	2025-11-26 15:53:53.899904000 +0100
+++ configure.fixed	2025-11-26 15:41:29.121232000 +0100
@@ -13035,7 +13035,7 @@
   pkg_cv_READLINE_CFLAGS=`$PKG_CONFIG --cflags "readline" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
-  pkg_failed=yes
+  pkg_failed=no
 fi
  else
     pkg_failed=untried
@@ -13077,12 +13077,12 @@
 	# Put the nasty error message in config.log where it belongs
 	echo "$READLINE_PKG_ERRORS" >&5
 
-	as_fn_error $? "libreadline is required" "$LINENO" 5
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	as_fn_error $? "libreadline is required" "$LINENO" 5
-else
+#	as_fn_error $? "libreadline is required" "$LINENO" 5
+#elif test $pkg_failed = untried; then
+#     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+#$as_echo "no" >&6; }
+#	as_fn_error $? "libreadline is required" "$LINENO" 5
+#else
 	READLINE_CFLAGS=$pkg_cv_READLINE_CFLAGS
 	READLINE_LIBS=$pkg_cv_READLINE_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5

  • After installing some packages like libnl3-devel and bintuils-devel configure worked
  • But compilation failed with this:
make  all-recursive
make[1]: Entering directory '/home/usibill/work/dropwatch'
Making all in src
make[2]: Entering directory '/home/usibill/work/dropwatch/src'
depbase=`echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I..  -D_GNU_SOURCE  -g -Wall -Werror -I/usr/include/libnl3  -I/usr/include/libnl3   -g -O2 -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.c &&\
mv -f $depbase.Tpo $depbase.Po
main.c: In function 'handle_dm_packet_alert_msg':
main.c:524:8: error: implicit declaration of function 'localtime' [-Werror=implicit-function-declaration]
   tm = localtime(&tv_sec);
        ^~~~~~~~~
main.c:524:6: error: assignment to 'struct tm *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
   tm = localtime(&tv_sec);
      ^
main.c:526:10: error: implicit declaration of function 'asctime'; did you mean 'adjtime'? [-Werror=implicit-function-declaration]
   tstr = asctime(tm);
          ^~~~~~~
          adjtime
main.c:526:8: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
   tstr = asctime(tm);
        ^
cc1: all warnings being treated as errors
make[2]: *** [Makefile:435: main.o] Error 1
make[2]: Leaving directory '/home/usibill/work/dropwatch/src'
make[1]: *** [Makefile:414: all-recursive] Error 1
make[1]: Leaving directory '/home/usibill/work/dropwatch'
make: *** [Makefile:346: all] Error 2
  • could fix this by adding the missing include <time.h> to src/main.c
  • Finally linking against libreadline failed, so I had to call configure like this: READLINE_LIBS=-lreadline ./configure
  • success

Conclusion/required fixes

  • add time.h include to main.c
  • readline check in configure should not fail. Maybe print hint how to call configure in that case or simply assume READLINE_LIBS=-lreadline. I suggest this change:
--- configure.orig	2025-11-26 16:00:50.440589000 +0100
+++ configure	2025-11-26 16:03:48.296013000 +0100
@@ -13077,11 +13077,13 @@
 	# Put the nasty error message in config.log where it belongs
 	echo "$READLINE_PKG_ERRORS" >&5
 
-	as_fn_error $? "libreadline is required" "$LINENO" 5
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	as_fn_error $? "libreadline is required" "$LINENO" 5
+#	as_fn_error $? "libreadline is required" "$LINENO" 5
+#elif test $pkg_failed = untried; then
+#     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+#$as_echo "no" >&6; }
+#	as_fn_error $? "libreadline is required" "$LINENO" 5
+	READLINE_CFLAGS=
+	READLINE_LIBS=-lreadline
 else
 	READLINE_CFLAGS=$pkg_cv_READLINE_CFLAGS
 	READLINE_LIBS=$pkg_cv_READLINE_LIBS
  • document how to call configure on systems where readline has no pkgconfig file.

uli42 avatar Nov 26 '25 15:11 uli42