Ver Fonte

Fixed building of libsdformat through the 3p

The cmake configure command for libsdformat contained inadvertent [added text](https://github.com/o3de/3p-package-source/commit/4e3d9ba37c1dde699febc4f64942d2b08eece587#diff-f7b9acab9d6b21567f4c1bd73f7e353a1bab0f3d418dff40569ab812928386dcR193) which was causing it to fail to configure.

Updated libsdformat to build using the configuration of Release with Debug Info.
The Debug Info information is then detached from the libsdformat DSO and kept as a sidecar .dbg file next to it, that will load the debug information if available.

This allows the the sdformat data structures to be seen in the debugger if the `libsdformat13.so.13.5.0.dbg` file has not been moved or deleted, but also doesn't increase the size of the actual `libsdformat13.so.13.5.0` library itself.

This also provides a mechanism for linux/android 3rdParty libraries to be built in release and have debug information available for users of the engine via source. But also makes it possible for the SDK build or installer to skip copying over the `.dbg` files with debug information and therefore allow the SDK to be smaller.

Signed-off-by: lumberyard-employee-dm <[email protected]>
lumberyard-employee-dm há 1 ano atrás
pai
commit
a69d237537

+ 3 - 1
package-system/sdformat/Dockerfile

@@ -53,7 +53,9 @@ ARG INPUT_BUILD_FOLDER=build
 ARG INPUT_INSTALL_FOLDER=install
 
 # Provide the default CMAKE_BUILD_TYPE for the 3rdParty
-ARG INPUT_CMAKE_BUILD_TYPE=Release
+# Release with debug info will be built and then the debug information
+# will be detached from the .dso
+ARG INPUT_CMAKE_BUILD_TYPE=RelWithDebInfo
 
 ENV WORKSPACE=/data/workspace
 ENV LOCAL_FILESYSTEM=$WORKSPACE/temp

+ 15 - 4
package-system/sdformat/Findsdformat.cmake.template

@@ -28,6 +28,8 @@ set($${LIB_NAME}_INCLUDE_DIRECTORIES $${$${LIB_NAME}_INCLUDE_DIR_ROOT}
     $${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${LIB_NAME}$${LIB_VERSION_MAJOR})
 set($${LIB_NAME}_LIBS_DIR $${CMAKE_CURRENT_LIST_DIR}/$${LIB_NAME}/lib)
 set($${LIB_NAME}_LIBRARY_RELEASE $${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${LIB_VERSION_FULL})
+# The path to the dbg symbol file
+set($${LIB_NAME}_LIBRARY_RELEASE_DBG "$${$${LIB_NAME}_LIBRARY_RELEASE}.dbg")
 
 add_library($${SDFORMAT_O3DE_NAMESPACE} SHARED IMPORTED GLOBAL)
 # If the find script is being called in an O3DE context use
@@ -50,14 +52,17 @@ if (COMMAND ly_add_target_files)
     ly_add_target_files(TARGETS $${SDFORMAT_O3DE_NAMESPACE}
         FILES
             "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${LIB_VERSION_MAJOR}"
-            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}")
+            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${LIB_NAME}$${LIB_VERSION_MAJOR}$${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            # Copy the debug symbol .dbg into the binary directory as well
+            "$${$${LIB_NAME}_LIBRARY_RELEASE_DBG}"
+    )
 endif()
 
 # Add the tinyxml2 dependency
 set(tinyxml2_libname "tinyxml2")
 set(tinyxml2_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}")
 # Tinyxml2 is built as a STATIC library
-set(tinyxml2_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${tinyxml2_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}")
+set(tinyxml2_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_STATIC_LIBRARY_PREFIX}$${tinyxml2_libname}$${CMAKE_STATIC_LIBRARY_SUFFIX}")
 
 # Add the 3rdParty::tinyxml2 target STATIC library
 set(tinyxml2_target "tinyxml2")
@@ -84,6 +89,7 @@ set(gz_utils_libname "gz-$${gz_utils_raw_name}")
 set(gz_utils_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${gz_utils_raw_name}")
 # gz-utils is built as a SHARED library
 set(gz_utils_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_utils_version_full}")
+set(gz_utils_lib_release_dbg "$${gz_utils_lib_release}.dbg")
 
 # Add the 3rdParty::gz-utils target library
 set(gz_utils_target "gz-utils")
@@ -106,7 +112,9 @@ if (COMMAND ly_add_target_files)
     ly_add_target_files(TARGETS $${gz_utils_target_namespace}
         FILES
             "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_utils_version_major}"
-            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}")
+            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_utils_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            "$${gz_utils_lib_release_dbg}"
+    )
 endif()
 
 # Add the gz-math dependency
@@ -117,6 +125,7 @@ set(gz_math_libname "gz-$${gz_math_raw_name}")
 set(gz_math_include_directories "$${$${LIB_NAME}_INCLUDE_DIR_ROOT}/gz/$${gz_math_raw_name}")
 # gz-math is built as a SHARED library
 set(gz_math_lib_release "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_math_version_full}")
+set(gz_math_lib_release_dbg "$${gz_math_lib_release}.dbg")
 
 # Add the 3rdParty::gz-math target library
 set(gz_math_target "gz-math")
@@ -139,7 +148,9 @@ if (COMMAND ly_add_target_files)
     ly_add_target_files(TARGETS $${gz_math_target_namespace}
         FILES
             "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}.$${gz_math_version_major}"
-            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}")
+            "$${$${LIB_NAME}_LIBS_DIR}/$${CMAKE_SHARED_LIBRARY_PREFIX}$${gz_math_libname}$${CMAKE_SHARED_LIBRARY_SUFFIX}"
+            "$${gz_math_lib_release_dbg}"
+    )
 endif()
 
 # Add the dependent libraries as target_link_libraries

+ 1 - 1
package-system/sdformat/build_config.json

@@ -2,7 +2,7 @@
    "git_url":"https://github.com/gazebosim/sdformat.git",
    "git_tag":"sdformat13_13.5.0",
    "package_name":"sdformat",
-   "package_version":"13.5.0-rev1",
+   "package_version":"13.5.0-rev2",
    "package_url":"https://github.com/gazebosim/sdformat.git",
    "package_license":"Apache-2.0",
    "package_license_file":"LICENSE",

+ 114 - 1
package-system/sdformat/docker_build_sdformat.sh

@@ -190,7 +190,7 @@ fi
 # instead of relying on an externally-installed package.
 # This keeps the dependencies self-contained.
 echo "Configuring ${LIB_NAME}"
-CMD=(cmake -B ${BUILD_FOLDER} -S. -DCMAKE-DUSE_INTERNAL_URDF=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_FOLDER} -DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\")
+CMD=(cmake -B ${BUILD_FOLDER} -S. -DUSE_INTERNAL_URDF=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=${INSTALL_FOLDER} -DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\")
 # Update the RPATH to $ORIGIN to allow sdformat library to find the dependent libgz-utils/gz-math.so files on Linux
 CMD+=(-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE -DCMAKE_INSTALL_RPATH=\$ORIGIN)
 echo "${CMD[@]}"
@@ -217,4 +217,117 @@ fi
 
 popd
 
+# Finally detach the debug symbols to a separate dbg file for sdformat
+echo "Detaching debug symbols for ${LIB_NAME}"
+SDFORMAT_VERSION=13.5.0
+LIB_FILENAME="lib${LIB_NAME}13.so.${SDFORMAT_VERSION}"
+LIB_DIRECTORY="${INSTALL_FOLDER}/lib"
+LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}"
+CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error detaching debug symbols for ${LIB_NAME}"
+    exit 1
+fi
+
+CMD="strip --strip-debug ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error stripping debugging symbols for ${LIB_NAME}"
+    exit 1
+fi
+
+# Change directory to the folder containing the sdformat library
+pushd ${LIB_DIRECTORY}
+CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error adding debug symbol link for ${LIB_NAME}"
+    exit 1
+fi
+
+popd
+
+# Detach the debug symbols to a separate dbg file for gz-math
+DEP_NAME=gz-math7
+echo "Detaching debug symbols for ${DEP_NAME}"
+GZ_MATH_VERSION=7.2.0
+LIB_FILENAME="lib${DEP_NAME}.so.${GZ_MATH_VERSION}"
+LIB_DIRECTORY="${GZ_MATH_INSTALL_FOLDER}/lib"
+LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}"
+CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error detaching debug symbols for ${DEP_NAME}"
+    exit 1
+fi
+
+CMD="strip --strip-debug ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error stripping debugging symbols for ${DEP_NAME}"
+    exit 1
+fi
+
+# Change directory to the folder containing the gz-math library
+pushd ${LIB_DIRECTORY}
+CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error adding debug symbol link for ${DEP_NAME}"
+    exit 1
+fi
+
+popd
+
+# Detach the debug symbols to a separate dbg file for gz-utils
+DEP_NAME=gz-utils2
+echo "Detaching debug symbols for ${DEP_NAME}"
+GZ_UTILS_VERSION=2.0.0
+LIB_FILENAME="lib${DEP_NAME}.so.${GZ_UTILS_VERSION}"
+LIB_DIRECTORY="${GZ_UTILS_INSTALL_FOLDER}/lib"
+LIB_PATH="${LIB_DIRECTORY}/${LIB_FILENAME}"
+CMD="objcopy --only-keep-debug ${LIB_PATH} ${LIB_PATH}.dbg"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error detaching debug symbols for ${DEP_NAME}"
+    exit 1
+fi
+
+CMD="strip --strip-debug ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error stripping debugging symbols for ${DEP_NAME}"
+    exit 1
+fi
+
+# Change directory to the folder containing the gz-utils library
+pushd ${LIB_DIRECTORY}
+CMD="objcopy --add-gnu-debuglink=${LIB_FILENAME}.dbg ${LIB_PATH}"
+echo $CMD
+eval $CMD
+if [ $? -ne 0 ]
+then
+    echo "Error adding debug symbol link for ${DEP_NAME}"
+    exit 1
+fi
+
+popd
+
 exit 0

+ 2 - 2
package_build_list_host_linux-aarch64.json

@@ -35,7 +35,7 @@
         "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/pyside2 --platform-name Linux-aarch64 --clean",
         "python-3.10.5-rev4-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/python --platform-name Linux-aarch64 --clean",
         "qt-5.15.2-rev9-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/Qt --platform-name Linux-aarch64 --clean",
-        "sdformat-13.5.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean",
+        "sdformat-13.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean",
         "SPIRVCross-2021.04.29-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux-aarch64 --clean",
         "SQLite-3.37.2-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux-aarch64 --clean",
         "squish-ccr-deb557d-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux-aarch64 --clean",
@@ -76,7 +76,7 @@
         "pyside2-5.15.2.1-py3.10-rev4-linux-aarch64": "package-system/pyside2/temp/pyside2-linux-aarch64",
         "python-3.10.5-rev4-linux-aarch64": "package-system/python/temp/python-linux-aarch64",
         "qt-5.15.2-rev9-linux-aarch64": "package-system/Qt/temp/qt-linux-aarch64",
-        "sdformat-13.5.0-rev1-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64",
+        "sdformat-13.5.0-rev2-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64",
         "SPIRVCross-2021.04.29-rev1-linux-aarch64": "package-system/SPIRVCross/temp/SPIRVCross-linux-aarch64",
         "SQLite-3.37.2-rev1-linux-aarch64": "package-system/sqlite/temp/SQLite-linux-aarch64",
         "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64",

+ 4 - 4
package_build_list_host_linux.json

@@ -31,8 +31,8 @@
         "NvCloth-v1.1.6-4-gd243404-pr58-rev1-linux": "package-system/NvCloth/build_package_image.py --platform-name linux",
         "poly2tri-7f0487a-rev1-linux": "package-system/poly2tri/build_package_image.py --platform-name linux",
         "v-hacd-2.3-1a49edf-rev1-linux": "package-system/v-hacd/build_package_image.py --platform-name linux",
-        "sdformat-13.5.0-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux --clean",
-        "sdformat-13.5.0-rev1-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean",
+        "sdformat-13.5.0-rev2-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux --clean",
+        "sdformat-13.5.0-rev2-linux-aarch64": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sdformat --platform-name Linux-aarch64 --clean",
         "SPIRVCross-2021.04.29-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/SPIRVCross --platform-name Linux --package-root ../../package-system --clean",
         "SQLite-3.37.2-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/sqlite --platform-name Linux --package-root ../../package-system --clean",
         "squish-ccr-deb557d-rev1-linux": "Scripts/extras/pull_and_build_from_git.py ../../package-system/squish-ccr --platform-name Linux --clean",
@@ -73,8 +73,8 @@
         "openimageio-opencolorio-2.3.17-rev2-linux": "package-system/openimageio-opencolorio/temp/package-linux",
         "OpenSSL-1.1.1t-rev1-linux": "package-system/OpenSSL/temp/OpenSSL-linux",
         "OpenSSL-1.1.1t-rev1-linux-aarch64": "package-system/OpenSSL/temp/OpenSSL-linux-aarch64",
-        "sdformat-13.5.0-rev1-linux": "package-system/sdformat/temp/sdformat-linux",
-        "sdformat-13.5.0-rev1-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64",
+        "sdformat-13.5.0-rev2-linux": "package-system/sdformat/temp/sdformat-linux",
+        "sdformat-13.5.0-rev2-linux-aarch64": "package-system/sdformat/temp/sdformat-linux-aarch64",
         "SPIRVCross-2021.04.29-rev1-linux": "package-system/SPIRVCross-linux",
         "squish-ccr-deb557d-rev1-linux": "package-system/squish-ccr/temp/squish-ccr-linux",
         "squish-ccr-deb557d-rev1-linux-aarch64": "package-system/squish-ccr/temp/squish-ccr-linux-aarch64",