WarmUpTill / SceneSwitcher

An automated scene switcher for OBS Studio
https://obsproject.com/forum/resources/automatic-scene-switching.395/
GNU General Public License v2.0
915 stars 71 forks source link

Error when compiling obs with advanced scene switcher plugin using qt generated by script compiler. #834

Closed hongweicong closed 5 days ago

hongweicong commented 1 year ago

Describe the bug I use the provided script to compile qt6.4.3 under windows, it can be compiled successfully, but when I use the compiled qt to compile OBS with Advanced Scene Switcher, it will report fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory: 'curl/curl.h'. No such file or directory. but when I use the qt installer for msvc2019 to compile OBS with Advanced Scene Switcher, it doesn't give me any error!

To Reproduce Steps to reproduce the behavior:

  1. Generate qt by script compilation
  2. Generate qt by script compilation

Expected behavior I'm hoping that the qt generated by compiling with the method provided in the script will successfully compile the obs with the advanced scene switcher plugin

Logs The following is a partial error log at compile time:

35>D:\git\obs-studio\UI\frontend-plugins\SceneSwitcher\src\switcher-data-structs.hpp(8,10): fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory (compiling source file D:\git\obs-studio\UI\frontend-plugins\SceneSwitcher\src\general.cpp) 35>switch-audio.cpp 45>util.cpp 45>platform.cpp 42>libobs-opengl.vcxproj -> D:\build\obs\libobs-opengl\Debug\libobs-opengl.dll 47>aja-vpid-data.cpp 47>aja-widget-io.cpp 35>D:\git\obs-studio\UI\frontend-plugins\SceneSwitcher\src\switcher-data-structs.hpp(8,10): fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory (compiling source file D:\git\obs-studio\UI\frontend-plugins\SceneSwitcher\src\legacy\scene-trigger.cpp)

Version information

Additional context Add any other context about the problem here.

WarmUpTill commented 1 year ago

The curl/curl.h file is part of the obs dependencies, which can be found here: https://github.com/obsproject/obs-deps/releases

With the existing log snipped it is very difficult to say what the issue is. Can you build OBS (without the plugin) successfully? If not I would suggest to have look at https://obsproject.com/wiki/Building-OBS-Studio which outlines the necessary steps quite well.


Off topic: Is there a particular reason that you are trying to compile version 1.19.2, instead of the latest one?


Just to avoid confusion: Qt is GUI framework. Prebuilt Qt binaries are also part of the obs-deps package.

So you are not compiling Qt, but instead are compiling OBS / the advanced scene switcher plugin.

Hope that helps!

hongweicong commented 1 year ago

If I don't need to compile the advanced scene switcher, I can build OBS successfully, but after bringing the plugin with me, using my own compiled qt, it will report an error, and using the official qt compilation provided by the msvc2019 version of the compilation will compile fine, I have the compiled qt via the https://github.com/obsproject/obs-deps/releases project, but it still gives me an error!

WarmUpTill commented 1 year ago

If I don't need to compile the advanced scene switcher, I can build OBS successfully

In that case I am a bit stumped what the problem might be. libobs is relying on the header being available in libobs/util/curl/curl-helper.h so it must be available, if you can compile OBS.

Can you check if the "CURL_DIR" cmake variable points to a sensible location?

I tried to reproduce the problem but so far was unable to with the following steps:

   git clone --recurse-submodules https://github.com/obsproject/obs-studio.git
   cd .\obs-studio\UI\frontend-plugins\
   git clone --recurse-submodules https://github.com/WarmUpTill/SceneSwitcher.git
   # Add the SceneSwitcher directory to CMakeLists.txt
   code .\CMakeLists.txt
   # Download the OBS deps + Qt and extract them into the same folder C:\deps\
   ...
   # Run cmake in the obs-studio folder with with CMAKE_PREFIX_PATH set to C:\deps\
   ...
   # Start the build

Is that somewhat similar to what you are doing?

using my own compiled qt

Ah so you are in fact using a custom Qt build. Sorry about the misunderstanding!

hongweicong commented 1 year ago

Yes, I need to use QWebEngine, so I need to compile the qt source code myself, but when I use my own compiled version of qt to compile obs without plugins, it works fine, but when I compile obs with plugins together, it reports an error. At first, I thought I was missing some qt libraries when I compiled, so I used the qt generated from the scripts in the obs-deps codebase to compile the obs with the plugin, and it still reported an error, the plugin kept reporting that curl.h was not found.

WarmUpTill commented 1 year ago

Which version of OBS and the plugin are you trying to compile?

Do you maybe want to set up a quick call on the weekend with you sharing your screen, so we can try to figure out "live" what is wrong? If so feel free to contact me on the OBS forums with a proposed time slot.

