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

Garbage in pkg-config on FreeBSD #7990

Open
jbeich opened this issue Dec 31, 2022 · 3 comments
Open

Garbage in pkg-config on FreeBSD #7990

jbeich opened this issue Dec 31, 2022 · 3 comments

Comments

@jbeich
Copy link
Contributor

jbeich commented Dec 31, 2022

Operating System Info

Other

Other OS

FreeBSD

OBS Studio Version

28.1.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

N/A

OBS Studio Crash Log URL

No response

Expected Behavior

$ pkg-config libobs --cflags
-I/usr/local/include/obs -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 -pthread

Current Behavior

$ pkg-config libobs --cflags
-I/usr/local/include/obs -DHAVE_OBSCONFIG_H -mmmx -msse -msse2 $\<$\<COMPILE_LANG_AND_ID:CUDA,NVIDIA\>:SHELL:-Xcompiler -pthread\> $\<$\<NOT:$\<COMPILE_LANG_AND_ID:CUDA,NVIDIA\>\>:-pthread\> 

Steps to Reproduce

  1. pkg install obs-studio mercurial meson pkgconf
  2. hg clone https://hg.sr.ht/~scoopta/wlrobs
  3. cd wlrobs
  4. hg checkout v1.0
  5. meson setup _build
  6. meson compile -C _build
cc: error: unknown argument '-pthread>'; did you mean '-pthreads'?
cc: error: no such file or directory: '$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:SHELL:-Xcompiler'
cc: error: no such file or directory: '$<$<NOT:$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>>:-pthread>'

Anything else we should know?

Regressed by #6746 due to not sanitizing INTERFACE_COMPILE_OPTIONS. CC @PatTheMav, @yurivict

--- /usr/local/libdata/pkgconfig/libobs.pc	before
+++ /usr/local/libdata/pkgconfig/libobs.pc	after
@@ -1,10 +1,10 @@ Version: 28.1.2
 prefix=/usr/local
 exec_prefix=${prefix}
 libdir=/usr/local/lib
 includedir=/usr/local/include/obs
 
 Name: libobs
 Description: OBS Studio Library
 Version: 28.1.2
-Cflags: -I${includedir} -DHAVE_OBSCONFIG_H  
-Libs: -L${libdir} -lpthread
+Cflags: -I${includedir} -DHAVE_OBSCONFIG_H -mmmx -msse -msse2  $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:SHELL:-Xcompiler -pthread> $<$<NOT:$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>>:-pthread>
+Libs: -L${libdir} -lobs -lpthread

Note, COMPILE_LANG_AND_ID:CUDA,NVIDIA comes from Threads::Threads

@PatTheMav
Copy link
Member

CMake does not have .pc generator because it is not possible to properly represent the transitive dependency relations of a CMake project into a single .pc file and generator expressions make it more or less required that CMake itself would generate those files at generation time (right now the file is created at configure time).

As we rely on modern CMake (and will deepen that reliance next year), this issue will become more apparent, so we'll probably deprecate generation of a pkg-config file anyway (also to keep our maintenance burden limited to platforms/toolchains we can support in a sustainable fashion).

If a project cannot use the generated CMake packages (which are fully supported) and instead need to rely on pkg-config, such projects need to maintain their own .pc file.

So while this is effectively a "Won't fix/do", I'll leave this open because it is valid within the context of the current code base.

@Conan-Kudo
Copy link
Contributor

This is also similar to #7972.

@PatTheMav
Copy link
Member

That is correct - having slept on it, I would prefer if we would ship handcrafted .pc files (right now only libobs ships with one, but obs-frontend-api does not, even though the latter is also optionally required for plugin development).

Those should also take optional static linking (Cflags.private) into account and required system libraries (or other dependencies provided via peg-config).

That way generator expressions from CMake should not leak into them and we could better take different architectures into account.

hufman added a commit to hufman/obs-studio that referenced this issue Dec 15, 2023
Non-x86 platforms use a generator expression to add a -fopenmp flag
so make sure to render this expression while writing out any pkgconfig file

Should fix obsproject#7972 and obsproject#7990
hufman added a commit to hufman/obs-studio that referenced this issue Dec 15, 2023
Non-x86 platforms use a generator expression to add the -fopenmp flag
so render this expression before writing out any pkgconfig file

Should fix obsproject#7972 and obsproject#7990
hufman added a commit to hufman/obs-studio that referenced this issue Dec 15, 2023
Non-x86 platforms use a generator expression to add the -fopenmp flag
so render this expression before writing out any pkgconfig file

Should fix obsproject#7972 and obsproject#7990
hufman added a commit to hufman/obs-studio that referenced this issue Dec 15, 2023
Non-x86 platforms use a generator expression to add the -fopenmp flag
so render this expression before writing out any pkgconfig file

Should fix obsproject#7972 and obsproject#7990
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants