Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
@ 2024-01-22  6:51 Matthew White via ffmpeg-devel
  2024-01-22 12:17 ` Timo Rothenpieler
  2024-01-22 17:58 ` Lynne
  0 siblings, 2 replies; 9+ messages in thread
From: Matthew White via ffmpeg-devel @ 2024-01-22  6:51 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Matthew White


[-- Attachment #1.1: Type: text/plain, Size: 3820 bytes --]

Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
fully removed from the build.

This fixes the configuration by detecting if the stub libraries are
still present (glslang releases before version 14.0.0).

ffbuild/config.log:
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOSDependent: No such file or directory
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lHLSL: No such file or directory
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOGLCompiler: No such file or directory

Addresses https://trac.ffmpeg.org/ticket/10713
See https://bugs.gentoo.org/show_bug.cgi?id=918989
Should fix https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html

Signed-off-by: Matthew White <mehw.is.me@inventati.org>
---
 configure | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index c8ae0a061d..abff488dc0 100755
--- a/configure
+++ b/configure
@@ -2626,6 +2626,7 @@ CMDLINE_SET="
     ignore_tests
     install
     ld
+    libglslang_ldflags
     ln_s
     logfile
     malloc_prefix
@@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
     die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
 fi
 
+if enabled libglslang; then
+    if [ -x "$(command -v glslang)" ]; then
+        # https://github.com/KhronosGroup/glslang
+        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove `OGLCompiler` and `HLSL` stub libraries from build
+        # StandAlone/StandAlone.cpp: "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH GLSLANG_VERSION_FLAVOR"
+        glslang_version="$(glslang -dumpversion)"
+        glslang_major="${glslang_version%%.*}"
+        glslang_major="${glslang_major#*:}"
+        if test ${glslang_major} -le 13; then
+            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
+        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
+            die "ERROR: glslang's computed major version isn't a number: '${glslang_major}'"
+        fi
+    else
+        die "ERROR: glslang binary not found, impossible to determine installed glslang's version"
+    fi
+fi
+
 check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
 
 if ! disabled w32threads && ! enabled pthreads; then
@@ -6771,10 +6790,10 @@ enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.
 enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
 enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
 enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-                            -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
+                            -lglslang -lMachineIndependent "${libglslang_ldflags}" -lGenericCodeGen \
                             -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
                         require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
-                            -lglslang -lOSDependent -lHLSL -lOGLCompiler \
+                            -lglslang "${libglslang_ldflags}" \
                             -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
 enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
                                require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
-- 
2.43.0


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22  6:51 [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags Matthew White via ffmpeg-devel
@ 2024-01-22 12:17 ` Timo Rothenpieler
  2024-01-22 12:20   ` Martin Storsjö
  2024-01-22 14:10   ` Matthew White via ffmpeg-devel
  2024-01-22 17:58 ` Lynne
  1 sibling, 2 replies; 9+ messages in thread
From: Timo Rothenpieler @ 2024-01-22 12:17 UTC (permalink / raw)
  To: ffmpeg-devel

On 22/01/2024 07:51, Matthew White via ffmpeg-devel wrote:
> Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
> fully removed from the build.
> 
> This fixes the configuration by detecting if the stub libraries are
> still present (glslang releases before version 14.0.0).
> 
> ffbuild/config.log:
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOSDependent: No such file or directory
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lHLSL: No such file or directory
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOGLCompiler: No such file or directory
> 
> Addresses https://trac.ffmpeg.org/ticket/10713
> See https://bugs.gentoo.org/show_bug.cgi?id=918989
> Should fix https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html
> 
> Signed-off-by: Matthew White <mehw.is.me@inventati.org>
> ---
>   configure | 23 +++++++++++++++++++++--
>   1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/configure b/configure
> index c8ae0a061d..abff488dc0 100755
> --- a/configure
> +++ b/configure
> @@ -2626,6 +2626,7 @@ CMDLINE_SET="
>       ignore_tests
>       install
>       ld
> +    libglslang_ldflags
>       ln_s
>       logfile
>       malloc_prefix
> @@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
>       die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
>   fi
>   
> +if enabled libglslang; then
> +    if [ -x "$(command -v glslang)" ]; then
> +        # https://github.com/KhronosGroup/glslang
> +        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove `OGLCompiler` and `HLSL` stub libraries from build
> +        # StandAlone/StandAlone.cpp: "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH GLSLANG_VERSION_FLAVOR"
> +        glslang_version="$(glslang -dumpversion)"
> +        glslang_major="${glslang_version%%.*}"
> +        glslang_major="${glslang_major#*:}"
> +        if test ${glslang_major} -le 13; then
> +            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
> +        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
> +            die "ERROR: glslang's computed major version isn't a number: '${glslang_major}'"
> +        fi
> +    else
> +        die "ERROR: glslang binary not found, impossible to determine installed glslang's version"
> +    fi
> +fi
> +

Does that library really not have a sane pkg-config file?
This kind of guesswork in configure is extremely ugly.

>   check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
>   
>   if ! disabled w32threads && ! enabled pthreads; then
> @@ -6771,10 +6790,10 @@ enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.
>   enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
>   enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
>   enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
> -                            -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
> +                            -lglslang -lMachineIndependent "${libglslang_ldflags}" -lGenericCodeGen \
>                               -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
>                           require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
> -                            -lglslang -lOSDependent -lHLSL -lOGLCompiler \
> +                            -lglslang "${libglslang_ldflags}" \
>                               -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
>   enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
>                                  require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 12:17 ` Timo Rothenpieler
@ 2024-01-22 12:20   ` Martin Storsjö
  2024-01-22 14:34     ` Matthew White via ffmpeg-devel
  2024-01-22 14:10   ` Matthew White via ffmpeg-devel
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Storsjö @ 2024-01-22 12:20 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, 22 Jan 2024, Timo Rothenpieler wrote:

> On 22/01/2024 07:51, Matthew White via ffmpeg-devel wrote:
>> Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
>> fully removed from the build.
>> 
>> This fixes the configuration by detecting if the stub libraries are
>> still present (glslang releases before version 14.0.0).
>> 
>> ffbuild/config.log:
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: 
>> cannot find -lOSDependent: No such file or directory
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: 
>> cannot find -lHLSL: No such file or directory
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: 
>> cannot find -lOGLCompiler: No such file or directory
>> 
>> Addresses https://trac.ffmpeg.org/ticket/10713
>> See https://bugs.gentoo.org/show_bug.cgi?id=918989
>> Should fix 
>> https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html
>> 
>> Signed-off-by: Matthew White <mehw.is.me@inventati.org>
>> ---
>>   configure | 23 +++++++++++++++++++++--
>>   1 file changed, 21 insertions(+), 2 deletions(-)
>> 
>> diff --git a/configure b/configure
>> index c8ae0a061d..abff488dc0 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2626,6 +2626,7 @@ CMDLINE_SET="
>>       ignore_tests
>>       install
>>       ld
>> +    libglslang_ldflags
>>       ln_s
>>       logfile
>>       malloc_prefix
>> @@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
>>       die "ERROR: libshaderc and libglslang are mutually exclusive, if in 
>> doubt, disable libglslang"
>>   fi
>>   +if enabled libglslang; then
>> +    if [ -x "$(command -v glslang)" ]; then
>> +        # https://github.com/KhronosGroup/glslang
>> +        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove 
>> `OGLCompiler` and `HLSL` stub libraries from build
>> +        # StandAlone/StandAlone.cpp: 
>> "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH 
>> GLSLANG_VERSION_FLAVOR"
>> +        glslang_version="$(glslang -dumpversion)"
>> +        glslang_major="${glslang_version%%.*}"
>> +        glslang_major="${glslang_major#*:}"
>> +        if test ${glslang_major} -le 13; then
>> +            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
>> +        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
>> +            die "ERROR: glslang's computed major version isn't a number: 
>> '${glslang_major}'"
>> +        fi
>> +    else
>> +        die "ERROR: glslang binary not found, impossible to determine 
>> installed glslang's version"
>> +    fi
>> +fi
>> +
>
> Does that library really not have a sane pkg-config file?
> This kind of guesswork in configure is extremely ugly.

Also, how does this work when cross compiling - won't the "glslang" binary 
be for the foreign cross target? Or is it something like the sdl-config 
script which is a local shell script that can give relevant build flags (a 
design preceding pkg-config)?

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 12:17 ` Timo Rothenpieler
  2024-01-22 12:20   ` Martin Storsjö
@ 2024-01-22 14:10   ` Matthew White via ffmpeg-devel
  1 sibling, 0 replies; 9+ messages in thread
From: Matthew White via ffmpeg-devel @ 2024-01-22 14:10 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Matthew White

As far as I can tell, there're no pkg-config features in
https://github.com/KhronosGroup/glslang installation, at
least by installing it on my system, GNU/Linux Gentoo.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 12:20   ` Martin Storsjö
@ 2024-01-22 14:34     ` Matthew White via ffmpeg-devel
  0 siblings, 0 replies; 9+ messages in thread
From: Matthew White via ffmpeg-devel @ 2024-01-22 14:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Matthew White

> Also, how does this work when cross compiling - won't the "glslang" binary 
> be for the foreign cross target? Or is it something like the sdl-config 
> script which is a local shell script that can give relevant build flags (a 
> design preceding pkg-config)?

I don't have an answer to that, in FFmpeg's configure I saw using something like
`[ -x "$(command -v gzip)" ] && enable gzip`, so I replicated it to check on the
glslang's binary.  I guess that who is ready to cross compile may try this patch
with glslang installed to tell what's happening.

I worked on this fix in GNU/Linux Gentoo.  Trying both glslang 14.0.0 and 13.1.1
only the latter requires "-lOSDependent -lHLSL -lOGLCompiler".  I configured the
compilation with `./configure --enable-libglslang`, the stub flags/libraries are
not required for glslang 14.0.0.  I can compile FFmpeg 6.1.1 by backporting this
patch.

This patch may be dropped altogether by locking FFmpeg on glslang 14.0.0 and up,
and removing the stub "-lOSDependent -lHLSL -lOGLCompiler" flags/libraries.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22  6:51 [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags Matthew White via ffmpeg-devel
  2024-01-22 12:17 ` Timo Rothenpieler
@ 2024-01-22 17:58 ` Lynne
  2024-01-22 18:49   ` Matthew White via ffmpeg-devel
  2024-01-22 21:19   ` Martin Storsjö
  1 sibling, 2 replies; 9+ messages in thread
From: Lynne @ 2024-01-22 17:58 UTC (permalink / raw)
  To: Matthew White via ffmpeg-devel

Jan 22, 2024, 07:52 by ffmpeg-devel@ffmpeg.org:

> Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
> fully removed from the build.
>
> This fixes the configuration by detecting if the stub libraries are
> still present (glslang releases before version 14.0.0).
>
> ffbuild/config.log:
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOSDependent: No such file or directory
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lHLSL: No such file or directory
> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOGLCompiler: No such file or directory
>
> Addresses https://trac.ffmpeg.org/ticket/10713
> See https://bugs.gentoo.org/show_bug.cgi?id=918989
> Should fix https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html
>
> Signed-off-by: Matthew White <mehw.is.me@inventati.org>
> ---
> configure | 23 +++++++++++++++++++++--
> 1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index c8ae0a061d..abff488dc0 100755
> --- a/configure
> +++ b/configure
> @@ -2626,6 +2626,7 @@ CMDLINE_SET="
> ignore_tests
> install
> ld
> +    libglslang_ldflags
> ln_s
> logfile
> malloc_prefix
> @@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
> die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
> fi
>
> +if enabled libglslang; then
> +    if [ -x "$(command -v glslang)" ]; then
> +        # https://github.com/KhronosGroup/glslang
> +        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove `OGLCompiler` and `HLSL` stub libraries from build
> +        # StandAlone/StandAlone.cpp: "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH GLSLANG_VERSION_FLAVOR"
> +        glslang_version="$(glslang -dumpversion)"
> +        glslang_major="${glslang_version%%.*}"
> +        glslang_major="${glslang_major#*:}"
> +        if test ${glslang_major} -le 13; then
> +            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
> +        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
> +            die "ERROR: glslang's computed major version isn't a number: '${glslang_major}'"
> +        fi
> +    else
> +        die "ERROR: glslang binary not found, impossible to determine installed glslang's version"
> +    fi
> +fi
> +
> check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
>
> if ! disabled w32threads && ! enabled pthreads; then
> @@ -6771,10 +6790,10 @@ enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.
> enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
> enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
> enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
> -                            -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
> +                            -lglslang -lMachineIndependent "${libglslang_ldflags}" -lGenericCodeGen \
> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
> require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
> -                            -lglslang -lOSDependent -lHLSL -lOGLCompiler \
> +                            -lglslang "${libglslang_ldflags}" \
> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
> enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
> require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
> --
> 2.43.0
>

This is very very cursed. Fitting for the public API of the world's fifth worst library.
Debian is stuck on version 13, so the majority of users are still stuck on version 13.
Debian ships a pkg-config file, but of course it's incorrect, if you try to compile against it.
Oh, and libshaderc in Debian ships with a bug such that it segfaults on init, so it's
not like you can avoid that. And that package's pkg-config file got broken in the past.

I think this is fine for now. I'll let it be discussed for a few more days before merging it.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 17:58 ` Lynne
@ 2024-01-22 18:49   ` Matthew White via ffmpeg-devel
  2024-01-22 21:19   ` Martin Storsjö
  1 sibling, 0 replies; 9+ messages in thread
From: Matthew White via ffmpeg-devel @ 2024-01-22 18:49 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Matthew White

> This is very very cursed. Fitting for the public API of the world's fifth worst library.
> Debian is stuck on version 13, so the majority of users are still stuck on version 13.
> Debian ships a pkg-config file, but of course it's incorrect, if you try to compile against it.
> Oh, and libshaderc in Debian ships with a bug such that it segfaults on init, so it's
> not like you can avoid that. And that package's pkg-config file got broken in the past.
> 
> I think this is fine for now. I'll let it be discussed for a few more days before merging it.

Thanks for explaining.

By the way, the patch of mine is just a quick fix to not break the FFmpeg's configuration
process when enabling glslang, `./configure --enable-libglslang`, while either libglslang
up to release 13.1.1 or since 14.0.0 is installed in the system.

Accepting only glslang version 14.0.0 and above (--enable-libglslang) will obsolete this
patch: stub flags/libraries "-lOSDependent -lHLSL -lOGLCompiler" may just be dropped.

If useful, this patch is trivial even to backport, I am currently applying it to v6.1.1.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 17:58 ` Lynne
  2024-01-22 18:49   ` Matthew White via ffmpeg-devel
@ 2024-01-22 21:19   ` Martin Storsjö
  2024-01-31 16:00     ` Lynne
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Storsjö @ 2024-01-22 21:19 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Mon, 22 Jan 2024, Lynne wrote:

> Jan 22, 2024, 07:52 by ffmpeg-devel@ffmpeg.org:
>
>> Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
>> fully removed from the build.
>>
>> This fixes the configuration by detecting if the stub libraries are
>> still present (glslang releases before version 14.0.0).
>>
>> ffbuild/config.log:
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOSDependent: No such file or directory
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lHLSL: No such file or directory
>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOGLCompiler: No such file or directory
>>
>> Addresses https://trac.ffmpeg.org/ticket/10713
>> See https://bugs.gentoo.org/show_bug.cgi?id=918989
>> Should fix https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html
>>
>> Signed-off-by: Matthew White <mehw.is.me@inventati.org>
>> ---
>> configure | 23 +++++++++++++++++++++--
>> 1 file changed, 21 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure b/configure
>> index c8ae0a061d..abff488dc0 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2626,6 +2626,7 @@ CMDLINE_SET="
>> ignore_tests
>> install
>> ld
>> +    libglslang_ldflags
>> ln_s
>> logfile
>> malloc_prefix
>> @@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
>> die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
>> fi
>>
>> +if enabled libglslang; then
>> +    if [ -x "$(command -v glslang)" ]; then
>> +        # https://github.com/KhronosGroup/glslang
>> +        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove `OGLCompiler` and `HLSL` stub libraries from build
>> +        # StandAlone/StandAlone.cpp: "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH GLSLANG_VERSION_FLAVOR"
>> +        glslang_version="$(glslang -dumpversion)"
>> +        glslang_major="${glslang_version%%.*}"
>> +        glslang_major="${glslang_major#*:}"
>> +        if test ${glslang_major} -le 13; then
>> +            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
>> +        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
>> +            die "ERROR: glslang's computed major version isn't a number: '${glslang_major}'"
>> +        fi
>> +    else
>> +        die "ERROR: glslang binary not found, impossible to determine installed glslang's version"
>> +    fi
>> +fi
>> +
>> check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
>>
>> if ! disabled w32threads && ! enabled pthreads; then
>> @@ -6771,10 +6790,10 @@ enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.
>> enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
>> enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
>> enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
>> -                            -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
>> +                            -lglslang -lMachineIndependent "${libglslang_ldflags}" -lGenericCodeGen \
>> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
>> require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
>> -                            -lglslang -lOSDependent -lHLSL -lOGLCompiler \
>> +                            -lglslang "${libglslang_ldflags}" \
>> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
>> enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
>> require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
>> --
>> 2.43.0
>>
>
> This is very very cursed. Fitting for the public API of the world's 
> fifth worst library. Debian is stuck on version 13, so the majority of 
> users are still stuck on version 13. Debian ships a pkg-config file, but 
> of course it's incorrect, if you try to compile against it. Oh, and 
> libshaderc in Debian ships with a bug such that it segfaults on init, so 
> it's not like you can avoid that. And that package's pkg-config file got 
> broken in the past.
>
> I think this is fine for now. I'll let it be discussed for a few more 
> days before merging it.

I think breaking cross compilation with glslang is pretty bad. Apparently 
VLC doesn't enable glslang in their ffmpeg builds though, but I would 
expect that some does.

Wouldn't it just be possible to test whether linkins succeeds with one set 
of libraries, and if not, try with the other set, and pick whichever set 
works with the library at hand? That would be way much simpler than this 
patch, and also work for cross compilation.

// Martin

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags
  2024-01-22 21:19   ` Martin Storsjö
@ 2024-01-31 16:00     ` Lynne
  0 siblings, 0 replies; 9+ messages in thread
From: Lynne @ 2024-01-31 16:00 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Jan 22, 2024, 22:19 by martin@martin.st:

> On Mon, 22 Jan 2024, Lynne wrote:
>
>> Jan 22, 2024, 07:52 by ffmpeg-devel@ffmpeg.org:
>>
>>> Since glslang 14.0.0, OGLCompiler and HLSL stub libraries have been
>>> fully removed from the build.
>>>
>>> This fixes the configuration by detecting if the stub libraries are
>>> still present (glslang releases before version 14.0.0).
>>>
>>> ffbuild/config.log:
>>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOSDependent: No such file or directory
>>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lHLSL: No such file or directory
>>> /usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lOGLCompiler: No such file or directory
>>>
>>> Addresses https://trac.ffmpeg.org/ticket/10713
>>> See https://bugs.gentoo.org/show_bug.cgi?id=918989
>>> Should fix https://ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313666.html
>>>
>>> Signed-off-by: Matthew White <mehw.is.me@inventati.org>
>>> ---
>>> configure | 23 +++++++++++++++++++++--
>>> 1 file changed, 21 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/configure b/configure
>>> index c8ae0a061d..abff488dc0 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -2626,6 +2626,7 @@ CMDLINE_SET="
>>> ignore_tests
>>> install
>>> ld
>>> +    libglslang_ldflags
>>> ln_s
>>> logfile
>>> malloc_prefix
>>> @@ -6652,6 +6653,24 @@ if enabled_all libglslang libshaderc; then
>>> die "ERROR: libshaderc and libglslang are mutually exclusive, if in doubt, disable libglslang"
>>> fi
>>>
>>> +if enabled libglslang; then
>>> +    if [ -x "$(command -v glslang)" ]; then
>>> +        # https://github.com/KhronosGroup/glslang
>>> +        # commit 6be56e45e574b375d759b89dad35f780bbd4792f: Remove `OGLCompiler` and `HLSL` stub libraries from build
>>> +        # StandAlone/StandAlone.cpp: "SpirvGeneratorVersion:GLSLANG_VERSION_MAJOR.GLSLANG_VERSION_MINOR.GLSLANG_VERSION_PATCH GLSLANG_VERSION_FLAVOR"
>>> +        glslang_version="$(glslang -dumpversion)"
>>> +        glslang_major="${glslang_version%%.*}"
>>> +        glslang_major="${glslang_major#*:}"
>>> +        if test ${glslang_major} -le 13; then
>>> +            libglslang_ldflags=" -lOSDependent -lHLSL -lOGLCompiler"
>>> +        elif ! [[ ${glslang_major} =~ ^[0-9]+$ ]]; then
>>> +            die "ERROR: glslang's computed major version isn't a number: '${glslang_major}'"
>>> +        fi
>>> +    else
>>> +        die "ERROR: glslang binary not found, impossible to determine installed glslang's version"
>>> +    fi
>>> +fi
>>> +
>>> check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
>>>
>>> if ! disabled w32threads && ! enabled pthreads; then
>>> @@ -6771,10 +6790,10 @@ enabled libfreetype       && require_pkg_config libfreetype freetype2 "ft2build.
>>> enabled libfribidi        && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
>>> enabled libharfbuzz       && require_pkg_config libharfbuzz harfbuzz hb.h hb_buffer_create
>>> enabled libglslang && { check_lib spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
>>> -                            -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen \
>>> +                            -lglslang -lMachineIndependent "${libglslang_ldflags}" -lGenericCodeGen \
>>> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm ||
>>> require spirv_compiler glslang/Include/glslang_c_interface.h glslang_initialize_process \
>>> -                            -lglslang -lOSDependent -lHLSL -lOGLCompiler \
>>> +                            -lglslang "${libglslang_ldflags}" \
>>> -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++ -lm; }
>>> enabled libgme            && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
>>> require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
>>> --
>>> 2.43.0
>>>
>>
>> This is very very cursed. Fitting for the public API of the world's fifth worst library. Debian is stuck on version 13, so the majority of users are still stuck on version 13. Debian ships a pkg-config file, but of course it's incorrect, if you try to compile against it. Oh, and libshaderc in Debian ships with a bug such that it segfaults on init, so it's not like you can avoid that. And that package's pkg-config file got broken in the past.
>>
>> I think this is fine for now. I'll let it be discussed for a few more days before merging it.
>>
>
> I think breaking cross compilation with glslang is pretty bad. Apparently VLC doesn't enable glslang in their ffmpeg builds though, but I would expect that some does.
>
> Wouldn't it just be possible to test whether linkins succeeds with one set of libraries, and if not, try with the other set, and pick whichever set works with the library at hand? That would be way much simpler than this patch, and also work for cross compilation.
>

Debian has updated its version of glslang, so I'm more inclined
to just depend on version 14 and hope the next time they break the
API happens in less than a year, or however much that is in hours for them.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-01-31 16:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-22  6:51 [FFmpeg-devel] [PATCH] configure: autodetect libglslang ldflags Matthew White via ffmpeg-devel
2024-01-22 12:17 ` Timo Rothenpieler
2024-01-22 12:20   ` Martin Storsjö
2024-01-22 14:34     ` Matthew White via ffmpeg-devel
2024-01-22 14:10   ` Matthew White via ffmpeg-devel
2024-01-22 17:58 ` Lynne
2024-01-22 18:49   ` Matthew White via ffmpeg-devel
2024-01-22 21:19   ` Martin Storsjö
2024-01-31 16:00     ` Lynne

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git