svenstaro / rofi-calc

🖩 Do live calculations in rofi!
MIT License
964 stars 31 forks source link

Couldn't install, configuration errors on Ubuntu 23.04 #106

Open OdinAwaits opened 1 year ago

OdinAwaits commented 1 year ago

running autoreconf -i outputs this:

configure.ac:17: warning: AC_PROG_CC_C99 is obsolete; use AC_PROG_CC
configure.ac:20: warning: ac_ext=c
configure.ac:20: ac_cpp='$CPP $CPPFLAGS'
configure.ac:20: ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
configure.ac:20: ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
configure.ac:20: ac_compiler_gnu=$ac_cv_c_compiler_gnu
configure.ac:20: 
configure.ac:20: Some influential environment variables:
configure.ac:20: 
configure.ac:20: Use these variables to override the choices made by `configure' or to help
configure.ac:20: it to find libraries and programs with nonstandard names/locations.
configure.ac:20:   CC          C compiler command
configure.ac:20:   CFLAGS      C compiler flags
configure.ac:20:   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
configure.ac:20:               nonstandard directory <lib dir>
configure.ac:20:   LIBS        libraries to pass to the linker, e.g. -l<library>
configure.ac:20:   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
configure.ac:20:               you have headers in a nonstandard directory <include dir>
configure.ac:20: if test -n "$ac_tool_prefix"; then
configure.ac:20:   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
configure.ac:20: set dummy ${ac_tool_prefix}gcc; ac_word=$2
configure.ac:20: { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
configure.ac:20: printf %s "checking for $ac_word... " >&6; }
configure.ac:20: if test ${ac_cv_prog_CC+y}
configure.ac:20: then :
configure.ac:20:   printf %s "(cached) " >&6
configure.ac:20: else $as_nop
configure.ac:20:   if test -n "$CC"; then
configure.ac:20:   ac_cv_prog_CC="$CC" # Let the user override the test.
configure.ac:20: else
configure.ac:20: as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
configure.ac:20: for as_dir in $PATH
configure.ac:20: do
configure.ac:20:   IFS=$as_save_IFS
configure.ac:20:   case $as_dir in #(((
configure.ac:20:     '' is m4_require'd but not m4_defun'd
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/programs.m4:41: _AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:101: AC_CHECK_PROG is expanded from...
./lib/autoconf/programs.m4:221: AC_CHECK_TOOL is expanded from...
./lib/autoconf/c.m4:452: AC_PROG_CC is expanded from...
configure.ac:20: the top level

...and generates invalid config file. All dependencies were installed. System is Ubuntu 23.04

svenstaro commented 1 year ago

I really have no idea what's wrong here. I can't spot any errors here either.

OdinAwaits commented 1 year ago

Well, me neither. Autoreconf somehow pollutes the configure file with some parts of the above message, so it looks like this:

*fine-looking code*
Some influential environment variables:

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_prog_CC+y}
then :
  printf %s "(cached) " >&6
else $as_nop
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  case $as_dir in #(((
    ''

 as_dir=./ ;;
    */) ;;
*more usual code*

When I'm trying to run the script it obviously not working. I've tried to delete the plain text parts but it just gave me more syntax errors. I'm new to the linux, and I'm not really familiar with bash scripting, so any help would be appreciated. I've also attached the generated script in case someone will manage to find possible solutions configure.txt

tka4nik commented 4 months ago

Ubuntu 24.04, same error, same strangely generated configure file

Screenshot_20240505_023134

and the ../configure log:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
../configure: line 3201: Some: command not found
../configure: line 3785: syntax error near unexpected token `('
../configure: line 3785: `case "(($ac_try" in'
amitgurdasani commented 1 month ago

Yeah, exactly the same behavior on Debian testing.

Could it be the new autotools versions we're using? Newer autotools versions are notorious for generating broken scripts given older input files.

amitgurdasani commented 1 month ago

As a workaround, I've managed to build it just invoking the compiler and pkg-config from the command line given it's just one source file. Autotools is overkill (and just horrible) for this purpose.

echo gcc -shared -march=native -mtune=native -Os -Wall -Wextra -Wparentheses -Winline -pedantic -Wunreachable-code \
    $(pkg-config --cflags glib-2.0) $(pkg-config --cflags gio-unix-2.0) $(pkg-config --cflags gmodule-2.0) \
    $(pkg-config --cflags cairo) \
    $(pkg-config --cflags rofi) \
    -o calc.so calc.c \
    $(pkg-config --libs glib-2.0) $(pkg-config --libs gio-unix-2.0) $(pkg-config --cflags gmodule-2.0) \
    $(pkg-config --libs cairo) \
    $(pkg-config --libs rofi) |
        sh -x

echo install -m0644 -oroot -groot calc.so $(pkg-config --variable=pluginsdir rofi) |
    sudo sh -x

sudo apt install qalc
svenstaro commented 1 month ago

Autotools is overkill (and just horrible) for this purpose.

FWIW I agree but I wanted to stick with rofi convention. However, given that rofi is now also supporting meson, maybe we should just switch to meson and call it a day?

tka4nik commented 1 month ago

As a workaround

Just wanted to mention the obvious as well, manually deleting clearly misplaced lines and then continuing with the build process works as well

svenstaro commented 1 month ago

Would anyone here have some time to switch the build system over to meson? I'm not sure when I can get to it.