Skip to content
Advertisement

How do I fix this libgcrypt cross-compilation error?

I’m trying to cross compile GPG for an ElinOS on a board with an imx6. I have a problem when I compile libgcrypt. First, here’s what I do:

export PATH=/opt/elinos/cdk/arm/v7hf/glibc/bin:$PATH 
./configure --host=arm-unknown-linux-gnueabihf --build=i686-pc-linux-gnu 
make all

The configuration part shows no errors or warning, but the make displays this:

hwf-arm.c:31:3: error: #error Module build for wrong CPU.
 # error Module build for wrong CPU.
   ^
hwf-arm.c: In function 'get_hwcap':
hwf-arm.c:126:26: error: 'AT_HWCAP' undeclared (first use in this function)
       if (auxv.a_type == AT_HWCAP)
                          ^
hwf-arm.c:126:26: note: each undeclared identifier is reported only once for each function it appears in
hwf-arm.c:132:26: error: 'AT_HWCAP2' undeclared (first use in this function)
       if (auxv.a_type == AT_HWCAP2)
                          ^
In file included from hwf-arm.c:27:0:
hwf-arm.c: In function 'detect_arm_at_hwcap':
hwf-arm.c:159:23: error: 'arm_features' undeclared (first use in this function)
   for (i = 0; i < DIM(arm_features); i++)
                       ^
g10lib.h:96:24: note: in definition of macro 'DIM'
 #define DIM(v) (sizeof(v)/sizeof((v)[0]))
                        ^
hwf-arm.c: In function 'detect_arm_proc_cpuinfo':
hwf-arm.c:250:23: error: 'arm_features' undeclared (first use in this function)
   for (i = 0; i < DIM(arm_features); i++)
                       ^
g10lib.h:96:24: note: in definition of macro 'DIM'
 #define DIM(v) (sizeof(v)/sizeof((v)[0]))

The first error leads me to this part of the code :

#if !defined (__arm__) && !defined (__aarch64__)
# error Module build for wrong CPU.
#endif

Any idea where this comes from? It looks like a configuration problem, but I’m not sure where to look now.

Advertisement

Answer

In the config.log file, CC was setup correctly: CC='arm-unknown-linux-gnueabihf-gcc'.

Yet I needed to specify it in the make command. So instead of simply using make all, which didn’t work, I had to use make all CC=arm-unknown-linux-gnueabihf-gcc.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement