Skip to content

Commit aa36d35

Browse files
authored
ci: add RelWithDebInfo build and fix free-nonheap-object error (#812)
Adding a RelWithDebInfo build revealed a build error. This PR fixes the issue. ``` error: ‘void operator delete(void*, std::size_t)’ called on a pointer to an unallocated object ‘1’ [-Werror=free-nonheap-object] ```
1 parent 62e1bd8 commit aa36d35

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

.github/workflows/test.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ env:
3939
jobs:
4040
ubuntu:
4141
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
42-
name: AMD64 Ubuntu 26.04
42+
name: AMD64 Ubuntu 26.04 (${{ matrix.cmake_build_type }})
4343
runs-on: ubuntu-26.04
44-
timeout-minutes: 30
44+
timeout-minutes: 60
4545
strategy:
4646
fail-fast: false
47+
matrix:
48+
cmake_build_type:
49+
- Debug
50+
- RelWithDebInfo
4751
env:
4852
SCCACHE_DIR: ${{ github.workspace }}/.sccache
4953
SCCACHE_CACHE_SIZE: "2G"
@@ -59,17 +63,17 @@ jobs:
5963
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
6064
with:
6165
path: ${{ github.workspace }}/.sccache
62-
key: sccache-test-ubuntu-${{ github.run_id }}
66+
key: sccache-test-ubuntu-${{ matrix.cmake_build_type }}-${{ github.run_id }}
6367
restore-keys: |
64-
sccache-test-ubuntu-
68+
sccache-test-ubuntu-${{ matrix.cmake_build_type }}-
6569
- name: Setup sccache
6670
uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
6771
- name: Build Iceberg
6872
shell: bash
6973
env:
7074
CC: gcc-14
7175
CXX: g++-14
72-
run: ci/scripts/build_iceberg.sh $(pwd) ON ON
76+
run: ci/scripts/build_iceberg.sh $(pwd) ON ON OFF OFF ON ${{ matrix.cmake_build_type }}
7377
- name: Show sccache stats
7478
shell: bash
7579
run: sccache --show-stats
@@ -78,7 +82,7 @@ jobs:
7882
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
7983
with:
8084
path: ${{ github.workspace }}/.sccache
81-
key: sccache-test-ubuntu-${{ github.run_id }}
85+
key: sccache-test-ubuntu-${{ matrix.cmake_build_type }}-${{ github.run_id }}
8286
- name: Build Example
8387
shell: bash
8488
env:

ci/scripts/build_iceberg.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919
#
20-
# Usage: build_iceberg.sh <source_dir> [rest_integration_tests=OFF] [sccache=OFF] [s3=OFF] [sigv4=OFF] [bundle_awssdk=ON]
20+
# Usage: build_iceberg.sh <source_dir> [rest_integration_tests=OFF] [sccache=OFF] [s3=OFF] [sigv4=OFF] [bundle_awssdk=ON] [build_type=Debug]
2121

2222
set -eux
2323

@@ -37,6 +37,12 @@ is_windows() {
3737
[[ "${OSTYPE}" == "msys" || "${OSTYPE}" == "win32" || "${OSTYPE}" == "cygwin" ]]
3838
}
3939

40+
if is_windows; then
41+
build_type=${7:-Release}
42+
else
43+
build_type=${7:-Debug}
44+
fi
45+
4046
CMAKE_ARGS=(
4147
"-G Ninja"
4248
"-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX:-${ICEBERG_HOME}}"
@@ -65,13 +71,13 @@ fi
6571

6672
if is_windows; then
6773
CMAKE_ARGS+=("-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake")
68-
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Release")
74+
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=${build_type}")
6975
else
7076
# Pass an externally provided toolchain (e.g. vcpkg for the SigV4 job)
7177
if [[ -n "${CMAKE_TOOLCHAIN_FILE:-}" ]]; then
7278
CMAKE_ARGS+=("-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
7379
fi
74-
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=Debug")
80+
CMAKE_ARGS+=("-DCMAKE_BUILD_TYPE=${build_type}")
7581
fi
7682

7783
if [[ "${build_enable_sccache}" == "ON" ]]; then
@@ -86,9 +92,9 @@ fi
8692

8793
cmake "${CMAKE_ARGS[@]}" ${source_dir}
8894
if is_windows; then
89-
cmake --build . --config Release --target install
95+
cmake --build . --config "${build_type}" --target install
9096
if [[ "${run_tests}" == "ON" ]]; then
91-
ctest --output-on-failure -C Release
97+
ctest --output-on-failure -C "${build_type}"
9298
fi
9399
else
94100
cmake --build . --target install

src/iceberg/json_serde.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,9 +1377,9 @@ Result<std::unique_ptr<TableMetadata>> TableMetadataFromJson(const nlohmann::jso
13771377
TimePointMs{std::chrono::milliseconds(last_updated_ms)};
13781378

13791379
if (json.contains(kRefs)) {
1380-
ICEBERG_ASSIGN_OR_RAISE(
1381-
table_metadata->refs,
1382-
FromJsonMap<std::shared_ptr<SnapshotRef>>(json, kRefs, SnapshotRefFromJson));
1380+
ICEBERG_ASSIGN_OR_RAISE(auto refs, FromJsonMap<std::shared_ptr<SnapshotRef>>(
1381+
json, kRefs, SnapshotRefFromJson));
1382+
table_metadata->refs = std::move(refs);
13831383
} else if (table_metadata->current_snapshot_id != kInvalidSnapshotId) {
13841384
table_metadata->refs["main"] = std::make_unique<SnapshotRef>(SnapshotRef{
13851385
.snapshot_id = table_metadata->current_snapshot_id,

0 commit comments

Comments
 (0)