The script accepts the following flags:
-============= =============================== ===============================
-Flag Description Default value
-============= =============================== ===============================
-OS Host OS distribution, for mingw ubuntu (also valid: suse)
- and other OS specific settings.
-CEPH_DIR The Ceph source code directory. The same as the script.
-BUILD_DIR The directory where the $CEPH_DIR/build
- generated artifacts will be
- placed.
-DEPS_DIR The directory where the Ceph $CEPH_DIR/build.deps
- dependencies will be built.
-NUM_WORKERS The number of workers to use The number of vcpus
- when building Ceph. available
-CLEAN_BUILD Clean the build directory.
-SKIP_BUILD Run cmake without actually
- performing the build.
-SKIP_TESTS Skip building Ceph tests.
-BUILD_ZIP Build a zip archive containing
- the generated binaries.
-ZIP_DEST Where to put a zip containing $BUILD_DIR/ceph.zip
- the generated binaries.
-STRIP_ZIPPED If set, the zip will contain
- stripped binaries.
-ENABLE_SHARED Dynamically link Ceph libs. False
-============= =============================== ===============================
-
-In order to build debug binaries as well as an archive containing stripped
-binaries that may be easily moved around, one may use the following:
+================= =============================== ===============================
+Flag Description Default value
+================= =============================== ===============================
+OS Host OS distribution, for mingw ubuntu (also valid: suse)
+ and other OS specific settings.
+CEPH_DIR The Ceph source code directory. The same as the script.
+BUILD_DIR The directory where the $CEPH_DIR/build
+ generated artifacts will be
+ placed.
+DEPS_DIR The directory where the Ceph $CEPH_DIR/build.deps
+ dependencies will be built.
+NUM_WORKERS The number of workers to use The number of vcpus
+ when building Ceph. available
+CLEAN_BUILD Clean the build directory.
+SKIP_BUILD Run cmake without actually
+ performing the build.
+SKIP_TESTS Skip building Ceph tests.
+SKIP_ZIP If unset, we'll build a zip
+ archive containing the
+ generated binaries.
+ZIP_DEST Where to put a zip containing $BUILD_DIR/ceph.zip
+ the generated binaries.
+EMBEDDED_DBG_SYM By default, the generated
+ archive will contain a .debug
+ subfolder, having the debug
+ symbols. If this flag is set,
+ the debug symbols will remain
+ embedded in the executables.
+ENABLE_SHARED Dynamically link Ceph libs. False
+================= =============================== ===============================
+
+The following command will build the binaries and add them to a zip archive
+along with all the required DLLs. By default, the debug symbols are extracted
+from the binaries and placed in the ".debug" folder of the archive.
.. code:: bash
- BUILD_ZIP=1 STRIP_ZIPPED=1 SKIP_TESTS=1 ./win32_build.sh
+ SKIP_TESTS=1 ./win32_build.sh
In order to disable a flag, such as ``CLEAN_BUILD``, leave it undefined.
-Debug binaries can be quite large, the following parameters may be passed to
-``win32_build.sh`` to reduce the amount of debug information:
-
-.. code:: bash
-
- CFLAGS="-g1" CXXFLAGS="-g1" CMAKE_BUILD_TYPE="Release"
-
``win32_build.sh`` will fetch dependencies using ``win32_deps_build.sh``. If
all dependencies are successfully prepared, this potentially time consuming
step will be skipped by subsequent builds. Be aware that you may have to do
SKIP_BINDIR_CLEAN=${SKIP_BINDIR_CLEAN:-}
NUM_WORKERS=${NUM_WORKERS:-$num_vcpus}
DEV_BUILD=${DEV_BUILD:-}
-BUILD_ZIP=${BUILD_ZIP:-}
-# By default, we'll build release binaries with debug symbols attached.
-# If BUILD_ZIP and STRIP_ZIPPED are enabled, we'll strip the binaries
-# that we're going to archive.
+# Unless SKIP_ZIP is set, we're preparing an archive that contains the Ceph
+# binaries, debug symbols as well as the required DLLs.
+SKIP_ZIP=${SKIP_ZIP:-}
+# By default, we'll move the debug symbols to separate files located in the
+# ".debug" directory. If "EMBEDDED_DBG_SYM" is set, the debug symbols will
+# remain embedded in the binaries.
+#
# Unfortunately we cannot use pdb symbols when cross compiling. cv2pdb
# well as llvm rely on mspdb*.dll in order to support this proprietary format.
-STRIP_ZIPPED=${STRIP_ZIPPED:-}
+EMBEDDED_DBG_SYM=${EMBEDDED_DBG_SYM:-}
# Allow for OS specific customizations through the OS flag.
# Valid options are currently "ubuntu" and "suse".
# Debug builds don't work with MINGW for the time being, failing with
# can't close <file>: File too big
# -Wa,-mbig-obj does not help.
-CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-RelWithDebInfo}
+CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-}
+if [[ -z $CMAKE_BUILD_TYPE ]]; then
+ # By default, we're building release binaries with minimal debug information.
+ export CFLAGS="$CFLAGS -g1"
+ export CXXFLAGS="$CXXFLAGS -g1"
+ CMAKE_BUILD_TYPE=Release
+fi
+
# Some tests can't use shared libraries yet due to unspecified dependencies.
# We'll do a static build by default for now.
ENABLE_SHARED=${ENABLE_SHARED:-OFF}
binDir="$BUILD_DIR/bin"
strippedBinDir="$BUILD_DIR/bin_stripped"
+# GDB will look for this directory by default.
+dbgDirname=".debug"
+dbgSymbolDir="$strippedBinDir/${dbgDirname}"
depsSrcDir="$DEPS_DIR/src"
depsToolsetDir="$DEPS_DIR/mingw"
cp ${required_dlls[@]} $binDir
fi
-if [[ -n $BUILD_ZIP ]]; then
+if [[ -z $SKIP_ZIP ]]; then
# Use a temp directory, in order to create a clean zip file
ZIP_TMPDIR=$(mktemp -d win_binaries.XXXXX)
- if [[ -n $STRIP_ZIPPED ]]; then
- echo "Stripping debug symbols from binaries."
+ if [[ -z $EMBEDDED_DBG_SYM ]]; then
+ echo "Extracting debug symbols from binaries."
rm -rf $strippedBinDir; mkdir $strippedBinDir
+ rm -rf $dbgSymbolDir; mkdir $dbgSymbolDir
# Strip files individually, to save time and space
for file in $binDir/*.exe $binDir/*.dll; do
- $MINGW_STRIP -o $strippedBinDir/$(basename $file) $file
+ dbgFilename=$(basename $file).debug
+ dbgFile="$dbgSymbolDir/$dbgFilename"
+ strippedFile="$strippedBinDir/$(basename $file)"
+
+ echo "Copying debug symbols: $dbgFile"
+ $MINGW_OBJCOPY --only-keep-debug $file $dbgFile
+ $MINGW_STRIP --strip-debug --strip-unneeded -o $strippedFile $file
+ $MINGW_OBJCOPY --remove-section .gnu_debuglink $strippedFile
+ $MINGW_OBJCOPY --add-gnu-debuglink=$dbgFile $strippedFile
done
# Copy any remaining files to the stripped directory
for file in $binDir/*; do