Skip to content
This repository has been 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

Open
ludocosmo opened this issue Dec 28, 2020 · 0 comments

Comments

@ludocosmo
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant