names etc

Alexander Neundorf neundorf at kde.org
Thu Apr 15 22:05:44 CEST 2010


On Thursday 15 April 2010, lux-integ wrote:
> Greetings,
>
> I am having difficulty compiling kdebase-workspace-4.4.2  on on a
> pure-64-bit linux (kernel-2.6.33) setup.  I already   described details of
> the problem (
> http://mail.kde.org/pipermail/kde-buildsystem/2010-April/006863.html     ).
>
> Basically I do not have Xorg-7.5 in /usr and although some X-libraries are
> found   quite a few are not  ( For example  trawling through build/cmake
> revealed (not just for libXi which aborted the compilation) the
> following):-

Good catch, nice that you foudn this issue.

> ####  excerpts  from build/CMakeError.log ##############
>
>
> /usr/bin/gcc  -m64   -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align
> -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W
> -Wpointer-arith -Wwrite-strings -Wformat-security
> -Wmissing-format-attribute -fno-common 
> -DCHECK_FUNCTION_EXISTS=XkbLockModifiers
> CMakeFiles/cmTryCompileExec.dir/CheckFunctionExists.c.o  -o
> cmTryCompileExec -rdynamic -lX11 /usr/X11R7.5/lib64/libSM.so
> /usr/X11R7.5/lib64/libICE.so /usr/X11R7.5/lib64/libX11.so
> /usr/X11R7.5/lib64/libXext.so /usr/X11R7.5/lib64/libXft.so
> /usr/X11R7.5/lib64/libXau.so /usr/X11R7.5/lib64/libXdmcp.so
> /usr/X11R7.5/lib64/libXpm.so -Wl,-rpath,/usr/X11R7.5/lib64 /usr/bin/ld:
> cannot find -lX11

I'll just start with this one, it should be similar for the other ones.

So, this is from a TryCompile, as can be seen e.g. in 
the "cmTryCompileExec.dir" dir.
It fails because it doesn't find "-lX11", which is given as first argument to 
the linker, followed by a bunch of other X11 libraries, including the full 
path to libX11.so, so the location of libX11 is actually know. So somebody 
must have given "X11" or "-lX11" somewhere directly without using the results 
from find_package(X11).

Ok, so where is it ?
There is a "-DCHECK_FUNCTION_EXISTS=XkbLockModifiers" in the command, so we 
just search *.txt and *.cmake in kdebase for "XkbLockModifiers".
This leads us to kdebase/ConfigureChecks.cmake, where we find this code:

if (UNIX)
  find_path(X11_XKB_INCLUDE_PATH X11/XKBlib.h "${X11_INC_SEARCH_PATH}")
  if (X11_XKB_INCLUDE_PATH)
    MACRO_PUSH_REQUIRED_VARS()
    set(CMAKE_REQUIRED_LIBRARIES "${X11_LIBRARIES}
                                  ${CMAKE_REQUIRED_LIBRARIES}")
    check_library_exists(X11 XkbLockModifiers "" HAVE_XKB)


So here we have the problem.
check_library_exists() is called to check whether the 
symbol "XkbLockModifiers" exists in the library "X11". In the line above 
CMAKE_REQUIRED_LIBRARIES is set to also contains ${X11_LIBRARIES}, which 
gives the list of full paths to the X11 libraries you see in the linker 
command.
The problem is that just "X11" was given as first argument instead of the full 
path to the X11 library, which is contained in ${X11_X11_LIB}, as listed in 
the documentation of FindX11.cmake (see e.g. 
http://api.kde.org/cmake/modules.html#module_FindX11 )

So, to fix this, replace the "X11" with "${X11_X11_LIB}" and it should work.

Proceed the same way for the other errors.

pkg-config is not required for this at all.

Looking forward for a patch from you :-)
Alex


More information about the Kde-buildsystem mailing list