darlinghq / darling

Darwin/macOS emulation layer for Linux
http://www.darlinghq.org
GNU General Public License v3.0
11.4k stars 440 forks source link

darling build fails to find libpng.so for wrapping #1523

Open MagicalTux opened 3 months ago

MagicalTux commented 3 months ago

Build Log What is the build error?

cd /build/darling-0.1.20240614/temp/src/native && /build/darling-0.1.20240614/temp/src/libelfloader/wrapgen/wrapgen libpng.so /build/darling-0.1.20240614/temp/src/native/png.c /build/darling-0.1.20240614/temp/src/native/png_vars.h
Cannot load libpng.so: libpng.so: cannot open shared object file: No such file or directory

After some research it seems that when libpng.so isn't installed in a standard location it won't be found by wrapgen. The reason is that ld.so.cache contains entries for libpng16.so but not libpng.so.

There are multiple ways this error can be fixed:

Implementing any of those three options would solve this issue for me. Implementing the first solution is just replacing libpng with libpng16, this will also ensure that if libpng18 is released nothing breaks with mysterious segfaults.

System Information What system are you building with?

Software Version
Clang 18.1.1
CMake 3.28.3
Linux Kernel 6.6.30
Darling 203af1f604727e13032df1870e3491572e7d6704
MagicalTux commented 3 months ago

Confirming build works now for me with:

sed -i 's/libpng.so/libpng16.so/' src/native/CMakeLists.txt