At the moment I can only guess what the problem might be.

WarmUpTill commented 1 year ago

I doubt that it would make a difference, but is there any particular reason you are trying to build version 1.19.2?

hongweicong commented 1 year ago

OS: Windows 11 22H2 OBS Version: 29.0.2 Plugin Version: 1.19.2 Software: Visual Studio 2019. Strawberry-perl-5.32.1.1

I have tried reinstalling the system to make sure the environment is clean, and then compiling the source code according to qt's documentation, I compiled qtbase and qtsvg, at this point, compiling obs can be used normally, but bringing the plugin with it won't work, and I used 3 computers with different configurations but the same environment to try it out, and all of them can have the same problem.

The reason I use the 1.19.2 version of the plugin is that I've been using it for a long time, and there are some changes in different versions, so I don't want to change the version.

WarmUpTill commented 1 year ago

The reason I use the 1.19.2 version of the plugin is that I've been using it for a long time, and there are some changes in different versions, so I don't want to change the version.

I see.

Can you check if the "CURL_DIR" cmake variable points to a sensible location?

Does that maybe give any hints as to what the problem is? Is the variable defined in your build environment?

hongweicong commented 1 year ago

I use the following command in the plugin's cmake file for the output

message("CURL_DIR :  ${CURL_DIR} ")
message("CURL_INCLUDE_DIRS :  ${CURL_INCLUDE_DIRS} ")
message("LIBCURL_INCLUDE_DIRS :  ${LIBCURL_INCLUDE_DIRS} ")

Here is my log output

1>-- advanced-scene-switcher configured for in-tree build
1>CURL_DIR :  D:/dept/windows-deps-2023-01-06-x64/lib/cmake/CURL
1>CURL_INCLUDE_DIRS :
1>LIBCURL_INCLUDE_DIRS :
1>-- OBS:  ENABLED    advanced-scene-switcher

How do I upload a log file so I can upload the full logs

hongweicong commented 1 year ago

When I execute the configure step of cmake, through the output log, I can see that libcurl.dll has been copied to the specified location, and libcurl.dll also exists in the obs generation directory bin\64bit.

Here is part of the log for cmake configure:

CMAKE_PROJECT_NAME is obs-studio
advanced-scene-switcher configured for in-tree build
OBS:  ENABLED    advanced-scene-switcher
CMake Warning at UI/frontend-plugins/SceneSwitcher/src/macro-external/opencv/CMakeLists.txt:6 (find_package):
  By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OpenCV", but
  CMake did not find one.

  Could not find a package configuration file provided by "OpenCV" with any
  of the following names:

    OpenCVConfig.cmake
    opencv-config.cmake

  Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
  "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
  provides a separate development package or SDK, be sure it has been
  installed.

CMake Warning at UI/frontend-plugins/SceneSwitcher/src/macro-external/opencv/CMakeLists.txt:8 (message):
  OpenCV not found! Video condition will be disabled!

  OpenCV sources are available under:
  D:/git/obs-studio/UI/frontend-plugins/SceneSwitcher/src/macro-external/opencv/../../../deps/opencv

