Skip to content

Commit

Permalink
fix: compilation with new version mio library from vcpkg (opentibiabr…
Browse files Browse the repository at this point in the history
…#832)

Recently, in a vcpkg commit, there was a problem linking the library mio. This caused issues when trying to link the executable. To solve this, I decided to revert to using an older version of the library until there is a correction in the vcpkg repository.

To prevent future build breaks due to changes in the vcpkg repository, I added a step in the GitHub Actions to install vcpkg based on the builtin-baseline in the vcpkg.json file. This allows us to set vcpkg to be installed from specific commits in both GitHub Actions and in Ubuntu/Windows, centralizing everything in one location. We can only update vcpkg when there is an official release.
  • Loading branch information
dudantas authored Feb 5, 2023
1 parent 97f3e8c commit 09e4e70
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/analysis-sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ jobs:
restore-keys: |
sonar-${{ runner.os}}-
- name: Restore artifacts, or setup vcpkg (do not install any package)
- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId"
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/opentibiabr/vcpkg.git"
vcpkgGitCommitId: 8974d642d47efd578e0da3223b4101c5d59aebcf
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}

- name: Install sonar-scanner
uses: SonarSource/sonarcloud-github-c-cpp@v1
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,16 @@ jobs:
ccache-${{ matrix.os }}
- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ')
echo "vcpkg commit ID: $vcpkgCommitId"
echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId"
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/opentibiabr/vcpkg.git"
vcpkgGitCommitId: 8974d642d47efd578e0da3223b4101c5d59aebcf
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}

- name: Get latest CMake and ninja
uses: lukka/get-cmake@main
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,17 @@ jobs:
run: rm -r -fo C:/mysql*

- name: Restore artifacts and install vcpkg
id: vcpkg-step
run: |
$json=Get-Content vcpkg.json -Raw | ConvertFrom-Json
$vcpkgCommitId=$json.'builtin-baseline'
Write-Host "vcpkg commit ID: $vcpkgCommitId"
echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId"
- name: Get vcpkg commit id from vcpkg.json
uses: lukka/run-vcpkg@main
with:
vcpkgGitURL: "https://github.com/opentibiabr/vcpkg.git"
vcpkgGitCommitId: 8974d642d47efd578e0da3223b4101c5d59aebcf
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}

- name: Get latest CMake and ninja
uses: lukka/get-cmake@main
Expand Down
9 changes: 7 additions & 2 deletions docker/Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends cmake git \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone https://github.com/microsoft/vcpkg --depth=1 \
&& ./vcpkg/bootstrap-vcpkg.sh
COPY vcpkg.json /opt
RUN vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ') \
&& echo "vcpkg commit ID: $vcpkgCommitId" \
&& git clone https://github.com/Microsoft/vcpkg.git \
&& cd vcpkg \
&& git checkout $vcpkgCommitId \
&& ./bootstrap-vcpkg.sh

WORKDIR /opt/vcpkg
COPY vcpkg.json /opt/vcpkg/
Expand Down
9 changes: 7 additions & 2 deletions docker/Dockerfile.x86
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends cmake git \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone https://github.com/microsoft/vcpkg --depth=1 \
&& ./vcpkg/bootstrap-vcpkg.sh
COPY vcpkg.json /opt
RUN vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ') \
&& echo "vcpkg commit ID: $vcpkgCommitId" \
&& git clone https://github.com/Microsoft/vcpkg.git \
&& cd vcpkg \
&& git checkout $vcpkgCommitId \
&& ./bootstrap-vcpkg.sh

WORKDIR /opt/vcpkg
COPY vcpkg.json /opt/vcpkg/
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ find_package(spdlog REQUIRED)
find_package(unofficial-libmariadb CONFIG REQUIRED)
find_package(mio REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)

include(GNUInstallDirs)

Expand Down Expand Up @@ -347,6 +348,7 @@ if (MSVC)
spdlog::spdlog
unofficial::libmariadb
unofficial::mariadbclient
ZLIB::ZLIB
)

else()
Expand Down Expand Up @@ -374,6 +376,7 @@ else()
spdlog::spdlog
unofficial::libmariadb
unofficial::mariadbclient
ZLIB::ZLIB

Threads::Threads
)
Expand Down
6 changes: 4 additions & 2 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"protobuf",
"parallel-hashmap",
"magic-enum",
"mio",
"zlib",
{"name": "mio", "version>=": "2019-02-10"},
{
"name": "luajit",
"platform": "!arm"
Expand All @@ -27,5 +28,6 @@
"name": "mpir",
"platform": "windows"
}
]
],
"builtin-baseline":"0e67f312e831b4b897c7f492cf1e2858522c6e18"
}

0 comments on commit 09e4e70

Please sign in to comment.