Skip to content

Implicit declaration of function ‘jhash’ #1

@moharaka

Description

@moharaka

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions