-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addpkg: p2pool(fix compilation error caused by cast-align and cast-qual)
- Loading branch information
1 parent
6caf561
commit ffe3ed7
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- PKGBUILD | ||
+++ PKGBUILD | ||
@@ -22,7 +22,55 @@ prepare() { | ||
} | ||
|
||
build() { | ||
- cd ${pkgname}/build | ||
+ cd ${pkgname} | ||
+ # the package use -Wcast-align flag, it seems casting from 'uint8_t *' to 'uint32_t *' doesn't cause warning on x86_64, but it does on riscv64 | ||
+ # with -Werror, it causes build failure. So the following code add #pragma GCC diagnostic ignored "-Wcast-align" to ignore the warning temporarily | ||
+ # patch src/common.h | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/common.h | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/common.h | ||
+ # patch src/block_cache.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/block_cache.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/block_cache.cpp | ||
+ # patch src/keccak.h | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/keccak.h | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/keccak.h | ||
+ # patch src/keccak.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/keccak.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/keccak.cpp | ||
+ # patch src/p2p_server.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/p2p_server.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/p2p_server.cpp | ||
+ # patch src/pool_block.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/pool_block.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/pool_block.cpp | ||
+ # patch src/tcp_server.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/tcp_server.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/tcp_server.cpp | ||
+ # patch src/util.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/util.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/util.cpp | ||
+ # patch src/side_chain.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/side_chain.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/side_chain.cpp | ||
+ # patch src/stratum_server.cpp | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' src/stratum_server.cpp | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' src/stratum_server.cpp | ||
+ # patch external/src/RandomX/src/intrin_portable.h | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' external/src/RandomX/src/intrin_portable.h | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' external/src/RandomX/src/intrin_portable.h | ||
+ # patch external/src/rapidjson/include/rapidjson/internal/stack.h | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' external/src/rapidjson/include/rapidjson/internal/stack.h | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' external/src/rapidjson/include/rapidjson/internal/stack.h | ||
+ # patch external/src/rapidjson/include/rapidjson/allocators.h | ||
+ sed -i '1 i\#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored "-Wcast-align"' external/src/rapidjson/include/rapidjson/allocators.h | ||
+ sed -i '$ a\#pragma GCC diagnostic pop' external/src/rapidjson/include/rapidjson/allocators.h | ||
+ | ||
+ # the package build failed with -Werror=cast-qual, because it remove const qualifier while casting which seems not necessary | ||
+ # see https://github.com/tevador/RandomX/issues/277 | ||
+ # patch external/src/RandomX/src/intrin_portable.h (add const qualifier) | ||
+ sed -Ei 's/(load32\(\()(uint8_t\*)/\1const \2/g' external/src/RandomX/src/intrin_portable.h | ||
+ cd build | ||
+ | ||
cmake .. -DCMAKE_BUILD_TYPE=Release | ||
make -j$(nproc) | ||
} |