This is a test version of Biostars. For the public version, visit https://www.biostars.org.
compiling shapeit4 : cannot find -lcurl

I am trying to compile shapeit4 on my cluster without root permissions. The makefile is as follows:

#COMPILER MODE C++11
CXX=g++ -std=c++11

#HTSLIB LIBRARY [SPECIFY YOUR OWN PATHS]
HTSLIB_INC=/share/apps/genomics/htslib-1.10/include/
HTSLIB_LIB=/share/apps/genomics/htslib-1.10/lib/libhts.a

#BOOST IOSTREAM & PROGRAM_OPTION LIBRARIES [SPECIFY YOUR OWN PATHS]
BOOST_INC=/share/apps/boost-1.71.0/include/
BOOST_LIB_IO=/share/apps/boost-1.71.0/lib/libboost_iostreams.a
BOOST_LIB_PO=/share/apps/boost-1.71.0/lib/libboost_program_options.a

#HTSLIB LIBRARY [SPECIFY YOUR OWN PATHS]
#HTSLIB_INC=/software/UHTS/Analysis/samtools/1.4/include
#HTSLIB_LIB=/software/UHTS/Analysis/samtools/1.4/lib64/libhts.a

#BOOST IOSTREAM & PROGRAM_OPTION LIBRARIES [SPECIFY YOUR OWN PATHS]
#BOOST_INC=/software/include
#BOOST_LIB_IO=/software/lib64/libboost_iostreams.a
#BOOST_LIB_PO=/software/lib64/libboost_program_options.a

#COMPILER & LINKER FLAGS

#Best performance is achieved with this. Use it if running on the same plateform you're compiling, it's definitely worth it!
#CXXFLAG=-O3 -march=native
#Good performance and portable on most intel CPUs
CXXFLAG=-O3 -mavx2 -mfma 
#Portable version without avx2 (much slower)
#CXXFLAG=-O3


LDFLAG=-O3

#DYNAMIC LIBRARIES
DYN_LIBS=-lz -lbz2 -lm -lpthread -llzma -lcurl -lcrypto

#SHAPEIT SOURCES & BINARY
BFILE=bin/shapeit4
HFILE=$(shell find src -name *.h)
CFILE=$(shell find src -name *.cpp)
OFILE=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done)
VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done)

#COMPILATION RULES
all: $(BFILE)

$(BFILE): $(OFILE)
    $(CXX) $(LDFLAG) $^ $(HTSLIB_LIB) $(BOOST_LIB_IO) $(BOOST_LIB_PO) -o $@ $(DYN_LIBS)

obj/%.o: %.cpp $(HFILE)
    $(CXX) $(CXXFLAG) -c $< -o $@ -Isrc -I$(HTSLIB_INC) -I$(BOOST_INC)

clean: 
    rm -f obj/*.o $(BFILE)

The compilation then fails on:

/usr/bin/ld: cannot find -lcurl

I understand that this means the compiler has looked in /usr/bin/ld and hasn't been able to find the lcurl library. Curl is installed on the cluster:

├── bin
│   ├── curl
│   └── curl-config
├── include
│   └── curl
├── lib
│   ├── libcurl.a
│   ├── libcurl.la
│   ├── libcurl.so -> libcurl.so.4.5.0
│   ├── libcurl.so.4 -> libcurl.so.4.5.0
│   ├── libcurl.so.4.5.0
│   └── pkgconfig
└── share
    ├── aclocal
    └── man

I've tried to add several different lines to the makefile in order for it to find -lcurl, but I haven't succeeded so far. Can anyone advise me on what to add to the makefile?

software error compiling

I don't have root permissions so I can't do a global installation like that.

You could ask your sys admins to install. It would not be an unreasonable request.

I tried that... 2 weeks later, still waiting.. It's frustrating asking biostars to act as the sysadmin, but it's the only option I have atm.

You have curl on your machine. Can you tell us what you get with

$ ld -lcurl --verbose

This thread (compile time answer) may help.

1 answer

Install it with BioConda https://bioconda.github.io/recipes/shapeit4/README.html

thanks - didn't realise it was on conda. I think this is the best solution.

Log in to answer this question.