Describe the bug
cmake error:
CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::operator=(TPRegexp const&)': TPRegexp.cxx:(.text+0x33): undefined reference to `pcre_free'
Expected behavior
Build installs successfully without needing to use -Dbuiltin_pcre=ON
OR
cmake issues any kind of warning or error about the pcre version
To Reproduce
Follow installation instructions on ubuntu 20.04.2 and with:
– Looking for PCRE
– Found PCRE2: /usr/include (found version “10.34”)
cmake --build . – install -j4
[ 77%] Linking CXX shared library ../lib/libCore.so
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::operator=(TPRegexp const&)':
TPRegexp.cxx:(.text+0x33): undefined reference to `pcre_free'
/usr/bin/ld: TPRegexp.cxx:(.text+0x51): undefined reference to `pcre_free'
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::Optimize()':
TPRegexp.cxx:(.text+0x1cd): undefined reference to `pcre_free'
/usr/bin/ld: TPRegexp.cxx:(.text+0x206): undefined reference to `pcre_study'
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::MatchInternal(TString const&, int, int, TArrayI*) const':
TPRegexp.cxx:(.text+0x2eb): undefined reference to `pcre_exec'
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::~TPRegexp()':
TPRegexp.cxx:(.text+0x745): undefined reference to `pcre_free'
/usr/bin/ld: TPRegexp.cxx:(.text+0x75e): undefined reference to `pcre_free'
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::Compile()':
TPRegexp.cxx:(.text+0x910): undefined reference to `pcre_free'
/usr/bin/ld: TPRegexp.cxx:(.text+0x977): undefined reference to `pcre_compile'
/usr/bin/ld: CMakeFiles/Core.dir/base/src/TPRegexp.cxx.o: in function `TPRegexp::SubstituteInternal(TString&, TString const&, int, int, bool) const':
TPRegexp.cxx:(.text+0xe5f): undefined reference to `pcre_exec'
collect2: error: ld returned 1 exit status
make[2]: *** [core/CMakeFiles/Core.dir/build.make:2885: lib/libCore.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:39210: core/CMakeFiles/Core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
-- clad build command succeeded. See also /home/dragon/github/root2/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-build-*.log
[ 77%] Performing install step for 'clad'
-- clad install command succeeded. See also /home/dragon/github/root2/root_build/interpreter/cling/tools/plugins/clad/clad-prefix/src/clad-stamp/clad-install-*.log
[ 77%] Completed 'clad'
[ 77%] Built target clad
make: *** [Makefile:152: all] Error 2
Setup
ROOT v6.32.04
Built for linuxx8664gcc on Aug 15 2024, 15:50:24
From heads/latest-stable@
With c++ (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Binary directory: /home/dragon/github/root/root_install/bin
cmake_output.txt (13.7 KB)
install_output.txt (893.9 KB)
Additional context
Hello. I was trying to build ROOT from source and got this error.
As a workaround one can just use the built-in pcre, but this was a kinda obfuscated option that I eventually found after a couple hours of research.
This is why I decided to post it here in order to help others find the solution faster and to see if someone can help identifying why it is happening or why there was no error or warning about pcre installation.
so the steps to solve are:
1- Run cmake -DCMAKE_INSTALL_PREFIX=…/root_install …/root_src -Dbuiltin_pcre=ON
2- cmake --build . – install -j4
I’d like to know where to check for all the cmake options if thats possible!