Compile Error on Ubuntu 18.04

Ubuntu 18.04
gcc 4.8.5
root version 5.34/36

This error came up when attempting to compile.

g++ -pipe -m64 -Wshadow -Wall -W -Woverloaded-virtual -fPIC -Iinclude -pthread -I. -I/home/manuel/root/cint/cint/inc -o graf2d/fitsio/src/G__FITSIO.o -c graf2d/fitsio/src/G__FITSIO.cxx
g++ -shared -Wl,-soname,libFITSIO.so -m64 -O2 -Wl,–no-undefined -Wl,–as-needed -o lib/libFITSIO.so graf2d/fitsio/src/TFITS.o graf2d/fitsio/src/G__FITSIO.o -Llib -lCore -lCint -ldl -Llib -lHist -lGpad -lGraf -lMatrix /usr/lib/x86_64-linux-gnu/libcfitsio.a -lpthread -lz
/usr/lib/x86_64-linux-gnu/libcfitsio.a(cfileio.o): In function ffihtps': (.text+0xbe9a): undefined reference tocurl_global_init’
/usr/lib/x86_64-linux-gnu/libcfitsio.a(cfileio.o): In function ffchtps': (.text+0xbeb5): undefined reference tocurl_global_cleanup’
/usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrmem.o): In function bzip2uncompress2mem': (.text+0x1262): undefined reference toBZ2_bzReadOpen’
(.text+0x1289): undefined reference to BZ2_bzRead' (.text+0x12c0): undefined reference toBZ2_bzReadClose’
(.text+0x131e): undefined reference to BZ2_bzReadClose' (.text+0x1397): undefined reference toBZ2_bzReadClose’
(.text+0x13f7): undefined reference to BZ2_bzReadClose' /usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o): In functionhttps_open_network’:
(.text+0x761): undefined reference to curl_easy_init' (.text+0x778): undefined reference tocurl_easy_setopt’
(.text+0x7a1): undefined reference to curl_easy_setopt' (.text+0x7b7): undefined reference tocurl_easy_setopt’
(.text+0x7cd): undefined reference to curl_easy_setopt' (.text+0x810): undefined reference tocurl_easy_setopt’
/usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o):(.text+0x833): more undefined references to curl_easy_setopt' follow /usr/lib/x86_64-linux-gnu/libcfitsio.a(drvrnet.o): In functionhttps_open_network’:
(.text+0x8df): undefined reference to curl_easy_perform' (.text+0x905): undefined reference tocurl_easy_cleanup’
(.text+0x93c): undefined reference to curl_easy_setopt' (.text+0x94d): undefined reference tocurl_easy_setopt’
(.text+0x955): undefined reference to curl_easy_perform' (.text+0x9b5): undefined reference tocurl_easy_setopt’
(.text+0x9bd): undefined reference to curl_easy_perform' (.text+0xa63): undefined reference tocurl_easy_cleanup’
(.text+0xb07): undefined reference to curl_easy_setopt' (.text+0xb0f): undefined reference tocurl_easy_perform’
collect2: error: ld returned 1 exit status
/home/manuel/root/graf2d/fitsio/Module.mk:45: recipe for target ‘lib/libFITSIO.so’ failed
make: *** [lib/libFITSIO.so] Error 1

may be @amadio has an idea about it.

That doesn’t look like a problem in ROOT, but a problem in the static version of the cfitsio library on your system. Notice that all missing symbols come from it. Try adding libcurl to the linking step of libFITSIO.so in ROOT and it may work. Alternatively, try to use the shared version of libcfitsio from your system.

Had similar problem recently and I just went with 5.34/38 instead which worked fine in 18.04.

This has been reported as https://sft.its.cern.ch/jira/browse/ROOT-9755

@mp2u this thread is relevant - do you have objections against me moving it into the ROOT section?

Hi. I am facing the similar problem as posted. I am using root version 5.34 on Ubuntu 18.04. I do not know how to implement the solution you suggested. Can you please elaborate the steps?

I tried solution given on https://sft.its.cern.ch/jira/browse/ROOT-9755 following the reply by @Axel . But I am still getting the same error. But there might be an error in the way I am implementing the solution. In the CMakeLists.txt file, it was written:

ROOT_LINKER_LIBRARY(FITSIO *.cxx G__FITSIO.cxx LIBRARIES ${CFITSIO_LIBRARIES} DEPENDENCIES Hist Gpad Graf Matrix)

I tried two things:

  1. removed " DEPENDENCIES Hist Gpad Graf Matrix)" and wrote “curl”
  2. Added “curl” through comma
    ROOT_LINKER_LIBRARY(FITSIO *.cxx G__FITSIO.cxx LIBRARIES ${CFITSIO_LIBRARIES} DEPENDENCIES Hist Gpad Graf Matrix, curl)

None of these options resolve the errors. Please tell me what is the correct way of doing it.

Hi, I had the same problem and it was solved by using “cmake” instead of “./configure” and “make”. Thus after unpacking the .tar file and move it to your desired directory:

  • mkdir root-version_build
  • cd root-version_build
  • cmake …/root-version/
  • cmake --build . – -j3
  • . bin/thisroot.sh
  • root

You can check the useful info here:

Cannot complie ROOT on ubuntu 18.04