> Thomas Frohwein writes:
>
>> On Tue, Apr 18, 2023 at 06:41:50PM -0700, Nam Nguyen wrote:
>> Do you have some details on this? Is this an upstream error, that
>> that --no-undefined is wrong when building the shared library? Or is
>> there something that might not be compiling or linking correctly?

Brad upstreamed a fix recently for removing --no-undefined, included in
this new diff.

see:
https://github.com/KhronosGroup/glslang/commit/9c7fd1a33e5cecbe465e1cd70170167d5e40d398

Here is a new inline diff that:
- backports Brad's fix for removing --no-undefined when building shared 
libraries
- builds shared libraries

naddy uncovered a build failure with emulators/flycast. I will have
details in the flycast email, but the proposed solution is to build
shared libraries in graphics/glslang so that flycast can use libSPIRV.so
and libglslang.so.0.0.

>>> +@so lib/libHLSL.so
>>> +@so lib/libSPIRV.so
>>> +@so lib/libSPVRemapper.so
>>> +@so lib/libglslang-default-resource-limits.so
>>> +@lib lib/libglslang.so.${LIBglslang_VERSION}

Having shared libraries without semantic versioning might be fine?
Upstream seems to only want to add semantic versioning to the main
library, libglslang.so.0.0.

see:
https://github.com/KhronosGroup/glslang/commit/fbe9a23baf2cb020fe3f80d68d972e2a97d9b954

I successfully tested all consumers (vulkan-tools, vkquake and piglit)
again.

OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/graphics/glslang/Makefile,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 Makefile
--- Makefile    10 Mar 2023 22:28:49 -0000      1.16
+++ Makefile    30 Apr 2023 03:18:50 -0000
@@ -5,7 +5,9 @@ COMMENT =       reference front-end for GLSL a
 GH_TAGNAME =   12.0.0
 GH_ACCOUNT =   KhronosGroup
 GH_PROJECT =   glslang
-REVISION =     0
+REVISION =     1
+
+SHARED_LIBS += glslang 0.0 # 12.0
 
 CATEGORIES =   devel graphics
 
@@ -24,6 +26,8 @@ MODULES =     devel/cmake \
                lang/python
 TEST_DEPENDS = graphics/spirv-tools \
                shells/bash
+
+CONFIGURE_ARGS +=      -DBUILD_SHARED_LIBS=ON
 
 do-test:
        cd ${WRKSRC}/Test; exec ./runtests localResults \
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-CMakeLists_txt        30 Apr 2023 03:18:50 -0000
@@ -0,0 +1,38 @@
+Fix building on OpenBSD when building shared libs
+
+OpenBSD does not link shared libs against libc so it is expected
+that the use of --no-undefined when linking will fail.
+
+Also garbage collect CMAKE_VERSION check while here, as requested, since
+the minimum version is already 3.14.
+
+see:
+https://github.com/KhronosGroup/glslang/commit/9c7fd1a33e5cecbe465e1cd70170167d5e40d398
+
+Index: CMakeLists.txt
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -171,10 +171,8 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
+         add_compile_options(-Werror=deprecated-copy)
+     endif()
+ 
+-    if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND NOT CMAKE_SYSTEM_NAME 
STREQUAL "Darwin")
++    if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" AND NOT CMAKE_SYSTEM_NAME 
STREQUAL "Darwin")
+         # Error if there's symbols that are not found at link time.
+-        # add_link_options() was added in CMake 3.13 - if using an earlier
+-        # version don't set this - it should be caught by presubmits anyway.
+         add_link_options("-Wl,--no-undefined")
+     endif()
+ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
+@@ -188,10 +186,8 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NO
+         add_compile_options(-fno-exceptions)
+     endif()
+ 
+-    if(NOT CMAKE_VERSION VERSION_LESS "3.13")
++    if(NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
+         # Error if there's symbols that are not found at link time.
+-        # add_link_options() was added in CMake 3.13 - if using an earlier
+-        # version don't set this - it should be caught by presubmits anyway.
+         if (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
+             add_link_options("-Wl,-undefined,error")
+         else()
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/graphics/glslang/pkg/PLIST,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 PLIST
--- pkg/PLIST   3 Mar 2023 02:38:37 -0000       1.6
+++ pkg/PLIST   30 Apr 2023 03:18:50 -0000
@@ -72,8 +72,6 @@ include/glslang/SPIRV/spvIR.h
 include/glslang/build_info.h
 lib/cmake/
 lib/cmake/HLSLTargets.cmake
-lib/cmake/OGLCompilerTargets.cmake
-lib/cmake/OSDependentTargets.cmake
 lib/cmake/SPIRVTargets.cmake
 lib/cmake/SPVRemapperTargets.cmake
 lib/cmake/glslang/
@@ -82,15 +80,10 @@ lib/cmake/glslang/glslang-config-version
 lib/cmake/glslang/glslang-config.cmake
 lib/cmake/glslang/glslang-targets${MODCMAKE_BUILD_SUFFIX}
 lib/cmake/glslang/glslang-targets.cmake
-lib/cmake/glslangTargets.cmake
 lib/cmake/glslangValidatorTargets.cmake
 lib/cmake/spirv-remapTargets.cmake
-@static-lib lib/libGenericCodeGen.a
-@static-lib lib/libHLSL.a
-@static-lib lib/libMachineIndependent.a
-@static-lib lib/libOGLCompiler.a
-@static-lib lib/libOSDependent.a
-@static-lib lib/libSPIRV.a
-@static-lib lib/libSPVRemapper.a
-@static-lib lib/libglslang-default-resource-limits.a
-@static-lib lib/libglslang.a
+@so lib/libHLSL.so
+@so lib/libSPIRV.so
+@so lib/libSPVRemapper.so
+@so lib/libglslang-default-resource-limits.so
+@lib lib/libglslang.so.${LIBglslang_VERSION}

Reply via email to