Commit Graph

36 Commits

Author SHA1 Message Date
Casey Bodley
ec2e4b62a9 build/win32: disable qat options
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2024-02-07 11:13:21 -05: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
ec4a2778f6 cmake: fix mingw-llvm shared linking
mingw-llvm can't handle the '--exclude-libs' linker flag, so
we'll have to skip it.

At the same time, cmake can't locate the boost shared libs as the
import libs are not generated when using mingw-llvm due to boost's
clang-linux.jam file. For now, we'll patch the cmake files, using
the dlls as import libs (which is allowed by mingw).

While at it, we'll avoid linking the static AND dynamic boost libs,
speeding the build.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-08-30 12:59:00 +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
Lucian Petrut
936252524e cmake: avoid duplicate symbols
Some symbols from the crc32, arch and fmt libs
are re-exported by libceph-common:

  FAILED: bin/unittest_time.exe
  ld.lld: error: fmt::v9::format_error::~format_error() was replaced

llvm throws errors because of the duplicate symbols.
One workaround is to use objects instead of static libs
for the libs. For libfmt we'll use the header-only version.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-08-30 12:59:00 +00:00
Lucian Petrut
9de2d0949d win32_build.sh: build "ceph_test*"
At the moment, win32_build.sh builds the "tests" target, which
only includes the "unittest_*" tests.

We'll update the build script to include "ceph_test_*" targets
as well.

