[Kde-games-devel] KgSound build problem
Ian Wadham
iandw.au at gmail.com
Sat Apr 21 11:05:29 UTC 2012
Please see diagnosis below + attached patch.
On 20/04/2012, at 5:18 PM, Ian Wadham wrote:
> After svn update of kdegames I get build problems where CMake says
> that my version of libsndfile is too old and that I need at least v 0.21.
> In actual fact I have v 1.0.25.
>
> I had a look at kdegames/libkdegames/CMakeLists.txt and added two
> lines, just before "try_compile", to see what is happening:
>
> if (SNDFILE_FOUND AND USE_OPENAL_SNDFILE)
> message(STATUS "Checking libsndfile capabilities")
> message(STATUS "SNDFILE_INCLUDE_DIR <" ${SNDFILE_INCLUDE_DIR} "> SNDFILE_INCLUDE_DIRS <" ${SNDFILE_INCLUDE_DIRS} ">")
> message(STATUS "SNDFILE_LIBRARY <" ${SNDFILE_LIBRARY} "> SNDFILE_LIBRARIES <" ${SNDFILE_LIBRARIES} ">")
> try_compile(SNDFILE_WORKS
> ${CMAKE_CURRENT_BINARY_DIR}/audio/check-libsndfile-capabilities
> ${CMAKE_CURRENT_SOURCE_DIR}/audio/check-libsndfile-capabilities.cpp)
>
> Note the messages put out both singular and plural forms of the INCLUDE and LIBRARY
> symbols. This is because both singular and plural forms occur later in the CMakeLists.txt
> and I think there may have been a slip of the pen somewhere in there.
>
> Attached is my CMake output. It appears (in that output) that the singular
> SNDFILE_INCLUDE_DIR and the plural SNDFILE_LIBRARIES are correct and
> the header and libraries are where I expect to find them. I am working on a
> Macbook with libraries installed by Macports, as I have been doing from July
> last year until today, without any problems.
>
> Furthermore, my installed sndfile.h file contains the necessary OGG and VORBIS
> enum values. The only other thing I can think of is that the compiler here does not like
>
> int main()
> {
> //We need Ogg/Vorbis support. If sndfile.h is too old, these enum values
> //will be missing and compiler errors will be generated.
> (void) SF_FORMAT_OGG;
> (void) SF_FORMAT_VORBIS;
>
> return 0;
> }
>
> in libkdegames/audio/check-libsndfile-capabilities.cpp … "(void) <enum value>;"(?)
I think there was a chicken-and-egg problem in the "try_compile" command to CMake (see
above). ${CMAKE_CURRENT_SOURCE_DIR}/audio/check-libsndfile-capabilities.cpp has
a "#include <sndfile.h>" in it, but "try_compile" does not know where to find that header,
unless perhaps there is a cache handy, so SNDFILE_WORKS will always be false if you
are building in an empty build directory (as I was).
The attached patch gives "try_compile" an include-path, adds some informative comments
about sound to the CMake log and fixes a plural (SNDFILE_INCLUDE_DIRS) later in the build.
Cheers, Ian W.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LibKDEGamesCMakeLists.patch
Type: application/octet-stream
Size: 1956 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120421/d2520ac1/attachment.obj>
More information about the kde-games-devel
mailing list