Mailing List Archive

FreeBSD 3.x requires change in mpi/config.links
I just upgraded to FreeBSD 3.1, and GnuPG 0.9.3 won't compile "as is"
any more.

The problem appears to be that FreeBSD 3.x doesn't use underscore (_)
characters on external symbols -- but the "mpi/config.links" script
doesn't recognize the target (i386-unknown-freebsd3.1) and tries to
prepend underscores to the external symbols used by the assembly
language routines in the MPI library.

The following patch appears to fix the problem:

--- mpi/config.links.orig Mon Jan 11 00:55:21 1999
+++ mpi/config.links Sat Mar 6 13:52:54 1999
@@ -170,11 +170,11 @@

case "${target}" in
*-*-linuxaout* | *-*-linuxoldld* | *-*-linux-gnuoldld*)
needs_underscore="y"
;;
- *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf)
+ *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf | *-freebsd3*)
needs_underscore="n"
;;
*)
needs_underscore="y"
;;

Even though FreeBSD 3.x uses the ELF binary format by default, the
$target value does NOT have "-elf" in it.

Rich Wales richw@webcom.com http://www.webcom.com/richw/
See http://www.webcom.com/richw/pgp/ for my PGP key and fingerprint info
*** NOTE: any key generated by me before 1997-09-18 has been REVOKED ***
Re: FreeBSD 3.x requires change in mpi/config.links [ In reply to ]
> I just upgraded to FreeBSD 3.1, and GnuPG 0.9.3 won't compile "as is"
> any more.
>
> The problem appears to be that FreeBSD 3.x doesn't use underscore (_)
> characters on external symbols -- but the "mpi/config.links" script
> doesn't recognize the target (i386-unknown-freebsd3.1) and tries to
> prepend underscores to the external symbols used by the assembly
> language routines in the MPI library.
>
> The following patch appears to fix the problem:
>
> --- mpi/config.links.orig Mon Jan 11 00:55:21 1999
> +++ mpi/config.links Sat Mar 6 13:52:54 1999
> @@ -170,11 +170,11 @@
>
> case "${target}" in
> *-*-linuxaout* | *-*-linuxoldld* | *-*-linux-gnuoldld*)
> needs_underscore="y"
> ;;
> - *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf)
> + *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf | *-freebsd3*)
> needs_underscore="n"
> ;;
> *)
> needs_underscore="y"
> ;;
>
> Even though FreeBSD 3.x uses the ELF binary format by default, the
> $target value does NOT have "-elf" in it.

I'm not sure about FreeBSD 3.1, but FreeBSD 3.0 can be switched between
using ELF and "a.out" format for compiler output, and understands
both formats for loadable programs. I attach a copy of an appropriate
manual page from FreeBSD 3.0 which may help: the command "/usr/bin/objformat"
just calls this routine and "prints" the output value to the standard output.

GETOBJFORMAT(3) FreeBSD Library Functions Manual GETOBJFORMAT(3)

NAME
getobjformat - get preferred object file format

SYNOPSIS
#include <objformat.h>

int
getobjformat(char *buf, size_t bufsize, int *argcp, char **argv)

DESCRIPTION
getobjformat() queries several sources to determine the preferred object
file format, and copies its name into a buffer provided by the caller.

The object file format is determined as follows. If argv is non-NULL and
an explicit command line argument such as -aout or -elf is present, then
that determines the object file format.

Otherwise, if the variable OBJFORMAT is set in the environment, the ob-
ject file format is taken from its value.

Otherwise, if the file /etc/objformat is readable and contains a line of
the form `OBJFORMAT=xxx', the object file format is taken from there.

Otherwise, a built-in system default object file format is returned.

buf points to a user-supplied buffer into which the name of the object
file format is copied. bufsize gives the size of the buffer in bytes.
The string placed in buf is always null-terminated. It is an error if
the buffer is too small to hold the null-terminated name.

argv points to a NULL-terminated argument vector to be scanned for object
format options. argv may be NULL, in which case the argument vector is
not scanned.

If argcp is non-NULL, any object format options are deleted from the ar-
gument vector, and the updated argument count is stored into the integer
referenced by argcp. If argcp is NULL, the argument vector is left un-
changed.

RETURN VALUES
On success, getobjformat() returns the length of the object file format
name, not counting the null terminator. If the supplied buffer is too
small to hold the object file format and its null terminator,
getobjformat() returns -1. In that case, the contents of the buffer and
argument vector supplied by the caller are indeterminate.

ENVIRONMENT
OBJFORMAT

FILES
/etc/objformat

SEE ALSO
objformat(1)

HISTORY
The getobjformat() function first appeared in FreeBSD 3.0.

FreeBSD September 7, 1998 1

--
David Pick
Re: FreeBSD 3.x requires change in mpi/config.links [ In reply to ]
Rich Wales wrote:
> --- mpi/config.links.orig Mon Jan 11 00:55:21 1999
> +++ mpi/config.links Sat Mar 6 13:52:54 1999
> @@ -170,11 +170,11 @@
>
> case "${target}" in
> *-*-linuxaout* | *-*-linuxoldld* | *-*-linux-gnuoldld*)
> needs_underscore="y"
> ;;
> - *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf)
> + *-*-linux* | *-sysv* | *-solaris* | *-gnu* | *-freebsd*-elf | *-freebsd3*)
> needs_underscore="n"
> ;;
> *)

This is not correct. When someone upgrade to FreeBSD 3.0 from older
version, it may be i386-unknown-freebsd3.0-aout. And gnupg 0.9.3 cannot
handle FreeBSD-current (i386-unknown-freebsd4.0).

I've updated my port. Please cvsup and test it.

Werner, can you add my patch into next version of gnupg?


--
Jun Kuriyama // kuriyama@sky.rim.or.jp
// kuriyama@FreeBSD.ORG
Re: FreeBSD 3.x requires change in mpi/config.links [ In reply to ]
Jun Kuriyama <kuriyama@sky.rim.or.jp> writes:

> Werner, can you add my patch into next version of gnupg?

Done. I replaced the needs_underscore case by the test used in glib -
Hope this works better.

--
Werner Koch at guug.de www.gnupg.org keyid 621CC013