ADVSS: ENABLED PLUGIN     advanced-scene-switcher-openvr
STATIC_ZLIB_PATH not set, windows updater disabled
OBS:  QtCore_BIN_DIR: D:/build/x64release/bin
OBS:  QtCore_PLUGIN_DIR: D:/build/x64release/plugins
OBS:  FFmpeg files: D:/dept/windows-deps-2023-01-06-x64/include/../bin/avcodec-59.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/avdevice-59.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/avfilter-8.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/avformat-59.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/avutil-57.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedcrypto.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedtls.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedx509.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/librist.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/libsrt.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/swresample-4.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/swscale-6.dll;D:/dept/windows-deps-2023-01-06-x64/include/../bin/zlib.dll
OBS:  x264 files: D:/dept/windows-deps-2023-01-06-x64/include/../bin/libx264-164.dll
OBS:  Libfdk files: 
OBS:  Freetype files: 
OBS:  rnnoise files: 
OBS:  curl files: D:/dept/windows-deps-2023-01-06-x64/include/../bin/libcurl.dll
OBS:  lua files: D:/dept/windows-deps-2023-01-06-x64/include/luajit/../../bin/lua51.dll
OBS:  ssl files: 
OBS:  zlib files: D:/dept/windows-deps-2023-01-06-x64/include/../bin/zlib.dll
OBS:  Qt Debug files: D:/build/x64release/bin/Qt6Cored.dll;D:/build/x64release/bin/Qt6Guid.dll;D:/build/x64release/bin/Qt6Networkd.dll;D:/build/x64release/bin/Qt6Svgd.dll;D:/build/x64release/bin/Qt6Widgetsd.dll;D:/build/x64release/bin/Qt6Xmld.dll
OBS:  Qt Debug Platform files: D:/build/x64release/plugins/platforms/qwindowsd.dll
OBS:  Qt Debug Styles files: D:/build/x64release/plugins/styles/qwindowsvistastyled.dll
OBS:  Qt Debug Iconengine files: D:/build/x64release/plugins/iconengines/qsvgicond.dll
OBS:  Qt Debug Imageformat files: D:/build/x64release/plugins/imageformats/qgifd.dll;D:/build/x64release/plugins/imageformats/qjpegd.dll;D:/build/x64release/plugins/imageformats/qsvgd.dll
OBS:  Qt Release files: D:/build/x64release/bin/Qt6Core.dll;D:/build/x64release/bin/Qt6Gui.dll;D:/build/x64release/bin/Qt6Network.dll;D:/build/x64release/bin/Qt6Svg.dll;D:/build/x64release/bin/Qt6Widgets.dll;D:/build/x64release/bin/Qt6Xml.dll
OBS:  Qt Release Platform files: D:/build/x64release/plugins/platforms/qwindows.dll
OBS:  Qt Release Styles files: D:/build/x64release/plugins/styles/qwindowsvistastyle.dll
OBS:  Qt Release Iconengine files: D:/build/x64release/plugins/iconengines/qsvgicon.dll
OBS:  Qt Release Imageformat files: D:/build/x64release/plugins/imageformats/qgif.dll;D:/build/x64release/plugins/imageformats/qjpeg.dll;D:/build/x64release/plugins/imageformats/qsvg.dll
OBS:  Qt ICU files: 
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/avcodec-59.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/avdevice-59.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/avfilter-8.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/avformat-59.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/avutil-57.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedcrypto.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedtls.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libmbedx509.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/librist.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libsrt.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/swresample-4.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/swscale-6.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/zlib.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libx264-164.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/../bin/libcurl.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/dept/windows-deps-2023-01-06-x64/include/luajit/../../bin/lua51.dll to D:/git/obs-studio/additional_install_files/exec64
OBS:  copying D:/build/x64release/bin/Qt6Core.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Gui.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Network.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Svg.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Widgets.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Xml.dll to D:/git/obs-studio/additional_install_files/exec64r
OBS:  copying D:/build/x64release/bin/Qt6Cored.dll to D:/git/obs-studio/additional_install_files/exec64d
OBS:  copying D:/build/x64release/bin/Qt6Guid.dll to D:/git/obs-studio/additional_install_files/exec64d
OBS:  copying D:/build/x64release/bin/Qt6Networkd.dll to D:/git/obs-studio/additional_install_files/exec64d
OBS:  copying D:/build/x64release/bin/Qt6Svgd.dll to D:/git/obs-studio/additional_install_files/exec64d
OBS:  copying D:/build/x64release/bin/Qt6Widgetsd.dll to D:/git/obs-studio/additional_install_files/exec64d
OBS:  copying D:/build/x64release/bin/Qt6Xmld.dll to D:/git/obs-studio/additional_install_files/exec64d
Configuring done (43.9s)
Generating done (3.9s)
WarmUpTill commented 1 year ago

I have no idea why that would be necessary, but can you try replacing CURL_INCLUDE_DIRS with CURL_INCLUDE_DIR in the CMakeLists.txt of the plugin and check if that changes anything?

When I find the time I will give it another try using the exact OBS dep version you are using.

hongweicong commented 1 year ago

I tried it and nothing changed. Try it if you have time, thanks!

WarmUpTill commented 1 year ago

I tried it and nothing changed. Try it if you have time, thanks!

That is really strange ... CURL_INCLUDE_DIR is how the the OBS cmake is printing the following line in the log you shared: OBS: curl files: D:/dept/windows-deps-2023-01-06-x64/include/../bin/libcurl.dll

Does it make a difference if you add the following line to the plugin cmake CURL_INCLUDE_DIR is used? get_target_property(CURL_INCLUDE_DIR CURL::libcurl INTERFACE_INCLUDE_DIRECTORIES)

Try it if you have time, thanks!

I was able to compile the plugin using windows-deps-2023-01-06-x64 as well.

The offer still stands to have a look at your setup together during the weekend. This will probably be much quicker than me suggesting yet another random idea every 24 hours :D

hongweicong commented 1 year ago

I tried that, but it still reports an error. The only variable between a successful compile and an incorrect compile is only qt, and my guess is that the version of qt compiled through the source may be missing some module, but I'm not sure what's missing

WarmUpTill commented 5 days ago

As version 1.19 is quite old and the plugin structure / build system has changed a lot since then I will close this issue. If you should face any issues building the plugin with more recent releases feel free to let me know and I will try to support you!