Subject: | Build.PL expects libhts.so and htslib/tbx.h to be in the same subdirectory |
Date: | Tue, 7 Jul 2020 13:34:47 -0700 |
To: | bug-Bio-HTS [...] rt.cpan.org |
From: | Romeo Solano <rsolano1 [...] uw.edu> |
Hello,
I discovered this issue while debugging this error message in cpan install:
Couldn't find libhts.so and htslib/tbx.h in the following list of
folders (did you set LD_LIBRARY_PATH?): ...[snip]... at Build.PL line 78.
The Bio-HTS Build.PL file has, in the find_hts function, the following code:
for my $folder ( @search_path ) {
my ( $include_dir, $lib_dir );
if ( -e "$folder/$header_file" ) {
$include_dir = $folder;
}
elsif ( -e "$folder/include/$header_file" ) {
$include_dir = "$folder/include/";
}
if ( -e "$folder/$lib_file" ) {
$lib_dir = $folder;
}
elsif ( -e "$folder/lib/$lib_file" ) {
$lib_dir = "$folder/lib/";
}
#we found what we expect so
if ( $lib_dir and $include_dir ) {
return $include_dir, $lib_dir;
}
}
die "Couldn't find $lib_file and $header_file in the following list
of folders (did you set LD_LIBRARY_PATH?): " . join ", ", @search_path;
This code searches through each directory in the $LD_LIBRARY_PATH for
both the libhts.so and htslib/tbx.h files. If it does not find both of
these files in the same directory, it fails. This causes problems when
both of these files are in directories inside of the $LD_LIBRARY_PATH
environment variable. I think that this code should accommodate
situations where libraries are spread out among multiple directories in
$LD_LIBRARY_PATH.
I also think that this code should search though the directories in
$CPPFLAGS, since that is usually where 'include' directories end up.