Skip to content

Commit

Permalink
[DAPHNE-daphne-eu#830] Fix compilation error in json dependency
Browse files Browse the repository at this point in the history
The use of EOF in our json dependency makes compilation fail with Clang
  • Loading branch information
corepointer committed Sep 24, 2024
1 parent 3827c02 commit e3c85a1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -766,13 +766,14 @@ if [ $WITH_DEPS -gt 0 ]; then
#------------------------------------------------------------------------------
nlohmannjsonDirName=nlohmannjson
nlohmannjsonSingleHeaderName=json.hpp
dep_nlohmannjson=("nlohmannjson_v${nlohmannjsonVersion}" "v1")
dep_nlohmannjson=("nlohmannjson_v${nlohmannjsonVersion}" "v2")

if ! is_dependency_installed "${dep_nlohmannjson[@]}"; then
daphne_msg "Get nlohmannjson version ${nlohmannjsonVersion}"
mkdir -p "${installPrefix}/include/${nlohmannjsonDirName}"
wget "https://github.com/nlohmann/json/releases/download/v$nlohmannjsonVersion/$nlohmannjsonSingleHeaderName" \
-qO "${installPrefix}/include/${nlohmannjsonDirName}/${nlohmannjsonSingleHeaderName}"
patch -Np0 -i "${patchDir}/0007-nlohmannjson-replace-EOF.patch" -d "${installPrefix}/include/${nlohmannjsonDirName}"
dependency_install_success "${dep_nlohmannjson[@]}"
else
daphne_msg "No need to download nlohmannjson again."
Expand Down
20 changes: 20 additions & 0 deletions thirdparty/patches/0007-nlohmannjson-replace-EOF.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- json.hpp.orig 2024-09-24 17:26:47.850173669 +0200
+++ json.hpp 2024-09-24 17:27:40.874776913 +0200
@@ -3624,7 +3624,7 @@

static constexpr int_type eof() noexcept
{
- return static_cast<int_type>(EOF);
+ return static_cast<int_type>(std::char_traits<char>::eof());
}
};

@@ -3648,7 +3648,7 @@

static constexpr int_type eof() noexcept
{
- return static_cast<int_type>(EOF);
+ return static_cast<int_type>(std::char_traits<char>::eof());
}
};

0 comments on commit e3c85a1

Please sign in to comment.