Skip to content
This repository was archived by the owner on Jul 27, 2022. It is now read-only.
This repository was archived by the owner on Jul 27, 2022. It is now read-only.

compilation error when OBS Studio configured with option -DUSE_LIBC++=ON #72

@ludocosmo

Description

@ludocosmo

On Ubuntu, configure OBS Studio to use LLVM libc++ and clang for compilation:

export CC=clang
export CXX=clang++
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_LIBC++=ON ..
make -j4
[ 43%] Building CXX object plugins/obs-vst/CMakeFiles/obs-vst.dir/linux/VSTPlugin-linux.cpp.o
/home/ludo/cosmo/git/obs-test/plugins/obs-vst/linux/VSTPlugin-linux.cpp:32:8: error: use of undeclared identifier 'errno'
                     errno);

Platform

Operating system and version: Ubuntu 20.04, clang 10
OBS Studio version: https://github.com/obsproject/obs-studio master branch tag 20fb235b8fe86284fcd0de7848a76056b0771228

Expected Behavior

Compilation should succeed.

Current Behavior

Compilation error:

[ 43%] Building CXX object plugins/obs-vst/CMakeFiles/obs-vst.dir/linux/VSTPlugin-linux.cpp.o
/home/ludo/cosmo/git/obs-test/plugins/obs-vst/linux/VSTPlugin-linux.cpp:32:8: error: use of undeclared identifier 'errno'
                     errno);

Steps to Reproduce

Configure OBS Studio to be compiled with LLVM libc++ and clang:

export CC=clang
export CXX=clang++
mkdir BUILD
cd BUILD
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_LIBC++=ON ..
make -j4
[ 43%] Building CXX object plugins/obs-vst/CMakeFiles/obs-vst.dir/linux/VSTPlugin-linux.cpp.o
/home/ludo/cosmo/git/obs-test/plugins/obs-vst/linux/VSTPlugin-linux.cpp:32:8: error: use of undeclared identifier 'errno'
                     errno);

Additional information

When compiling OBS Studio with libstdc++, include of <string> from obs-vst/VSTPlugin.h will in the end make an include of <errno.h> which contains a #define errno
But when using LLVM libc++, the list of include files included from <string> does not contain <errno.h>. So errno is not defined and the compilation fails.

A simple #include <cerrno> in file linux/VSTPlugin-linux.cpp is able to fix the problem.

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