ac_cv_sys_symbol_underscore=yes unconditionally when cross-compiling
Closed, ResolvedPublic

Description

Release: gpg 1.4.2

Environment

configuring and compiling on linux/i386 for powerpc-linux.

Description

The configure script unconditionally sets
ac_cv_sys_symbol_underscore=yes in all cases of cross-compilation in such a way that
it is not even possible to set this to "no" on the commandline
(e.g. with ./configure [...] --host=powerpc-linux ac_cv_sys_symbol_underscore=no)

How To Repeat

$ ./configure [...] --host=powerpc-linux ac_cv_sys_symbol_underscore=no

Look at config.h, it has
#define WITH_SYMBOL_UNDERSCORE 1

Running make will fail at some link step with
powerpc-linux-gcc -g -O2 -Wall -s -o mpicalc mpicalc.o ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
../mpi/libmpi.a(mpi-add.o): In function `mpi_add':
/tmp/gnupg-1.4.2/mpi/mpi-inline.h:120: undefined reference to `mpihelp_sub_n'
/tmp/gnupg-1.4.2/mpi/mpi-inline.h:120: relocation truncated to fit: R_PPC_REL24 mpihelp_sub_n
../mpi/libmpi.a(mpi-add.o): In function `mpi_add':
/tmp/gnupg-1.4.2/mpi/mpi-add.c:144: undefined reference to `mpihelp_sub_n'
/tmp/gnupg-1.4.2/mpi/mpi-add.c:144: relocation truncated to fit: R_PPC_REL24 mpihelp_sub_n
[...]

Fix

The logic to determine whether symbol underscores are needed when cross compiling is broken. There appears to be support for determining the answer programatically by looking at nm(1) output, but this never gets done when ac_cv_sys_symbol_underscore=yes is set unconditionally at line 5201.
A minimal fix is to not clobber ac_cv_sys_symbol_underscore when it is already set, e.g. make line 5201
ac_cv_sys_symbol_underscore=${ac_cv_sys_symbol_underscore-yes}
This at least allows to set the value on the configure commandline.
I'll be happy to test other fixes you come up with, especially if you try to derive the answer from nm output.

werner added a subscriber: werner.

Fixed in SVN (-r4281 for 1.4). Also applied fix to libgcrypt.
It should now be possible to pass the cache variable on the command line.

werner closed this task as Resolved.