CMake fails to find shared version of libpcre when linking libkjs.so

Phillip Killewald reallyasi9 at gmail.com
Wed Feb 13 03:35:20 CET 2008


This is a continuation of KDE bug report #156895 (
http://bugs.kde.org/show_bug.cgi?id=156895).  All my environment information
is there.  Long story short, when I try to build kdelibs-4.0.X, CMake fails
when linking libkjs.so.  After much debugging, it was discovered that CMake
was attempting to link it against the static version of libpcre, even though
both the static and shared versions are installed on my system.  The error
looks like this:

<-- snip -->
Linking CXX shared library ../lib/libkjs.so
cd /var/tmp/portage/kde-base/kdelibs-4.0.0-r1/work/kdelibs_build/kjs &&
/usr/bin/cmake -P CMakeFiles/kjs.dir/cmake_clean_target.cmake
cd /var/tmp/portage/kde-base/kdelibs-4.0.0-r1/work/kdelibs_build/kjs &&
/usr/bin/cmake -E cmake_link_script CMakeFiles/kjs.dir/link.txt --verbose=1
/usr/bin/i686-pc-linux-gnu-g++ -fPIC -O2 -march=prescott -pipe
-fomit-frame-pointer -msse3 -funroll-loops  -Wnon-virtual-dtor
-Wno-long-long
-ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith
-Wformat-security -fno-exceptions -fno-check-new -fno-common
-Woverloaded-virtual -fvisibility=hidden -fvisibility-inlines-hidden -O2
-DNDEBUG -DQT_NO_DEBUG -Wl,--enable-new-dtags -Wl,--fatal-warnings
-Wl,--no-undefined -lc -shared -Wl,-soname,libkjs.so.4 -o
../lib/libkjs.so.4.0.0 "CMakeFiles/kjs.dir/kjs_automoc.o"
"CMakeFiles/kjs.dir/ustring.o" "CMakeFiles/kjs.dir/date_object.o"
"CMakeFiles/kjs.dir/collector.o" "CMakeFiles/kjs.dir/nodes.o"
"CMakeFiles/kjs.dir/grammar.o" "CMakeFiles/kjs.dir/lexer.o"
"CMakeFiles/kjs.dir/lookup.o" "CMakeFiles/kjs.dir/operations.o"
"CMakeFiles/kjs.dir/regexp.o" "CMakeFiles/kjs.dir/function_object.o"
"CMakeFiles/kjs.dir/string_object.o" "CMakeFiles/kjs.dir/bool_object.o"
"CMakeFiles/kjs.dir/number_object.o" "CMakeFiles/kjs.dir/internal.o"
"CMakeFiles/kjs.dir/Context.o" "CMakeFiles/kjs.dir/ExecState.o"
"CMakeFiles/kjs.dir/Parser.o" "CMakeFiles/kjs.dir/array_object.o"
"CMakeFiles/kjs.dir/math_object.o" "CMakeFiles/kjs.dir/object_object.o"
"CMakeFiles/kjs.dir/regexp_object.o" "CMakeFiles/kjs.dir/error_object.o"
"CMakeFiles/kjs.dir/function.o" "CMakeFiles/kjs.dir/debugger.o"
"CMakeFiles/kjs.dir/value.o" "CMakeFiles/kjs.dir/list.o"
"CMakeFiles/kjs.dir/object.o" "CMakeFiles/kjs.dir/interpreter.o"
"CMakeFiles/kjs.dir/package.o" "CMakeFiles/kjs.dir/property_map.o"
"CMakeFiles/kjs.dir/property_slot.o" "CMakeFiles/kjs.dir/nodes2string.o"
"CMakeFiles/kjs.dir/identifier.o" "CMakeFiles/kjs.dir/scope_chain.o"
"CMakeFiles/kjs.dir/dtoa.o" "CMakeFiles/kjs.dir/fpconst.o"
"CMakeFiles/kjs.dir/JSLock.o" "CMakeFiles/kjs.dir/JSImmediate.o"
"CMakeFiles/kjs.dir/PropertyNameArray.o"
"CMakeFiles/kjs.dir/JSWrapperObject.o"
"CMakeFiles/kjs.dir/CommonIdentifiers.o"
"CMakeFiles/kjs.dir/semantic_checker.o" -lpthread -lm -Wl,-Bstatic -lpcre
-Wl,-Bdynamic -lpcreposix
/usr/lib/gcc/i686-pc-linux-gnu/4.2.2/../../../../i686-pc-linux-gnu/bin/ld:
warning: creating a DT_TEXTREL in object.
collect2: ld returned 1 exit status
make[2]: *** [lib/libkjs.so.4.0.0] Error 1
make[2]: Leaving directory
`/var/tmp/portage/kde-base/kdelibs-4.0.0-r1/work/kdelibs_build'
make[1]: *** [kjs/CMakeFiles/kjs.dir/all] Error 2
make[1]: Leaving directory
`/var/tmp/portage/kde-base/kdelibs-4.0.0-r1/work/kdelibs_build'
make: *** [all] Error 2
<-- snip -->

Searching for PCRE in the CMakeCache.txt:

# grep PCRE CMakeCache.txt
//Force building of KJS without PCRE. Doing this will result in
KJS_FORCE_DISABLE_PCRE:BOOL=OFF
PCRE_INCLUDE_DIR:PATH=/usr/include
//The libraries needed to use PCRE
PCRE_LIBRARIES:STRING=/lib/libpcre.a;/usr/lib/libpcreposix.so
PCRE_PCREPOSIX_LIBRARY:FILEPATH=/usr/lib/libpcreposix.so
PCRE_PCRE_LIBRARY:FILEPATH=/lib/libpcre.a
//Have symbol PCRE_CONFIG_STACKRECURSE
HAVE_PCRE_STACK:INTERNAL=1
//Have symbol PCRE_CONFIG_UTF8
HAVE_PCRE_UTF8:INTERNAL=1
//Advanced flag for variable: PCRE_INCLUDE_DIR
PCRE_INCLUDE_DIR-ADVANCED:INTERNAL=1
//Advanced flag for variable: PCRE_LIBRARIES
PCRE_LIBRARIES-ADVANCED:INTERNAL=1
//Advanced flag for variable: PCRE_PCREPOSIX_LIBRARY
PCRE_PCREPOSIX_LIBRARY-ADVANCED:INTERNAL=1
//Advanced flag for variable: PCRE_PCRE_LIBRARY
PCRE_PCRE_LIBRARY-ADVANCED:INTERNAL=1

The only way I have been able to fix this problem is to remove libpcre.a and
libpcre.la from /usr/lib, then build kdelibs, then move the libraries back.
There must be a better way to do this.  This is probably CMake's fault, but
then why does building kdelibs-4.0.X on both of my two other systems work
flawlessly?  They are all Gentoo machines, they all have the same USE flags
set, and they all have approximately the same software installed.

-- 
Phillip Killewald
The Ohio State University
Department of Physics

"You play orthogonon with a wiffletorus."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-buildsystem/attachments/20080212/316f9409/attachment.html 


More information about the Kde-buildsystem mailing list