Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libobs: threading.h includes w32-pthreads as a relative path #7155

Closed
univrsal opened this issue Aug 21, 2022 · 5 comments · Fixed by #7159 or #7382
Closed

libobs: threading.h includes w32-pthreads as a relative path #7155

univrsal opened this issue Aug 21, 2022 · 5 comments · Fixed by #7159 or #7382
Assignees
Labels
Confirmed This bug report has been confirmed by project members Windows Affects Windows

Comments

@univrsal
Copy link
Contributor

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

28.0.0-rc1

OBS Studio Version (Other)

No response

OBS Studio Log URL

n/a

OBS Studio Crash Log URL

No response

Expected Behavior

Including the obs header <util/threading.h> breaks the build for plugins using the plugin template on windows as the header includes "../../deps/w32-pthreads/pthread.h". That file isn't present in the plugin dependencies and so the build fails. Here's a test project I made based on the template:
https://github.com/univrsal/test123
And here's the CI log:
https://github.com/univrsal/test123/runs/7821655312?check_suite_focus=true

I use that header in a plugin to set the name of a separate thread via os_thread_set_name (https://github.com/obsproject/obs-studio/blob/master/libobs/util/threading.h#L95) which used to work fine with the old CI I used, but I'm trying to switch to the actions from this template because I have to redo the CI for the move to Qt6.

Current Behavior

The build fails.

Steps to Reproduce

  1. Create repository from the plugin template
  2. Include util/threading.h
  3. CI fails

Anything else we should know?

I was told to report this here instead of in the plugin template. The original issue is here obsproject/obs-plugintemplate#36

PatTheMav added a commit to PatTheMav/obs-studio that referenced this issue Aug 21, 2022
Using a relative path for the pthread.h header by w32-pthreads breaks
compilation of plugins which include threading.h from libobs (as
w32-pthreads will exist at a different location relative to the
libobs header).

As w32-pthreads (and its include directory) is added to the libobs
target by CMake, the pthread.h header will be found even when using
system header notation.

Fixes obsproject#7155
PatTheMav added a commit to PatTheMav/obs-studio that referenced this issue Aug 21, 2022
Using a relative path for the pthread.h header by w32-pthreads breaks
compilation of plugins which include threading.h from libobs (as
w32-pthreads will exist at a different location relative to the
libobs header).

As w32-pthreads (and its include directory) is added to the libobs
target by CMake, the pthread.h header will be found even when using
system header notation.

Fixes obsproject#7155
@PatTheMav PatTheMav added Windows Affects Windows Confirmed This bug report has been confirmed by project members labels Aug 23, 2022
jp9000 pushed a commit that referenced this issue Aug 24, 2022
Using a relative path for the pthread.h header by w32-pthreads breaks
compilation of plugins which include threading.h from libobs (as
w32-pthreads will exist at a different location relative to the
libobs header).

As w32-pthreads (and its include directory) is added to the libobs
target by CMake, the pthread.h header will be found even when using
system header notation.

Fixes #7155
@paulpv
Copy link

paulpv commented Aug 30, 2022

When I hard reset obs-studio to 28.0.0-rc2, I look at the files libobs/CMakeLists.txt and libobs/utils/threading.h, they look updated with this fix.

When I build a plugin (obs-ndi) in a folder beside obs-studio I get the following error:

C:\...\obs-build-dependencies\plugin-deps-2022-08-02-qt6-x64\include\util/threading.h(30,10): fatal error C1083: Cannot open include file: '../../deps/w32-pthreads/pthread
.h': No such file or directory [C:\...\obs-ndi\build_x64\obs-ndi.vcxproj]

After the build and its failure my HEAD detaches to 43a49dc and when I next look at the files libobs/CMakeLists.txt and libobs/utils/threading.h, they look reverted to before this fix.

Is this normal?

Does the plugin-deps-2022-08-02-qt6-x64 need to be updated, or something else?

@paulpv
Copy link

paulpv commented Aug 30, 2022

Nevermind, I see that obs-ndi buildspec.json is:

{
    "dependencies": {
        "obs-studio": {
            "version": "28.0.0-beta1",
            "repository": "https://github.com/obsproject/obs-studio.git",
            "branch": "master",
            "hash": "43a49dca47344a5170159ef99b86b97f90d4e4ad"
        },
        ...

I can fix that...

@glikely
Copy link
Contributor

glikely commented Sep 15, 2022

I'm also having this problem, and changing the build spec as @paulpv suggests above has not fixed my Windows build in GitHub actions. I get the exact same cannot find pthreads.h error.

This is on the obs-ptz plugin. You can see the result here:
https://github.com/glikely/obs-ptz/actions/runs/3061262667

@paulpv
Copy link

paulpv commented Sep 15, 2022

@glikely 🤷‍♂️ Those deps look to be up to date.
Your [excellent looking] project looks to be based off of https://github.com/obsproject/obs-plugintemplate, so this is even more mysterious. :/

@PatTheMav PatTheMav reopened this Sep 15, 2022
@PatTheMav
Copy link
Member

This obviously cannot work if w32-pthreads doesn't export its pthreads.h as a public header (it isn't marked as such in its CMakeLists file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed This bug report has been confirmed by project members Windows Affects Windows
Projects
No open projects
Status: Fixed & Released
4 participants