l10ntools/source/localize.cxx | 18 ++++++++++++++++-- solenv/gbuild/Module.mk | 1 + 2 files changed, 17 insertions(+), 2 deletions(-)
New commits: commit 17cfd43e28c45626b1e0990bd0e51fdc97409ebe Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sun Nov 20 17:39:27 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Mon Nov 21 16:45:02 2022 +0100 Avoid external processes picking up instdir/program/libxml2.so.2 ...which is a problem in ASan builds, as seen with a failing `make check`: > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > xgettext: symbol lookup error: .../instdir/program/libxml2.so.2: undefined symbol: __asan_init > Traceback (most recent call last): > File ".../solenv/bin/uiex", line 25, in <module> > input = check_output(["xgettext", "--add-comments", "--no-wrap", ifile, "-o", "-"], encoding="UTF-8") > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib64/python3.11/subprocess.py", line 465, in check_output > return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/usr/lib64/python3.11/subprocess.py", line 569, in run > raise CalledProcessError(retcode, process.args, > subprocess.CalledProcessError: Command '['xgettext', '--add-comments', '--no-wrap', '.../basctl/uiconfig/basicide/ui/basicmacrodialog.ui', '-o', '-']' returned non-zero exit status 127. > Error: Failed to execute .../solenv/bin/uiex -i .../basctl/uiconfig/basicide/ui/basicmacrodialog.ui -o .../workdir//pot/basctl/messages.pot The solution is similar to e854abe076155fc085b56549ced50b3ee9a095d2 "Avoid external processes picking up instdir/program/libnspr4.so" used in various tests. And as Executable_localize appears to only be called in that one place in the recipe of `make translations`, for simplicity make the library path override a required fourth argument for that executable. Change-Id: Ia6326ac0bb12ea75a8b3df51f7fbf12b88aca634 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142999 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx index 2ec0123616f4..c5ffd6d5c060 100644 --- a/l10ntools/source/localize.cxx +++ b/l10ntools/source/localize.cxx @@ -46,6 +46,8 @@ namespace { +OString libraryPathEnvVarOverride; + bool matchList( std::u16string_view rUrl, const std::u16string_view* pList, size_t nLength) { @@ -89,6 +91,17 @@ void handleCommand( OStringBuffer buf; if (rExecutable == "uiex" || rExecutable == "hrcex") { +#if !defined _WIN32 + // For now, this is only needed by some Linux ASan builds, so keep it simply and disable it + // on Windows (which doesn't support the relevant shell syntax for (un-)setting environment + // variables). + auto const n = libraryPathEnvVarOverride.indexOf('='); + if (n == -1) { + buf.append("unset -v " + libraryPathEnvVarOverride + " && "); + } else { + buf.append(libraryPathEnvVarOverride + " "); + } +#endif auto const env = getenv("SRC_ROOT"); assert(env != nullptr); buf.append(env); @@ -485,16 +498,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { try { - if (argc != 3) + if (argc != 4) { std::cerr << ("localize (c)2001 by Sun Microsystems\n\n" "As part of the L10N framework, localize extracts en-US\n" "strings for translation out of the toplevel modules defined\n" "in projects array in l10ntools/source/localize.cxx.\n\n" - "Syntax: localize <source-root> <outfile>\n"); + "Syntax: localize <source-root> <outfile> <library-path-env-var-override>\n"); exit(EXIT_FAILURE); } + libraryPathEnvVarOverride = argv[3]; handleProjects(argv[1],argv[2]); } catch (std::exception& e) diff --git a/solenv/gbuild/Module.mk b/solenv/gbuild/Module.mk index 347f1239e005..fe7470e85822 100644 --- a/solenv/gbuild/Module.mk +++ b/solenv/gbuild/Module.mk @@ -247,6 +247,7 @@ $(WORKDIR)/pot.done : $(foreach exec,cfgex helpex localize propex ulfex xrmex tr $(call gb_Trace_MakeMark,$(subst .pot,,$(subst $(WORKDIR)/,,$@)),POT) $(call gb_Helper_abbreviate_dirs,\ mkdir -p $(dir $@) && $(call gb_Helper_execute,localize) $(SRCDIR) $(dir $@)/pot \ + $(gb_Helper_LIBRARY_PATH_VAR)"$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$(gb_Helper_LIBRARY_PATH_VAR)}" \ && $(FIND) $(dir $@)/pot -type f -printf "%P\n" | sed -e "s/\.pot/.po/" | LC_ALL=C $(SORT) > $(dir $@)/LIST \ && touch $@)