Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cstddef explicitly for GCC11 #120

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

add cstddef explicitly for GCC11 #120

wants to merge 1 commit into from

Conversation

hv15
Copy link

@hv15 hv15 commented Sep 5, 2021

On ArchLinux with CUDA 11.4 and GCC11, one gets the following error message when compile xmrig-cuda:

[ 82%] Building CXX object CMakeFiles/xmrig-cuda.dir/src/crypto/common/Algorithm.cpp.o
In file included from /home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.cpp:20:
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:88:29: error: ‘size_t’ does not name a type
   88 |     static inline constexpr size_t l2(Id id)                { return family(id) == RANDOM_X ? (1U << ((id >> 8) & 0xff)) : 0U; }
      |                             ^~~~~~
In file included from /home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.cpp:20:
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:25:1: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
   24 | #include <vector>
  +++ |+#include <cstddef>
   25 | 
In file included from /home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.cpp:20:
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:89:29: error: ‘size_t’ does not name a type
   89 |     static inline constexpr size_t l3(Id id)                { return 1ULL << ((id >> 16) & 0xff); }
      |                             ^~~~~~
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:89:29: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:97:12: error: ‘size_t’ does not name a type
   97 |     inline size_t l2() const                                { return l2(m_id); }
      |            ^~~~~~
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:97:12: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:101:12: error: ‘size_t’ does not name a type
  101 |     inline size_t l3() const
      |            ^~~~~~
/home/dragonek/.cache/paru/clone/xmrig-cuda/src/xmrig-cuda-6.15.0/src/crypto/common/Algorithm.h:101:12: note: ‘size_t’ is defined in header ‘<cstddef>’; did you forget to ‘#include <cstddef>’?

Clearly size_t is not defined, and including <cstddef> solves this. I know that with GCC4/5 that cstddef was pulled out of a lot of headers, making it necessary to explicitly include it. Maybe with GCC11 this also happened; the GNU release notes don't list this though.

@ludiazv
Copy link

ludiazv commented Oct 8, 2021

Confirmed. This fixes compilation under GCC11. Please merge!

@GibsDev
Copy link

GibsDev commented Nov 9, 2021

I also had this issue, and this solved it.

@cedricschwyter
Copy link

I have encountered this very same problem and can only second this. This fixes compilation problem for GCC 11.1.0.

@Spudz76
Copy link
Contributor

Spudz76 commented Nov 24, 2021

@xmrig plz merge thx

@AquilaFasciata
Copy link

Successfully compiled. Please merge.

archlinux-github pushed a commit to archlinux/aur that referenced this pull request Jul 28, 2022
This has been submitted upstream, see
xmrig/xmrig-cuda#120.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants