Commit Graph

6 Commits

Author SHA1 Message Date
Lucian Petrut
750a9483d1 common: Windows Unicode CLI support
Windows CLI arguments use either ANSI (main()) or UTF-16 (wmain()).
Meanwhile, Ceph libraries expect UTF-8 and raise exceptions when
trying to use Unicode CLI arguments or log Unicode output:

  rbd.exe create test_unicode_șțăâ --size=32M
  terminate called after throwing an instance of 'std::runtime_error'
    what():  invalid utf8

We'll use a Windows application manifest, setting the "activeCodePage"
property [1][2]. This enables the Windows UCRT UTF-8 mode so that
functions that receive char* arguments will expect UTF-8 instead of ANSI,
including main(). One exception is CreateProcess, which will need the
UTF-16 form (CreateProcessW).

Despite the locale being set to utf-8, we'll have to explicitly set
the console output to utf-8 using SetConsoleOutputCP(CP_UTF8).

In order to use the UTF-8 locale, we'll have to switch the mingw-llvm
runtime from msvcrt to ucrt.

This also fixes ceph-dokan crashes that currently occur when non-ANSI
paths are logged.

[1] https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests#activecodepage
[2] https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-11-22 09:14:49 +00:00
Lucian Petrut
4ec8e9938b win32_build.sh: use ENABLE_SHARED=ON by default
The Windows build script uses static linking by default, the
reason being that some tests were failing to build otherwise,
mostly due to unspecified dependencies.

Now that the issue was addressed, we can enable dynamic linking
by default.

Worth mentioning that the Ceph MSI build script already uses
dynamic linking.

While at it, we'll drop some duplicate defaults from
"win32_deps_build.sh". For better clarity, we'll avoid exporting
some "win32_build.sh" variables, instead passing them explicitly
to "win32_deps_build.sh".

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-09-06 11:17:16 +00:00
Lucian Petrut
3ce1e4a5c6 win32_build.sh: mingw-llvm support
winpthreads is a library that emulates the pthreads API using
Windows primitives. It's also used by the mingw/gcc libstdc++
for std::thread.

The issue is that winpthreads isn't well maintained. There
have been numerous bugs that haven't been addressed in years.
Specifically, we've been hitting deadlocks because of the
winpthreads rw lock implementation.

This change will allow building Ceph for Windows using mingw/llvm,
which uses libc++ and doesn't rely on winpthreads.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-08-30 12:59:00 +00:00
Ken Dreyer
4954fe19e5 win32: add rhel option
Add an option for building the Windows client on RHEL. I've tested this
on RHEL 9.

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
2022-09-27 11:21:18 -04:00
Lucian Petrut
1c426e96b0 win32*.sh: move debug symbols to separate files
This patch simplifies releasing Windows binaries along with debug
symbols.

By default, we're going to provide minimum debug information (-g1).
The symbols are extracted from the binaries and placed in separate
files in the ".debug" folder, which is used by gdb implicitly.

This is more convenient than having separate versions of the binaries,
with or without debug symbols.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-02-03 12:07:41 +00:00
Mike Latimer
f42e947a85 cmake,win32*.sh: Add OS=(ubuntu|suse) flag, for distro settings
Distributions such as SUSE and Ubuntu differ significantly in their mingw
environments. This adds an OS=(ubuntu|suse) flag, which can be used to
specify which environment is being used for the build. Unless set explicitly,
the scripts will try to automatically detect it.

Depending on the OS selected, various mingw configuration options (binaries,
library paths, etc.) as well as required packages are determined.

Due to these options being configured at runtime, corresponding cmake
files are generated on the fly.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
2020-12-09 18:01:02 +00:00