Skip to content

Commit

Permalink
[DAPHNE-#830] Fix compilation error (with clang) 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.
Patch is based on nlohmannjson version 3.11.3
  • Loading branch information
corepointer committed Sep 24, 2024
1 parent 5adc699 commit 634c25a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion software-package-versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cudaVersion=12.6.1
eigenVersion=3.4.0
grpcVersion=1.38.0
hwlocVersion=2.9.3
nlohmannjsonVersion=3.10.5
nlohmannjsonVersion=3.11.3
openBlasVersion=0.3.23
openMPIVersion=4.1.5
papiVersion=7.0.1
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 634c25a

Please sign in to comment.