Work around system(3) dropping DYLD_LIBRARY_PATH on macOS

...which caused `make translations` fail for me with

> [POT] pot.done
> dyld[96290]: Library not loaded: @__VIA_LIBRARY_PATH__/libuno_sal.dylib.3
>   Referenced from: <CD4F28D6-E3BE-3126-B861-C90BF3E14492> .../workdir/LinkTarget/Executable/cfgex
>   Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@__VIA_LIBRARY_PATH__/libuno_sal.dylib.3' (no such file), '/usr/local/lib/libuno_sal.dylib.3' (no such file), '/usr/lib/libuno_sal.dylib.3' (no such file, not in dyld cache)
> Error: Failed to execute .../workdir/LinkTarget/Executable/cfgex -i .../connectivity/registry/ado/org/openoffice/Office/DataAccess/Drivers.xcu -o .../workdir//pot/connectivity/registry/ado/org/openoffice/Office/DataAccess.pot

(This is the opposite case to 17cfd43e28 "Avoid
external processes picking up instdir/program/libxml2.so.2".  Here, the
executables called from Executable_localize are LO-internal executables that
need the libraries in instdir/.  There, the scripts called from
Executable_localize in turn only call external tools that shall not accidentally
pick up LO-internal libraries from instdir/.)

Change-Id: Ib1aa240ee47a21d14ec0463fee85bebe82453cee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143118
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2022-11-22 14:46:51 +01:00
parent 59e25927f4
commit 27eb23369f

View file

@ -109,6 +109,11 @@ void handleCommand(
}
else
{
#if defined MACOSX
if (auto const env = getenv("DYLD_LIBRARY_PATH")) {
buf.append(OString::Concat("DYLD_LIBRARY_PATH=") + env + " ");
}
#endif
auto const env = getenv("WORKDIR_FOR_BUILD");
assert(env != nullptr);
buf.append(env);