Errors while configuring and compiling (Linux Mint 20.3)
Hi, developers! I appologise for issue, but I'm trying compile your project - libxml2 on Linux Mint 20.3 Cinnamon
I believe, Linux Mint is very popular Ubuntu-based distributive, it should be compiled without any problems, but ...
I have very much errors and warnings
uname -a
: My system is LInux Mint kernel 5.4.0-113-generic #127-Ubuntu
I have ICU, Zlib comp./autogen.sh --prefix=/libs/libxml2-2.10.0 --with-icu --with-history --docdir=/usr/local/share/doc/libxml2-2.10.0iled already into /usr/local
I have compiled libxml2-2.9.10+dfsg from apt-get source libxml2
, but I have xmlcatalog -add error, so I am tring to build the newest package
I tried to build it many times and almost made script for it. I had to edit files because there were mistakes from beginning (./configure)
getting sources
git clone https://github.com/GNOME/libxml2
apt-get source libxml2 # to copy ltmain from stable release'
cp libxml2-2.9.10+dfsg/ltmain.sh libxml2/
rm -r libxml2-2.9.10+dfsg
editing for making configure
cd libxml2
sed -i 's/TRUE/true/g' encoding.c
# to solve error on TRUE while ./configure
In spite of there is symlink /usr/bin/libtool => /usr/bin/libtoolize, I have to declare LIBTOOL:
sed -i '2i LIBTOOL=/usr/bin/libtoolize' Makefile.am
# to solve Warning about LIBTOOL
sed -i '2i LIBTOOL=/usr/bin/libtoolize' python/Makefile.am
# to solve Warning about LIBTOOL
! [[ -f /usr/local/share/aclocal/pkg.m4 ]] && sudo ln -s /usr/share/aclocal/pkg.m4 /usr/local/share/aclocal/pkg.m4
# if I have no pkg.m4`
sed -i 's/^\(LT_INIT.*disable-static.*\)$/#\1/' configure.ac
# It seems gcc compiler doesn't know disable-static option
gcc --version
: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
making configure
In order not to break my system and keep different versions separately, I install my packages into /libs/libxml2-2.10.0, after that I linking them to /usr/local - I am novice yet, so this a most secure method for me
CFLAGS='-O2 -fno-semantic-interposition' ./autogen.sh --prefix=/libs/libxml2-2.10.0 --with-icu --with-history --docdir=/usr/local/share/doc/libxml2-2.10.0
solving ac_fn_c_try_link() function warning
Moving this function from middle to file beginning
str2=cat configure | sed -n '/^ac_fn_c_try_link.*()/,/# ac_fn_c_try_link/p'
# copy function
sed -n '/^ac_fn_c_try_link.*()/,/# ac_fn_c_try_link/!p' -i configure
# delete function from file body
str=cat configure | sed -n '1,15p'
# copy file header
sed -i -e 1,14d configure
remaking configure from parts:
echo "$str" > configure.2 && echo "$str2" >> configure.2 && cat configure >> configure.2
mv configure.2 configure
./configure library 2nd time to make sure, there is no warnings
chmod +x configure
./configure --prefix=/libs/libxml2-2.10.0 --with-icu --with-history --docdir=/usr/local/share/doc/libxml2-2.10.0
After that, editing Makefile:
sed -i 's/^\(am__v_lt_0 = --silent\)$/#\1/' Makefile.in
# It seems gcc compiler doesn't know such option
sed -i 's/^\(.*\).--mode=[^ ]*\(.*\)$/\1\2/g' Makefile
# to solve --mode errors
There is a big problem $(LIBTOOL) says: unrecognized options - gcc -Wall -W....
So, I had to remove $(LIBTOOL) until $(CC) options beginning
sed -i 's/\(.*\)..AM_V_CC.*LIBTOOL.*AM_V_lt.*AM_LIBTOOLFLAGS.*LIBTOOLFLAGS.*\($(CC) $(DEFS).*\)$/\1\2/' Makefile
sed -i '/^.*_LINK.=.*LIBTOOL.*AM_V_lt.*AM_LIBTOOLFLAGS.*\\$/N;s/\\\n//g' Makefile
# в нужных местах убираю перенос строк
sed -i 's/^(.*_LINK.=.).*LIBTOOL.AM_V_lt.AM_LIBTOOLFLAGS.(..CCLD.)$/\1\2/g' Makefile
At last, I don't understand what I should do to build package
sed -i 's|-version-info $(LIBXML_VERSION_INFO).*\|\|g' Makefile # to solve error on -version
make.log
make
make reaches libxml2.la: target - I check it with printf
I tried to add -ldl option for $(CC), but without result
/usr/bin/ld: libxml2_la-xmlmodule.lo: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdl.so: ошибка добавления символов: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:934: libxml2.la] Error 1