Skip to content

CMake build fails #6

@nurupo

Description

@nurupo

The FindOpenAL.cmake distributed with CMake says

# This makes the presumption that you are include al.h like
# #include "al.h"
# and not
# #include <AL/al.h>
# The reason for this is that the latter is not entirely portable.
# Windows/Creative Labs does not by default put their headers in AL/ and
# OS X uses the convention <OpenAL/al.h>.

Yet, the source code in this repo uses #include <AL/al.h>, which fails horribly.

In my particular case, I have installed OpenAL into $OPENAL_PREFIX. The FindOpenAL.cmake says that if you have installed OpenAL in a non-system wide manner, set $OPENALDIR to where it is installed. So I do

export OPENALDIR=$OPENAL_PREFIX
cmake -DCMAKE_INSTALL_PREFIX=$ALUT_DIR -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=ON -DBUILD_TESTS=OFF .
make

and during the compilation I get

Scanning dependencies of target alut
[  5%] Building C object src/CMakeFiles/alut.dir/alutBufferData.c.o
In file included from /root/freealut/src/alutInternal.h:38:0,
                 from /root/freealut/src/alutBufferData.c:1:
/root/freealut/include/AL/alut.h:11:19: fatal error: AL/al.h: No such file or directory
 #include <AL/al.h>
                   ^
compilation terminated.
src/CMakeFiles/alut.dir/build.make:54: recipe for target 'src/CMakeFiles/alut.dir/alutBufferData.c.o' failed
make[2]: *** [src/CMakeFiles/alut.dir/alutBufferData.c.o] Error 1
CMakeFiles/Makefile2:77: recipe for target 'src/CMakeFiles/alut.dir/all' failed
make[1]: *** [src/CMakeFiles/alut.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2

If you call make VERBOSE=1, you see

cd /root/freealut/src && /usr/bin/cc  -DHAVE_CONFIG_H=1 -DHAVE_GCC_VISIBILITY -D__NO_CTYPE=1 -Dalut_EXPORTS -finline-functions -ffast-math -fomit-frame-pointer -fvisibility=hidden -fPIC -fPIC -I/root/freealut/include -I/root/prefix_openal/include/AL -I/root/freealut    -o CMakeFiles/alut.dir/alutBufferData.c.o   -c /root/freealut/src/alutBufferData.c
In file included from /root/freealut/src/alutInternal.h:38:0,
                 from /root/freealut/src/alutBufferData.c:1:
/root/freealut/include/AL/alut.h:11:19: fatal error: AL/al.h: No such file or directory
 #include <AL/al.h>
                   ^
compilation terminated.

Note that it does -I/root/prefix_openal/include/AL. It does so because that's what CMake's FindOpenAL.cmake sets the OPENAL_INCLUDE_DIR to, while the source code expects CMake to set OPENAL_INCLUDE_DIR to /root/prefix_openal/include.

tl;dr: the source code, at least when using the CMake build system, should be using #include "al.h" instead #include <AL/al.h>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions