Cmake build fails

I am attempting to build root from source using cmake. But I’m getting the following error. I’m not sure why the build is having trouble finding these libraries.

Thanks for any help you may be able to provide,

[ 69%] Built target Meta
[ 69%] Built target TextInput
[ 69%] Built target Zip
[ 69%] Built target Lzma
[ 69%] Built target Unix
[ 69%] Built target gitcommit
[ 69%] Built target BaseTROOT
[ 69%] Built target Core
[ 69%] Built target G__Rint
[ 69%] Built target Rint
Scanning dependencies of target root.exe
[ 70%] Building CXX object main/CMakeFiles/root.exe.dir/src/rmain.cxx.o
[ 70%] Linking CXX executable …/bin/root.exe
/usr/bin/ld: warning:, needed by …/lib/, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning:, needed by …/lib/, not found (try using -rpath or -rpath-link)
…/lib/ undefined reference to pcre_free' ../lib/ undefined reference topcre_exec’
…/lib/ undefined reference to pcre_compile' ../lib/ undefined reference topcre_study’
collect2: error: ld returned 1 exit status
main/CMakeFiles/root.exe.dir/build.make:96: recipe for target ‘bin/root.exe’ failed
make[2]: *** [bin/root.exe] Error 1
CMakeFiles/Makefile2:23636: recipe for target ‘main/CMakeFiles/root.exe.dir/all’ failed
make[1]: *** [main/CMakeFiles/root.exe.dir/all] Error 2
Makefile:149: recipe for target ‘all’ failed

Hi Dennis,
I don’t know what the cause might be, but here are a few ideas to investigate the problem (note that we build ROOT via cmake many times per day and it usually works fine):

  • which operating system are you on, what version of ROOT are you trying to build and what are a few shell commands that reproduce this behaviour (starting from scratch)?
  • you are missing – do you have the library anywhere on your system? E.g. What does locate print?
  • are you trying to re-build ROOT with an old cmake configuration generated e.g. before an important system upgrade, so that libpcre might have changed location?
  • does the error appear even if you start with an new, empty build directory?


Thank you, Enrico.

Duplicate versions of the library files were on the system (Ubuntu) because of Anaconda, producing inconsistencies in the build. I moved the Anaconda folder to get rid of the duplicates, and restarted the build. This time it completed.

So, your suggestions were spot on.


1 Like

Perfect, marking this as solved then.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.