Closed grenaud closed 1 year ago
That code is around an ifdef:
#ifdef HAVE_LIBCURL
init_add_plugin(NULL, hfile_plugin_init_libcurl, "libcurl");
#endif
So this implies your config.h somehow enabled that define still but didn't include the library on the link line.
I've tried to reproduce this and cannot. My config.h has /* #undef HAVE_LIBCURL */
, so it's working as intended there. Can you check your config.h?
If your local config.h has the undef, then are you finding a copy of it from elsewhere? You can take your compilation line (it may differ to mine) and use -E to show the expanded code including or -M. Eg:
$ gcc -M -c -I. hfile.c|grep config
hfile.o: hfile.c /usr/include/stdc-predef.h config.h /usr/include/stdio.h \
$ gcc -E -I. hfile.c | grep config.h
# 1 "./config.h" 1
my apologies about the formatting. I get different results, on the machine where it does not work:
htslib$ gcc -M -c -I. hfile.c|grep config
hfile.o: hfile.c /usr/include/stdc-predef.h /home/software/htslib/config.h \
htslib$ gcc -E -I. hfile.c | grep config.h
# 1 "/home/software/htslib/config.h" 1 3
/home/software/ is a directory where we keep a lot of software, I have no idea how htslib in my home dir knows about it.
on the machine where it works:
htslib$ gcc -M -c -I. hfile.c|grep config
hfile.o: hfile.c /usr/include/stdc-predef.h config.h /usr/include/stdio.h \
/usr/include/x86_64-linux-gnu/bits/_G_config.h \
htslib$ gcc -E -I. hfile.c | grep config.h
# 1 "./config.h" 1
# 1 "/usr/include/x86_64-linux-gnu/bits/_G_config.h" 1 3 4
# 19 "/usr/include/x86_64-linux-gnu/bits/_G_config.h" 3 4
# 20 "/usr/include/x86_64-linux-gnu/bits/_G_config.h" 2 3 4
# 22 "/usr/include/x86_64-linux-gnu/bits/_G_config.h" 2 3 4
This is probably something you have in your environment then. You do a "gcc -I." and yet it's using /home/software in preference. That to me smells like having a global search path such as CPATH or C_INCLUDE_PATH in your environment.
You can check with printenv | grep home/software
to see what's pointing there.
Note it's generally a bad idea to have things in search paths defined in this way. At least globally. If it needs doing, put it in the build script for the specific packages.
Dear James, my apologies for not getting back to you sooner! I have actually gone around the problem by disabling libcurl in the configure script. It seems that one cannot build a libcurl statically which is kind of annoying.
I tried to disable the libcurl dependency, I did the following:
git clone --recursive https://github.com/samtools/htslib.git cd htslib/ git submodule update --init --recursive autoreconf -i ./configure --disable-libcurl make
However, I am getting:
hfile.c:1084: undefined reference to
hfile_plugin_init_libcurl' `Which should not happen. This occurs on Ubuntu 20.04 but not on another machine running Ubuntu 18.04.
Any idea why?