https://bugs.kde.org/show_bug.cgi?id=361967

            Bug ID: 361967
           Summary: cannot build libktorrent on Gentoo multiarch system -
                    FindGMP.cmake fails
           Product: ktorrent
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: joris.guis...@gmail.com
          Reporter: j...@keelhaul.me.uk

Trying to configure libktorrent (the KF5 version from the master branch) fails
to find the GMP library even though a compatible version (6.0.0) is installed:

-- Installing in the same prefix as Qt, adopting their path scheme.
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - found
-- Performing Test _OFFT_IS_64BIT
-- Performing Test _OFFT_IS_64BIT - Success
-- Found KF5Archive: /usr/kde5/lib64/cmake/KF5Archive/KF5ArchiveConfig.cmake
(found version "5.21.0")
-- Found KF5Crash: /usr/kde5/lib64/cmake/KF5Crash/KF5CrashConfig.cmake (found
version "5.21.0")
-- Found Gettext: /usr/bin/msgmerge (found version "0.19.4")
-- Found PythonInterp: /usr/bin/python (found version "2.7.10")
-- Found KF5I18n: /usr/kde5/lib64/cmake/KF5I18n/KF5I18nConfig.cmake (found
version "5.21.0")
-- Found KF5KIO: /usr/kde5/lib64/cmake/KF5KIO/KF5KIOConfig.cmake (found version
"5.21.0")
-- Found KF5Solid: /usr/kde5/lib64/cmake/KF5Solid/KF5SolidConfig.cmake (found
version "5.21.0")
-- Found KF5: success (found suitable version "5.21.0", minimum required is
"5.15") found components:  Archive Crash I18n KIO Solid
-- Boost version: 1.56.0
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148
(message):
  Could NOT find LibGMP: Found unsuitable version "..", but required is at
  least "6.0.0" (found /usr/include)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:386
(_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibGMP.cmake:75 (find_package_handle_standard_args)
  CMakeLists.txt:60 (find_package)
-- Configuring incomplete, errors occurred!

libktorrent's cmake/FindGMP.cmake tries to find the version by searching
through the located gmp.h (/usr/include/gmp.h) to find the _GNU_MP_VERSION
macros.   Unfortunately (although I don't know whether this problem applies to
other architecures or distros), on a Gentoo multiarch system - one supporting
both 32-bit and 64-bit executables and libraries - the GMP include file at
/usr/include/gmp.h is a forwarding header which includes ARCH/gmp.h as
appropriate for the architecture being built.  It does not itself contain the
__GNU_MP_VERSION
macros and so the version test fails.


Reproducible: Always




libktorrent version (from the top level CMakeLists.txt) is "2.0.1".
Git HEAD is a18974f58c12c90c3e4e0acfd387d6a37dd6ca98

This is not an elegant solution, but one workaround that I have found is to
additionally look for the include file in the architecture include
subdirectory:

execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine
                OUTPUT_VARIABLE CXX_MACHTYPE OUTPUT_STRIP_TRAILING_WHITESPACE
                ERROR_QUIET)
find_path(LibGMP_INCLUDE_DIRS NAMES gmp.h PATH_SUFFIXES ${CXX_MACHTYPE} "")

which should be benign if the compiler is not GCC or the system is not
multiarch.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to