Re: configure: error: libthreadar linking failed

Denis Corbin <[email protected]>
Newsgroups gmane.comp.sysutils.backup.dar.support
Message-ID <[email protected]>
On 07/09/2021 21:05, Pierre-Olivier Quirion wrote:
> Hello

Hello,
>
> I have compiled libthreadar and installed it in a non standard place
> "$LIBTHREADAR" and want to compile dar against it but it seems that I
> cannot link the lib/headers properly.
>
>
> Here is the output of my latest failure:
>
>
> $ export CPATH=$CPATH:${LIBTHREADAR}/usr/local/lib
> $ export CPPFLAG="-I${LIBTHREADAR}/usr/local/include/"

CPPFLAGS (_with an ending S_) should be used to add directive at
pre-processing time, which is not adequate but should work.
CPATH is not know to me nor to autoconf/automake tools (see the end of
the "./configure --help" output for list of supported environment variables)

>
> $ ./configure    --enable-threadar
> [...]
> checking execinfo.h presence... yes
> checking for execinfo.h... yes
> checking for backtrace in -lexecinfo... no
> checking for backtrace() usability... yes
> checking for for_autoconf in -lthreadar... no
> checking libthreadar/libthreadar.hpp usability... no
> checking libthreadar/libthreadar.hpp presence... no
> checking for libthreadar/libthreadar.hpp... no
> configure: WARNING: Cannot find libthreadar.h header file

libthreadar.h header file is not found, probably because you missed the
ending S of CPPFLAGS, though it would be better to use CXXFLAGS as its
purpose is to set compilation options for C++ code:

export CXXFLAGS='-I$LIBTHREADAR/usr/local/include'

> checking for libthreadar operationability... wrong
> configure: error: libthreadar linking failed
>
but that's still not sufficient, because once compilation will complete
(assuming it succeeded), the linking phase will need to know where to
find the libthreadar library (both shared and static flavors) which has
probably be installed under $LIBTHREADAR/usr/local/lib (?) Where from:

export LDFLAGS='-L$LIBTHREADAR/usr/local/lib'

Last with that variable set, once './configure' and 'make' will have
completed the dar/libdar building you will hit a last obstacle to
execute the dynamic linked version of dar and other dar_* tools
(dar_static which relies on ... static linking... is not concerned): the
dynamic linker of your operating system looks for shared libraries in
some well defined directory, and obviously not in $LIBTHREADAR/usr/local/lib

you have two options to fix that:
- either modify the system configuration (add the new path to
/etc/ld.so.conf then run 'ldconfig' for it takes effect)
- or set the LD_LIBRARY_PATH environment variable accordingly to your
need (I assume it was not used so far, else you would add a new item in
the column seperated list as you would do with the PATH variable) before
running dar and dar_* commands:

export LD_LIBRARY_PATH=$LIBTHREADAR/usr/local/lib
cd src/dar_suite
./dar
(or set the PATH variable to your need).

I hope it would let you solve the problem you met.

Note that libthreadar and dar/libdar packages both have a 'make
uninstall' directive that quite cleanly removes the things they installed...

Cheers,
Denis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.