[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gettext-tools: disabling thread safety on Windows?
From: |
Bruno Haible |
Subject: |
Re: gettext-tools: disabling thread safety on Windows? |
Date: |
Thu, 03 Oct 2024 13:43:38 +0200 |
Hi Michele,
> When building gettext for Windows in "shared" mode, I noticed that
> xgettext depends on libstdc++-6.dll because it uses its two functions
> __cxa_guard_acquire and __cxa_guard_release.
>
> So, since libstdc++-6.dll requires libgcc_s_seh-1.dll and
> libwinpthread-1.dll, I have to distribute these 3 libraries because of
> those 2 functions.
Oh. Indeed, libwinpthread should be avoided, because it is of lower quality
than the rest of mingw.
> I've been told ([1]) that those 2 functions are used because of thread
> safety initialization.
>
> So, I tried to configure gettext with --disable-threads, but that was
> not enough: I've had to add -fno-threadsafe-statics to CXXFLAGS too
> (compare the "Process dependencies" step of [2] vs previous builds).
>
> So, the question is: is this an acceptable approach or can it have bad
> consequences? Will xgettext be much slower?
> From a quick check on the xgettext code, it seems that muti-threading
> is only used to call setocale (but of course I may be wrong): I know
> that setlocale is slow on posix, but I'm not sure on Windows...
The only program in GNU gettext that uses multithreading is msgmerge.
And indeed, without multithreading, msgmerge is much slower. So,
I wouldn't recommend --disable-threads for the entire package.
But for the other programs, including xgettext, there is no issue.
So, you can add fno-threadsafe-statics to xgettext_CXXFLAGS without
problem.
Bruno