Note that we can't just build all the targets that were generated
by cmake since some of them are unavailable on Windows. When
doing the Windows port, we decided to avoid polluting the Cmake
files and keep the amount of Windows checks to a minimum.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2023-02-17 10:42:40 +00:00
Ken Dreyer
c7838a6dd1 cmake: add -fstack-protector-strong on win32
mingw on RHEL 9 needs -fstack-protector (which adds -lssp), or it fails
with these errors:

  undefined reference to `__stack_chk_fail'
  undefined reference to `__stack_chk_guard'
  undefined reference to `__strcpy_chk'

Commit 8d35b2ecea mentions that the build
fails with -fstack-protector-strong. Perhaps that only applied to
earlier Ubuntu versions, because Ubuntu Focal can build with
-fstack-protector-strong now.

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
2022-09-27 11:21:18 -04: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
Ken Dreyer
32863d92c4 win32: parse /etc/os-release on all distros
Standardize the way that we determine Ubuntu and SUSE.

This aligns with what we do in install-deps.sh and makes it simpler to
add more distributions later.

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
2022-09-27 11:21:18 -04:00
Ken Dreyer
bacbfccb20 win32: remove libcurl
The Windows client does not use libcurl for anything. Remove it to
simplify the build process.

Note, if we ever add libcurl back on Windows, we should disable unused
protocols to harden the build:

  --disable-ftp --disable-ldap --disable-ldaps --disable-rtsp \
  --disable-dict --disable-telnet --disable-tftp --disable-pop3 \
  --disable-imap --disable-smb --disable-smtp --disable-gopher \
  --disable-mqtt --disable-manual --disable-ntlm

Signed-off-by: Ken Dreyer <kdreyer@redhat.com>
2022-09-16 14:30:39 -04:00
Deepika Upadhyay
29ddad923f win32_build: do not build jaeger for windows, disable cmake option
Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
2022-05-17 04:38:01 -04:00
Lucian Petrut
0af38d179e win*.sh,cmake: Fix Windows linking errors
The Windows build is hitting linking errors after
bumping the Boost version to 1.75. The issue is that Boost
is now setting the zlib dependecy using INTERFACE_LINK_LIBRARIES,
which means that it's no longer located using the standard
"find_package" mechanism.

In order for the linker to locate zlib, we'll add it to the
linker search path.

[1] https://github.com/boostorg/boost_install/issues/47

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-05-07 09:23:30 +00:00
Lucian Petrut
c6404e15cb win32*.sh: ensure that the build dir exists
The Windows build scripts try to use the build dir before
actually creating it.

We'll have to move up the "mkdir" command a few lines.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-05-07 07:20:05 +00:00
Lucian Petrut
9cad7db13a win32*.sh: improve logging
We'll use a log file when building the Ceph dependencies. Also, we'll
log some details about the operation that's about to be performed.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-05-06 07:42:12 +00:00
Lucian Petrut
03f1dabaea win32*.sh: disable libcephsqlite when targeting Windows
The Windows build is failing as sqlite can't be retrieved:
http://paste.openstack.org/raw/803940/

We don't support libcephsqlite on Windows for the time being,
so we'll just pass WITH_LIBCEPHSQLITE=OFF.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-03-26 08:18:10 +00:00
Lucian Petrut
c2896329ce win32*.sh: use the right target when building the tests
We switched from make to ninja but we're using the wrong target
when building the tests.

"ninja test" tries to actually run the tests. We'll have to use
"ninja tests" when targeting Windows.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-03-17 07:03:19 +00:00
Lucian Petrut
fca903f6d6 win32*.sh: use ninja instead of make
In order to avoid overcomplicating the ceph cmake files, we're
picking make targets individually.

This is quite inefficient. Ninja can improve the build concurrency,
reducing the build duration by almost 50%.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-03-05 13:15:51 +00:00
Lucian Petrut
af6b37364b cephfs: Add ceph-dokan, providing Windows support
In order to expose ceph filesystems to Windows hosts, we propose
including ceph-dokan[1][2] in the Ceph tree, while updating it to
work with the latest CephFS and Dokany APIs.

Dokany is a well maintained project (fork of the original Dokan
project), allowing filesystems to be implemented in userspace,
even providing a Fuse compatibility layer.

One reason for not using the FUSE compatibility layer is that it's
only covering the high level API while Ceph is using the low level
FUSE API, which among other things is inode centric.

Changes made by this patch compared to the upstream ceph-dokan:

* support latest stable Dokany API. The upstream version relies on
  the legacy unmaintained Dokan API
* return proper error codes, converting standard errno.h values to
  NTSTATUS
* minor changes to support latest cephfs API
* drop duplicated ceph code, no longer needed if we're to include it
  in tree. This makes it much easier to maintain.
* drop redundant permission checks, leaving it up to libcephfs
* use ceph argparse helpers
* use ceph logging and daemon initialization
* fixed unicode handling
* switched to ceph coding style
* made ceph.conf param optional, using the default path if available
* enabled setting file timestamps
* append support
* configurable timeouts set once per mount
* ensure that the error code is always logged
* various cleanups (removed unused entry points, checks that have
  been moved to dokany, simplified conditional statements,
  unnecessary conversions in the hot path, etc).

[1] https://github.com/ketor/ceph-dokan
[2] https://github.com/ceph/ceph-dokan

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-03-05 13:13:31 +00: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
Lucian Petrut
5c008725db cmake,win32*.sh: Windows DLL support
At the moment, the Windows binaries can only be linked statically.
This is less than ideal since:

* the resulting binaries can be quite large, especially when
including debug symbols
* librados and librbd cannot be used directly by 3rd party apps
* the build duration is increased

In order to do a dynamic build, we'll:

* add an option to win32_build.sh
* fix link order
* dynamically link boost
* disable the "-pie" flag when using Mingw, which generates incorrect
  executable entry points
* by default, cmake generates import libs for executables. The issue
  is that for rados.exe, it generates librados.dll.a, thus overriding
  the librados.dll import library, which breaks the build process.
  We'll configure cmake to skip generating import libs for executables.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-01-26 08:41:51 +00:00
Patrick Donnelly
96934109fb
Merge PR #34858 into master
* refs/pull/34858/head:
	mds: do not allow the service to run on Windows
	win32*.sh: fix SKIP_TESTS flag
	include/win32/win32_errno:h Add missing include
	client: Port CephFS client to Windows

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
2021-01-14 08:09:01 -08:00
Lucian Petrut
a9b322b385 win32*.sh: fix SKIP_TESTS flag
The "SKIP_TESTS" flag used by the Windows build script is
currently ignored.

This patch will skip some of the make targets when "SKIP_TESTS"
is set.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-01-13 10:38:33 +00:00
Lucian Petrut
67a35a582c test: Update cmake files, allowing tests to run on Windows
We're porting to Windows some of the unit tests, mostly related to
rados and rbd.

This change filters out the tests that aren't supported on Windows.
At the same time, we're defining some missing dependencies since
unlike ELFs SOs, all DLL symbols have to be resolved at compile time.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2021-01-05 14:56:11 +02:00
Lucian Petrut
b8216c3bc1 win32*.sh: improve lib handling
When building dependencies, we assume that libs will be placed in the
"lib" dir. Still, some distros might use "lib64" by default.

For this reason, we'll explicitly pass the expected lib path.

At the same time, we're dropping an unnecessary lib copy.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-12-09 18:01:02 +00:00
Mike Latimer
3af4eea986 win32*.sh: Strip binaries individually
Instead of copying over a rather large directory, strip symbols off
of files individually.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
2020-12-09 18:01:02 +00:00
Mike Latimer
8e84b00e61 win32*.sh: Cleanup zip archive creation
Use a temporary directory and symlinks to create the final zip archive
within a single 'ceph' parent directory. Also include the win32 README,
and report the name of the resulting zip file.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
Signed-off-by: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-12-09 18:01:02 +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
Mike Latimer
6c57f6b2c2 win32*.sh: Use nproc for CPU count when targeting win32
When building in chroot jail, /proc/cpuinfo may not be available. Switch to
nproc which should be widely available, and does not rely on /proc/cpuinfo.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
2020-12-09 18:01:02 +00:00
Mike Latimer
ae812dce44 win32*.sh: improve win32 dependency check
At the moment, we assume that the dependencies have been successfully
built if the "build.deps" directory exists.

For convenience reasons, this change will use a file instead,
signaling that we've finished building the dependencies. This will
allow the build process to be resumed when interrupted.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-12-09 18:01:02 +00:00
Mike Latimer
451fe3dc49 win32*.sh: isolate network operations when building win32 dependencies
We'll move network operations (git/wget/curl) under a conditional
check of the source directory.

This will ensure that the script is idempotent and that network
operations can be avoided, using pre-existing sources if available.

Signed-off-by: Mike Latimer <mlatimer@suse.com>
Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-12-09 18:01:02 +00:00
Lucian Petrut
4dd38e29c8 win32*.sh: cleanup Windows build script
Since the switch to Python 3, a few Cmake flags are no longer required.
While at it, we're dropping a few other unused Cmake flags.

We're going to pass the right target os flag when building lz4
and make sure that it's included in our zip archive.

win32_deps_build.sh needs a small change, fixing a sed command to become
idempotent.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Mike Latimer <mlatimer@suse.com>
2020-12-09 18:01:02 +00:00
Lucian Petrut
61999ec168 win32*.sh: update Windows build scripts and readme
We're going to allow building a zip containing stripped binaries
and skipping the ceph tests. We'll use a separate option rather
than changing the build type so that may generate binaries
containing debug symbols as well as stripped binaries in one shot.

While at it, we're updating the Windows readme.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Mike Latimer <mlatimer@suse.com>
2020-12-09 18:01:02 +00:00
Lucian Petrut
4af1ae2093 rbd: allow mounting images on Windows
This change will allow mapping rbd images on Windows, leveraging the
WNBD[1] Virtual Storport Miniport driver [2].

The behavior and CLI is similar to the Linux rbd-nbd, with a few
notable differences:

* device paths cannot be requested. The disk number and path will
  be picked by Windows. If a device path is provided by the user
  when mapping an image, it will be used as an identifier, which
  can also be used when unmapping the image.
* the "show" command was added, which describes a specific mapping.
  This can be used for retrieving the disk path.
* the "service" command was added, allowing rbd-wnbd to run as a
  Windows service. All mappings are currently perisistent, being
  recreated when the service stops, unless explicitly unmapped.
  The service disconnects the mappings when being stopped.
* the "list" command also includes a "status" column.

The purpose of the "service" mode is to ensure that mappings survive
reboots and that the Windows service start order can be adjusted so
that rbd images can be mapped before starting services that may depend
on it, such as VMMS.

The mapped images can either be consumed by the host directly or exposed
to Hyper-V VMs.

While at it, we'll skip building rbd-mirror as it's quite unlikely that
this daemon is going to be used on Windows for now.

[1] https://github.com/cloudbase/wnbd
[2] https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/overview-of-storage-virtual-miniport-drivers

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
2020-11-18 10:31:24 +00:00
Lucian Petrut
d024506f64 cmake: allow building CLI tools on Windows
For now, we'll only build some of the Ceph CLI binaries when
targeting Windows. In order to avoid over complicating the
cmake files, it was decided that the build script should pick
the targets that are to be compiled.

To keep the build script relatively simple, we'll stop supporting
Ninja, sticking to "make". Another reason for that is that some
targets cannot be compiled using Ninja:

http://paste.openstack.org/raw/796649/

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
2020-08-31 12:11:55 +00:00
Kefu Chai
583482829b cmake: drop WITH_PYTHON2 option
WITH_PYTHON2 option was deprecated in
5fc657b40d, that commit was included by
Ceph v15.1.0 and up, assuming all downstream packagings have removed
WITH_PYTHON2 option, we are now removing it completely.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2020-08-08 16:55:32 +08:00
Lucian Petrut
0942873cfe [win32] Add build scripts
This patch adds a couple of scripts that can be used for
building Ceph for Windows along with its dependencies.

For now, we're going to cross compile it using mingw.
It's supposed to run on Ubuntu (feel free to update
the command that's installing some of the dependencies
within win32_deps_build.sh if you're interested in other
distros).

This commit also adds a short readme, describing the focus of
the Windows porting effort, the building process and the current
status.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
2020-02-19 08:24:21 +00:00