Libvisual / libvisual

Libvisual Audio Visualization
http://libvisual.org/
85 stars 31 forks source link

[0.4.2] ./configure: 18070: Syntax error: word unexpected (expecting ")") #300

Closed TimB87 closed 1 year ago

TimB87 commented 1 year ago

Hi all :wave:

While trying to build a 32 bit library of libvisual 0.4.2, I get this weird error while running configure:

=======> Building '/home/pkgmk/packages/libvisual-32#0.4.2-1.pkg.tar.xz'.
bsdtar -p -o -C /home/pkgmk/work/libvisual-32/src -xf /home/pkgmk/distfiles/libvisual-0.4.2.tar.bz2
+ build
+ cd libvisual-0.4.2
+ export PKG_CONFIG_PATH=/usr/lib32/pkgconfig
+ PKG_CONFIG_PATH=/usr/lib32/pkgconfig
+ sed -i s/sdl-config/sdl-config-32/g configure.ac
+ autoreconf -vfi
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: running: autopoint --force
Copying file m4/codeset.m4
Copying file m4/extern-inline.m4
Copying file m4/fcntl-o.m4
Copying file m4/glibc2.m4
Copying file m4/glibc21.m4
Copying file m4/intdiv0.m4
Copying file m4/intl.m4
Copying file m4/intldir.m4
Copying file m4/intmax.m4
Copying file m4/inttypes-pri.m4
Copying file m4/inttypes_h.m4
Copying file m4/lcmessage.m4
Copying file m4/lock.m4
Copying file m4/longlong.m4
Copying file m4/printf-posix.m4
Copying file m4/size_max.m4
Copying file m4/stdint_h.m4
Copying file m4/threadlib.m4
Copying file m4/uintmax_t.m4
Copying file m4/visibility.m4
Copying file m4/wchar_t.m4
Copying file m4/wint_t.m4
Copying file m4/xsize.m4
Copying file po/Makevars.template
autoreconf: running: aclocal --force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
libtoolize: and rerunning libtoolize and aclocal.
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: aclocal --force -I m4
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:90: installing './compile'
configure.ac:12: installing './missing'
examples/Makefile.am: installing './depcomp'
autoreconf: Leaving directory '.'
+ ./configure --prefix=/usr --libdir=/usr/lib32 --enable-extra-optimization
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for Win32... no
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/select.h... yes
checking for sys/socket.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for shl_load... no
checking for shl_load in -ldld... no
checking for dlopen... yes
checking whether a program can dlopen itself... yes
checking whether a statically linked program can dlopen itself... no
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_i386
checking if the linker (/usr/bin/ld -m elf_i386) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_i386) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_i386) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for fcntl.h... yes
checking for sys/types.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for sched.h... yes
checking for sys/sched.h... no
./configure: 18070: Syntax error: word unexpected (expecting ")")

Building works for non 32 bit version just fine.

Line 18070 in configure is: AX_CXX_COMPILE_STDCXX_11(noext, mandatory)

gcc info:

tim@c372 ❯ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-12.2.0/configure --prefix=/usr --libexecdir=/usr/lib --enable-languages=c,c++,lto --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-shared --enable-lto --with-x=no --enable-multilib --enable-plugin --enable-default-pie --enable-default-ssp --with-pkgversion=CRUX-x86_64-multilib --with-system-zlib --disable-nls
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (CRUX-x86_64-multilib)

Is there any more info I can provide?

hartwork commented 1 year ago

Hi @TimB87,

line 18070 of configure is deep into a heredoc that seems to be coming from AX_CXX_COMPILE_STDCXX_11([noext], [mandatory]), so the shell seems to be interpreting code that was not meant to be interpreted by shell. My current best guess is that we are dealing with a POSIX shell related topic here. Could you share what shell you have in /bin/sh and which version? What I'll probably be able to reproduce with over here easily includes: bash busybox dash ksh lksh mksh. My guess is that yours is neither Bash nor Dash?

Best, Sebastian

hartwork commented 1 year ago

PS: with Dash I get error …

./configure: 21523: test: x: unexpected operator

…which I believe is from the == in

if test x"$LV_THREAD_CFLAGS" == xgthread2; then

It continues after that though and doesn't show the error that you saw above. I think I'll make a pull request once we understand the whole thing.

hartwork commented 1 year ago

PS: I saw the autoreconf -vfi above now so there's a chance that your configure script is different from mine. Could you attache the generated configure script or try without autoreconf -vfi?

kaixiong commented 1 year ago

@hartwork If I understand @TimB87 correctly, autoreconf did not manage to expand AX_CXX_COMPILE_STDCXX_11. The resultant line in his configure script is:

AX_CXX_COMPILE_STDCXX_11(noext, mandatory)
hartwork commented 1 year ago

@kaixiong I see, totally overlooked that part! :+1: @TimB87 that means the answer is that if you're running autoreconf you'll also need autoconf-archive installed. Either both or nothing.

TimB87 commented 1 year ago

Hi @kaixiong, hi @hartwork

Sorry for the late reply!

My shell is indeed dash, version 0.5.12. Having autoconf-archive installed fixes it. The log was from a clean container with minimal dependencies present, autoconf-archive was not invited to the party there.

Bashism, could've/should've thought about that one :sweat_smile:

hartwork commented 1 year ago

Having autoconf-archive installed fixes it.

@TimB87 okay great, I'll close the issue then. Please open more issues if anything else needs fixing.

eli-schwartz commented 3 months ago

@TimB87 that means the answer is that if you're running autoreconf you'll also need autoconf-archive installed. Either both or nothing.

You can make this properly error-check. Add the following line to configure.ac:

m4_pattern_forbid([^AX_CXX_COMPILE_STDCXX_11])

(or genericize that pattern as much as you wish, keep in mind that autotools itself guarantees that ^AC_ is reserved and won't appear in the output unless specifically m4_patternallow'd, but autoconf-archive is not careful about this so `^AX` isn't necessarily safe).

With this you get a proper error when autoconf-archive is not installed. By "proper error" I mean that configure doesn't fail with confusing syntax errors, instead, the autoreconf -fvi stage fails:

configure.ac:14: error: possibly undefined macro: AX_CXX_COMPILE_STDCXX_11
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf-2.71: error: /usr/bin/autoconf-2.71 failed with exit status: 1

You can do the same for PKG_CHECK_MODULES.

Apteryks commented 2 weeks ago

Just stumbled on this; I'd recommend to apply eli-schwartz's fix in their just-above reply.

hartwork commented 2 weeks ago

@Apteryks @eli-schwartz I turned Eli's idea into a new pull request #371 now — review and/or testing is welcome :pray: