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

cpuid.h missing in ARM(Raspberry pi) #175

Closed
thkaw opened this issue Jul 25, 2016 · 7 comments
Closed

cpuid.h missing in ARM(Raspberry pi) #175

thkaw opened this issue Jul 25, 2016 · 7 comments

Comments

@thkaw
Copy link

thkaw commented Jul 25, 2016

As I know ARM CPU seem no cpuid like x86 CPU have.

So If I compile latest(0.13.1) version for RPI2/3.

Will have an error said:

/home/pi/vernemq_forpi2_0.13.1_orig/vernemq/_build/default/lib/mzmetrics/c_src/mzmetrics_counters_no_preallocation.c:6:19: fatal error: cpuid.h: No such file or directory
 #include <cpuid.h>
                   ^

But few month ago in 0.12.5p4 version of verneMQ, I can compiled and running verneMQ at RPi2/3 without any problem.

Is this problem possible solve?

@larshesel
Copy link
Contributor

Hi

We don't officially support VerneMQ on raspberry pi and therefore it slipped through our fingers that the newest release doesn't compile there. The reason is a new dependency (mzmetrics) which we started using in this release which makes it possible for us to provide metrics with much less overhead than before.

We don't currently have a workaround for this, but will look into this when we have a moment to spare.

If you should find a solution we'd be grateful if you'd share it with us.

Thanks

@larshesel
Copy link
Contributor

Hi again

I didn't figure out if there is a good way to bring cpuid.h onto a raspian system. So I did something dirty. In the vernemq directory I created a _checkouts folder and moved the mzmetrics dependency from _build/default/lib there. And then I changed the code like the following:

diff --git a/c_src/mzmetrics_counters_no_preallocation.c b/c_src/mzmetrics_counters_no_preallocation.c
index 4fa1d0c..9537e6c 100644
--- a/c_src/mzmetrics_counters_no_preallocation.c
+++ b/c_src/mzmetrics_counters_no_preallocation.c
@@ -3,7 +3,7 @@
 #define _DEFAULT_SOURCE
 #include <sched.h>
 #endif
-#include <cpuid.h>
+//#include <cpuid.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdint.h>
@@ -33,14 +33,14 @@ void capi_deinit_counters(void)
 int mycpu(void)
 {
 #ifdef PCPU_COUNTERS
-#ifdef __linux__
+/* #ifdef __linux__ */
     return sched_getcpu();
-#else
-    unsigned int eax, ebx, ecx, edx;
-    if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx))
-        return 0;
-    return 0;
-#endif
+/* #else */
+/*     unsigned int eax, ebx, ecx, edx; */
+/*     if (!__get_cpuid(1, &eax, &ebx, &ecx, &edx)) */
+/*         return 0; */
+/*     return 0; */
+/* #endif */
 #else
     return 0;
 #endif

This makes it compile and work for me - at least I'm able to subscribe to and publish QoS0 messages.

Note, this was just a quick and dirty hack, but would be good to know if this works for you as well.

Cheers,
Lars

@thkaw
Copy link
Author

thkaw commented Jul 25, 2016

Thank you for your quick replied.

I'll test dirty code later ;)

@thkaw
Copy link
Author

thkaw commented Jul 25, 2016

BTW, @larshesel is there have any change log between different version?

@larshesel
Copy link
Contributor

https://github.com/erlio/vernemq/blob/master/changelog.md (I see we made a mistake and called the most recent release 0.13.0 - it should be 0.13.1 - I'll change that in a bit)

@vladbabii
Copy link

This resolved the issue on Raspberry Pi 2 (512mb ram version) with latest vernemq source from git.

@kush930
Copy link

kush930 commented Sep 17, 2022

Hi all,

I cloned master branch of pytorch from link:- https://github.com/pytorch/pytorch.git

I am building pytorch on riscv64, I am facing issue:-

In file included from /home/root/kush/pytorch/third_party/cpuinfo/src/x86/init.c:5:
/home/root/kush/pytorch/third_party/cpuinfo/src/x86/cpuid.h:5:11: fatal error: cpuid.h: No such file or directory
    5 |  #include <cpuid.h>
      |           ^~~~~~~~~
compilation terminated.
make[2]: *** [confu-deps/cpuinfo/CMakeFiles/cpuinfo_internals.dir/build.make:121: confu-deps/cpuinfo/CMakeFiles/cpuinfo_internals.dir/src/x86/init.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1788: confu-deps/cpuinfo/CMakeFiles/cpuinfo_internals.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

if anyone know, where i am wrong, please guide me to build pytorch on riscv64.

T&R
Kush

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

No branches or pull requests

4 participants