Install-Instructions#windows - tips

pantonvich

New Member
https://github.com/jp9000/obs-studio/wiki/Install-Instructions#windows

this might save the next person some time:

1. I didn't understand that the dependencies.zip file already included FFmpeg, x264 etc as there isn't a folder with those names. I figured it out by looking at the FFmpeg dev folder and seeing the folders that matched the dependencies i.e. libavcodec etc

2. I had no clue on cMake variables:

in the CmakeLists.txt I added the following after the project(obs-studio) - note I unzipped the dependencies.zip file into C:/obs-studio/dependencies/

set(DepsPath "C:/obs-studio/dependencies/win32")
set(FFmpegPath "C:/obs-studio/dependencies/win32")
set(x264Path "C:/obs-studio/dependencies/win32")
set(curlPath "C:/obs-studio/dependencies/win32")
set(LibfdkPath "C:/obs-studio/dependencies/win32")
#set(DISABLE_UI TRUE)
set(QTDIR "C:/Qt/5.5/msvc2013")
set(CMAKE_PREFIX_PATH "C:/Qt/5.5/msvc2013/lib/cmake")​
read next post

Note - at first I was getting this error from VS2013 as the default installs for QT is"msvc2012" and "msvc2013_64" but you need "msvc2013"

Error 2 error LNK2038: mismatch detected for '_MSC_VER': value '1700' doesn't match value '1800' in platform-windows.obj
 
Last edited by a moderator:

RytoEX

Forum Admin
Forum Moderator
Developer
This post helped me complete the setup for building OBS on Windows. I had to do a few things differently to get it working for me. I'll try to outline the steps I took, but this will be partly from memory, so I may miss some details. I used the instructions here in conjunction with the post above to do this.

For background, I'm working on a Windows 10 64-bit system, and I'll assume you already have git installed and configured. I will include instructions for getting set up to build 32-bit or 64-bit OBS Studio from 64-bit Windows. On a 32-bit Windows system, the steps may be a bit different.
  1. Install Microsoft Visual Studio 2013 or 2015.
    1. I installed Microsoft Visual Studio Community 2015 (currently Version 14.0.25422.01 Update 3), so these steps will reflect that choice. You may choose another up-to-date version of Visual Studio 2013 or 2015.
      Please note that VS Community 2015 comes with a 30-day trial. It is still free to use after that trial ends, but you must sign in with a Microsoft Account to continue using it.
  2. Get the pre-built obs-studio dependencies.
    1. Since I installed VS2015, I got the VS2015 dependencies. We'll say these are extracted to: C:\obs-dev\deps
  3. Install Qt
    1. Download the installer for the current version of Qt5 Open Source (currently Qt 5.7).
    2. While running the installer, make sure to select "msvc2015 64-bit" and optionally "msvc2015 32-bit" if you intend to build 32-bit versions (or the appropriate component for your Visual Studio version and architecture).
    3. We'll assume Qt is installed to: C:\Qt
  4. Install CMake for Win64.
  5. Clone obs-studio git repo (git clone --recursive https://github.com/jp9000/obs-studio.git). We'll say the local path is: C:\obs-dev\obs-studio
  6. Create build directories inside C:\obs-dev\obs-studio: build32; build64; debug32; debug64; release32; release64
  7. Edit C:\obs-dev\obs-studio\CMakeLists.txt right after "project(obs-studio)" (currently between lines 3 and 5) to add:
    set(DepsPath "C:/obs-dev/deps/win64")
    set(FFmpegPath "C:/obs-dev/deps/win64")
    set(x264Path "C:/obs-dev/deps/win64")
    set(curlPath "C:/obs-dev/deps/win64")
    set(QTDIR "C:/Qt/5.7/msvc2015_64")

    Don't edit the CMakeLists.txt file, per @Osiris.
  8. Run CMake (cmake-gui)
    1. For "Where is the source code:", put "C:/obs-dev/obs-studio"
    2. For "Where to build the binaries:"...
      1. If you're building 32-bit OBS Studio, put "C:/obs-dev/obs-studio/build32"
      2. If you're building 64-bit OBS Studio, put "C:/obs-dev/obs-studio/build64"
    3. Setup your Make/configuration variables.
      If you did not use or do not want to use system variables for this, you can set these up in CMake.
      Add the following variables by clicking the "Add Entry" button (use the variable type "PATH"; variable data is presented below in the format VariableName: VariableValue):
      1. For 32-bit OBS Studio:
        DepsPath: C:/obs-dev/deps/win32
        QTDIR: C:/Qt/5.7/msvc2015
      2. For 64-bit OBS Studio:
        DepsPath: C:/obs-dev/deps/win64
        QTDIR: C:/Qt/5.7/msvc2015_64
      3. Or, if you intend to build both 32-bit and 64-bit versions:
        DepsPath32: C:/obs-dev/deps/win32
        DepsPath64: C:/obs-dev/deps/win64
        QTDIR32: C:/Qt/5.7/msvc2015
        QTDIR64: C:/Qt/5.7/msvc2015_64
    4. Click the "Configure" button.
      At this point, CMake may ask you to specify a generator. If you've installed the same versions as I've outlined above, then...
      1. To build 32-bit OBS Studio, select "Visual Studio 14 2015"
      2. To build 64-bit OBS Studio, select "Visual Studio 14 2015 Win64"
      Leave the rest of the options alone. If you installed a different version of Visual Studio, check the version of Visual Studio you installed and select the corresponding entry here. Click the "Finish" button to continue.
    5. You probably have some time to kill, so get a drink or snack, or read something for a bit.
    6. Once CMake is done configuring, enable the "COPY_DEPENDENCIES" option.
    7. Click the "Configure" button again. This time, it should only take a few seconds.
    8. Once CMake is done configuring again, click the "Generate" button.
  9. If you're building 32-bit OBS Studio, open "C:\obs-dev\obs-studio\build32\obs-studio.sln" in Visual Studio.
    If you're building 64-bit OBS Studio, open "C:\obs-dev\obs-studio\build64\obs-studio.sln" in Visual Studio.

This should successfully open the project in Visual Studio. CMake does still display two red entries:
COPIED_DEPENCIES: enabled
Libavcodec_DIR: Libavcodec_DIR-NOTFOUND​

I'm pretty sure the first one is intended, but I'm not sure about the second one.

If anyone knows that I've made a mistake here, please feel free to give advice on what was done wrong and how to fix it. Similarly, if anyone knows anything about that second red CMake entry, please feel free to let me know.


EDIT (September 19, 2016): I've made a bunch of updates to these instructions.
Changes:
  • Added details for building 32-bit OBS Studio (Thanks goes to Jim for helping me with that!)
  • Updated links to the dependencies
  • Changed formatting
  • Changed wording
 
Last edited:

Osiris

Active Member
Editing CMakeLists.txt is not needed and not recommended. You either use environment variables or you add them through cmake-gui.

You can also put 32 or 64 behind the variable names and have them point to their respective dependencies, that way you can build both 32-bit and 64-bit obs-studio (ofcourse in seperate build folders).
 

RytoEX

Forum Admin
Forum Moderator
Developer
Editing CMakeLists.txt is not needed and not recommended. You either use environment variables or you add them through cmake-gui.

You can also put 32 or 64 behind the variable names and have them point to their respective dependencies, that way you can build both 32-bit and 64-bit obs-studio (ofcourse in seperate build folders).

Ahh, that's good information! The existing instructions weren't clear about the preferred method for creating cmake variables, and searching the Internet for info on how to do that yielded information resembling the CMakeLists.txt edits from the first post. I'll adjust my workflow accordingly. Is there a way to import multiple CMake variables via cmake-gui rather than environment variables?

When you say to put the 32 or 64 behind the variable names, do you mean like this (ignoring the syntax)?

DepsPath32:"C:/obs-dev/deps/win32"
QTDIR32:"C:/Qt/5.7/msvc2015"
DepsPath64:"C:/obs-dev/deps/win64"
QTDIR64:"C:/Qt/5.7/msvc2015_64"
 

RytoEX

Forum Admin
Forum Moderator
Developer
You can just add variables through cmake-gui.

And yes, those variables are correct.

I apologize, I asked my question incorrectly. Is there a way to add multiple variables en masse all at once, aside from environment variables? I'm guessing no, but I thought I'd ask.

Great! I'll try to redo the setup with variables like that made in cmake-gui. Do I need to alter the build-path in cmake-gui to omit the 32/64 and let CMake produce two separate builds, or does that not matter?
 
D

Deleted member 71534

Thank you very much RytoEX. That explanation helped finally build t he source :)
 

E.K.G

New Member
In my experience, I also need to add Qt5 bin path into Windows system variable PATH: \YOUR_QT5_PATH\msvc2015_64\bin, otherwise it will keep saying Qt5*.dll is missing.
 

Jack0r

The Helping Squad
Well Rytoex simply adds those folders as variables in cmake. (Step 8.3) Either way, cmake should be able to find them afterwards.
 

VinnyJ

New Member
While trying this out, because eventually I wanted to get my feet wet with making plugins down the line.

This works with msvc2017 RC, almost as-is.

Since I've only tried this with 64-bit.
Cmake generator is set to "Visual Studio 15 2017 Win64"

Used Qt 5.8, qalgorithms.h needs this patch. , otherwise VS will mention over 400+ errors.

QSV_Encoder.cpp in \plugins\obs-qsv11\ needs a line added:
#include <intrin.h>

or it says something about undeclared "__cpuid" identifier
 

RytoEX

Forum Admin
Forum Moderator
Developer
While trying this out, because eventually I wanted to get my feet wet with making plugins down the line.

This works with msvc2017 RC, almost as-is.

Since I've only tried this with 64-bit.
Cmake generator is set to "Visual Studio 15 2017 Win64"

Used Qt 5.8, qalgorithms.h needs this patch. , otherwise VS will mention over 400+ errors.

QSV_Encoder.cpp in \plugins\obs-qsv11\ needs a line added:
#include <intrin.h>

or it says something about undeclared "__cpuid" identifier
If Qt 5.8 requires a patch to work correctly with VS2017, that should probably be submitted to the Qt development team.


Thank you RytoEX and pantonvich!!! this helped me get it going! I wish there was a link to this thread on this page
https://github.com/jp9000/obs-studio/wiki/Install-Instructions
I was stuck and this thread got me the rest of the way through the process. I now have a running build environment and have compiled OBS studio for the first time myself !!!
Glad the additional instructions could help!
 
Top