GiantVM / Linux-DSM

Source code of KVM
Other
17 stars 14 forks source link

Implicit declaration of function ‘jhash’ #1

Open moharaka opened 4 years ago

moharaka commented 4 years ago

Hi,

I just hit this error when compiling:

$ make
...
In file included from arch/x86/kvm/dsm.h:6:0,
                 from arch/x86/kvm/x86.c:25:
arch/x86/kvm/dsm-util.h: In function ‘jhash32’:
arch/x86/kvm/dsm-util.h:90:9: error: implicit declaration of function ‘jhash’; did you mean ‘jhash32’? [-Werror=implicit-function-declaration]
  return jhash(s, n, JHASH_INITVAL);
         ^~~~~
         jhash32
arch/x86/kvm/dsm-util.h:90:21: error: ‘JHASH_INITVAL’ undeclared (first use in this function); did you mean ‘DSM_INITIAL’?
  return jhash(s, n, JHASH_INITVAL);
                     ^~~~~~~~~~~~~
                     DSM_INITIAL
arch/x86/kvm/dsm-util.h:90:21: note: each undeclared identifier is reported only once for each function it appears in

I managed to fix it with this patch:

diff --git a/arch/x86/kvm/dsm-util.h b/arch/x86/kvm/dsm-util.h
index 7508d950..4cdc8d44 100644
--- a/arch/x86/kvm/dsm-util.h
+++ b/arch/x86/kvm/dsm-util.h
@@ -2,6 +2,7 @@
 #define ARCH_X86_KVM_DSM_UTIL_H

 #include <linux/kvm_host.h>
+#include <linux/jhash.h>

 #define DSM_INITIAL     0
 #define DSM_INVALID     1

Also, I am trying to compile the kernel using TCP/IP, so this macro is set:

#define USE_KTCP_NETWORK

Is this the right approach?

moharaka commented 4 years ago

Update:

I am no longer hitting the problem. The only explanation is that I now have a correct configuration file. With KVM and INFINIBAND set to "yes".

With these modules ON, the "<linux/jhash.h>" header is probably loaded implicitly through them.

Will it still be nice to explicitly add the header?