This glslang diff is no longer necessary. I'll build flycast so that it
bundles glslang, which it does by default. This will make it easier to
review. The rest of the email can be skipped, but I reported some
findings inline.

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?
>

While trying to compile libglslang-default-resource-limits.so, it
complains about functions like strlen, memcpy, atoi, etc. It seems like
ld.lld(1) defaults to --allow-shlib-undefined by default, so it's fine
to have shared libraries with undefined symbols. Your suggested ifndef
BUILD_SHARED_LIBS could be used here.

--8<---------------cut here---------------start------------->8---
[28/48] : && /usr/obj/pobj/glslang-12.0.0/bin/c++ -fPIC -O2 -pipe -DNDEBUG  
-Wl,--no-undefined -shared -Wl,-soname,libglslang-default-resource-limits.so -o 
StandAlone/libglslang-default-resource-limits.so 
StandAlone/CMakeFiles/glslang-defa
FAILED: StandAlone/libglslang-default-resource-limits.so
: && /usr/obj/pobj/glslang-12.0.0/bin/c++ -fPIC -O2 -pipe -DNDEBUG  
-Wl,--no-undefined -shared -Wl,-soname,libglslang-default-resource-limits.so -o 
StandAlone/libglslang-default-resource-limits.so 
StandAlone/CMakeFiles/glslang-default-reso
ld: error: undefined symbol: strlen
>>> referenced by ResourceLimits.cpp
>>>               
>>> StandAlone/CMakeFiles/glslang-default-resource-limits.dir/ResourceLimits.cpp.o:(DecodeResourceLimits(TBuiltInResource*,
>>>  char*))

similar for memcpy and atoi
--8<---------------cut here---------------end--------------->8---

>> ok?
>
> Still ok thfr@ as this doesn't break anything existing and apparently
> enables flycast, but it would be good to think about the above and if
> upstream got this wrong, then let's think about a diff with something
> like
>
> #ifndef BUILD_BUILD_LIBS
> ...
> #endif

>> +@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}

I found another mistake with my diff's shared libs. It would have
installed these .so files missing major.minor numbers into
/usr/local/lib. I would have had to figure out how to use libHLSL.so as
libHLSL.so.0.0.

It would cause more maintenance for graphics/glslang. It probably is not
worth it, since flycast can use its bundled glslang for now.

Reply via email to