Unexpected syntax error in VERSION file when building gettext
0
votes
0
answers
263
views
I am trying to build the gettext package from source.
When running
make
I receive an error:
make: Entering directory '/source/gettext-0.22/gettext-tools/libgettextpo'
[..........]
libtool: link: gcc -shared -fPIC -DPIC -Wl,--whole-archive ./.libs/libgnu.a -Wl,--no-whole-archive -lc -g -O2 -Wl,-soname -Wl,libgettextpo.so.0 -Wl,-version-script -Wl,.libs/libgettextpo.ver -o .libs/libgettextpo.so.0.5.9
/usr/bin/ld:.libs/libgettextpo.ver:2: syntax error in VERSION script
collect2: error: ld returned 1 exit status
make: *** [Makefile:4012: libgettextpo.la] Error 1
make: Leaving directory '/source/gettext-0.22/gettext-tools/libgettextpo'
[............]
make: *** [Makefile:362: all] Error 2
The error message hinted me at some kind of syntax error on line 2 in one specific file, so I proceeded to check the mentioned file:
root:/source/gettext-0.22# cat gettext-tools/libgettextpo/.libs/libgettextpo.ver
{ global:
local: *; };
========UPDATE========
As [steeldriver](https://unix.stackexchange.com/users/65304/steeldriver) suggested, the .ver file is autogenerated by the 'make' command.
Here is the part of the output, responsible for that:
libtool: link: /usr/bin/nm -B ./.libs/libgnu.a | /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libgettextpo.exp
libtool: link: /usr/bin/grep -E -e "^([^l]|l[^i]|li[^b]|lib[^g]|libg[^e]|libge[^t]|libget[^t]|libgett[^e]|libgette[^x]|libgettex[^t]|libgettext[^p]|libgettextp[^o]|libgettextpo[^_]|libgettextpo_version).*" ".libs/libgettextpo.exp" > ".libs/libgettextpo.expT"
libtool: link: mv -f ".libs/libgettextpo.expT" ".libs/libgettextpo.exp"
libtool: link: echo "{ global:" > .libs/libgettextpo.ver
libtool: link: cat .libs/libgettextpo.exp | /usr/bin/sed -e "s/\(.*\)/\1;/" >> .libs/libgettextpo.ver
libtool: link: echo "local: *; };" >> .libs/libgettextpo.ver
If I understood the logs correctly, make extracts symbols from libgnu.a file, filters them based on some kind of regular expression and then passes them to libgettextpo.exp file, from which the final libgettextpo.ver file is created.
libgnu.a file seems to be correct:
root:/source/gettext-0.22/gettext-tools/libgettextpo/.libs# nm -B libgnu.a
asnprintf.o:
U __stack_chk_fail
0000000000000000 T libgettextpo_asnprintf
U libgettextpo_vasnprintf
fopen.o:
U __errno_location
U __stack_chk_fail
U close
U fdopen
U fopen
0000000000000000 T libgettextpo_rpl_fopen
U memcpy
U open
U strlen
printf-args.o:
0000000000000000 r .LC0
0000000000000000 T libgettextpo_printf_fetchargs
00000000000000c0 r wide_null_string.0
printf-parse.o:
U __errno_location
U free
0000000000000000 T libgettextpo_printf_parse
U malloc
U memcpy
U realloc
vasnprintf.o:
U __errno_location
U __stack_chk_fail
U abort
U free
U libgettextpo_printf_fetchargs
U libgettextpo_printf_parse
0000000000000000 T libgettextpo_vasnprintf
0000000000000000 t libgettextpo_vasnprintf.cold
U malloc
U memcpy
U realloc
U snprintf
However, **libgettextpo.exp file is empty**.
Thus, the issue must be somewhere over these two lines:
libtool: link: /usr/bin/nm -B ./.libs/libgnu.a | /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libgettextpo.exp
libtool: link: /usr/bin/grep -E -e "^([^l]|l[^i]|li[^b]|lib[^g]|libg[^e]|libge[^t]|libget[^t]|libgett[^e]|libgette[^x]|libgettex[^t]|libgettext[^p]|libgettextp[^o]|libgettextpo[^_]|libgettextpo_version).*" ".libs/libgettextpo.exp" > ".libs/libgettextpo.expT"
I checked whether commands used in those two lines are present on my system.
sort, uniq and /usr/bin/sed are present.
I have also heard something about grep being not able to work with '-e' flags before version 2.3. I have grep of version 3.11.
========UPDATE 2========
I tried to replicate this process manually and found out, that the command producing the empty file is this one:
root:/source/gettext-0.22/gettext-tools/libgettextpo# /usr/bin/grep -E -e "^([^l]|l[^i]|li[^b]|lib[^g]|libg[^e]|libge[^t]|libget[^t]|libgett[^e]|libgette[^x]|libgettex[^t]|libgettext[^p]|libgettextp[^o]|libgettextpo[^_]|libgettextpo_version).*" ".libs/libgettextpo.exp" > ".libs/libgettextpo.expT"
Testing showed, that grep -E -e works as intended. I also checked the contents of libgettextpo.exp before filtering, it turned out to be this:
libgettextpo_asnprintf
libgettextpo_printf_fetchargs
libgettextpo_printf_parse
libgettextpo_rpl_fopen
libgettextpo_vasnprintf
Turns out, neither of this strings match the regular expression, specified during the build process. Since nothing matches the regex, the problem might be in the libgnu.a file, from which the libgettextpo.exp file is being produced.
Here is how libgnu.a is compiled:
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -version-info 5:9:5 -rpath /usr/lib -lc -no-undefined -export-symbols-regex '^([^l]|l[^i]|li[^b]|lib[^g]|libg[^e]|libge[^t]|libget[^t]|libgett[^e]|libgette[^x]|libgettex[^t]|libgettext[^p]|libgettextp[^o]|libgettextpo[^_]|libgettextpo_version).*' -o libgettextpo.la -rpath /usr/lib gettext-po.lo ../src/str-list.lo ../src/dir-list.lo ../src/message.lo ../src/pos.lo ../src/msgl-ascii.lo ../src/po-error.lo ../src/po-xerror.lo ../src/write-catalog.lo ../src/write-po.lo ../src/open-catalog.lo ../src/po-charset.lo ../src/po-lex.lo ../src/po-gram-gen.lo ../src/read-po.lo ../src/read-catalog-abstract.lo ../src/read-catalog.lo ../src/plural-table.lo ../src/format-c.lo ../src/format-c++-brace.lo ../src/format-python.lo ../src/format-python-brace.lo ../src/format-java.lo ../src/format-java-printf.lo ../src/format-csharp.lo ../src/format-javascript.lo ../src/format-scheme.lo ../src/format-lisp.lo ../src/format-elisp.lo ../src/format-librep.lo ../src/format-ruby.lo ../src/format-sh.lo ../src/format-awk.lo ../src/format-lua.lo ../src/format-pascal.lo ../src/format-smalltalk.lo ../src/format-qt.lo ../src/format-qt-plural.lo ../src/format-kde.lo ../src/format-kde-kuit.lo ../src/format-boost.lo ../src/format-tcl.lo ../src/format-perl.lo ../src/format-perl-brace.lo ../src/format-php.lo ../src/format-gcc-internal.lo ../src/format-gfc-internal.lo ../src/format.lo ../src/plural-exp.lo ../src/plural-eval.lo ../src/msgl-check.lo ../src/sentence.lo libgnu.la
libtool: link: rm -fr .libs/libgettextpo.exp .libs/libgettextpo.ver
Asked by Yakiv Baiduk
(1 rep)
Mar 7, 2024, 02:07 PM
Last activity: Mar 8, 2024, 01:02 PM
Last activity: Mar 8, 2024, 01:02 PM