unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* Re: Macro expansion
       [not found] ` <87lj2lgavf.fsf@ossau.uklinux.net>
@ 2011-01-15 23:11   ` Hans Aberg
  2011-01-16 10:00     ` Guile 1.9.14 & GIT version linking errror Hans Aberg
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Aberg @ 2011-01-15 23:11 UTC (permalink / raw)
  To: Neil Jerram; +Cc: bug-guile, guile-user


On 15 Jan 2011, at 21:39, Neil Jerram wrote:

> With my current Guile,
>
> scheme@(guile-user)> (version)
> $4 = "1.9.14.17-44f43"
>
> the third case behaves as you would expect:

That is right, I used the stable versions 1.8.x, x = 7, 8.  
Unfortunately, when I try to install guile-1.9.14, I get the error  
below (Mac OS X 10.5.8 PPC G4).



ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o  
and .libs/libguile_2.0_la-alist.o




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Guile 1.9.14 & GIT version linking errror
  2011-01-15 23:11   ` Macro expansion Hans Aberg
@ 2011-01-16 10:00     ` Hans Aberg
  2011-01-16 10:18       ` Neil Jerram
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Aberg @ 2011-01-16 10:00 UTC (permalink / raw)
  To: bug-guile

On 16 Jan 2011, at 00:11, Hans Aberg wrote:

> ... when I try to install guile-1.9.14, I get the error below (Mac  
> OS X 10.5.8 PPC G4).
>
> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o  
> and .libs/libguile_2.0_la-alist.o

And I get the same error when using GIT.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 10:00     ` Guile 1.9.14 & GIT version linking errror Hans Aberg
@ 2011-01-16 10:18       ` Neil Jerram
  2011-01-16 10:27         ` Neil Jerram
                           ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Neil Jerram @ 2011-01-16 10:18 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile

Hans Aberg <haberg-1@telia.com> writes:

> On 16 Jan 2011, at 00:11, Hans Aberg wrote:
>
>> ... when I try to install guile-1.9.14, I get the error below (Mac
>> OS X 10.5.8 PPC G4).
>>
>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>> and .libs/libguile_2.0_la-alist.o
>
> And I get the same error when using GIT.

Well, I guess the next steps are to

- look under /usr/include to find out which header file defines
  ___gmpz_abs (probably one of GMP's)

- understand why it is being _defined_ twice, as opposed to just
  declared

- see if there is some incantation we can add to the Guile source to
  prevent the double definition.

Would you be able to have a look at that?

     Neil



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 10:18       ` Neil Jerram
@ 2011-01-16 10:27         ` Neil Jerram
  2011-01-16 10:38         ` Hans Aberg
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Neil Jerram @ 2011-01-16 10:27 UTC (permalink / raw)
  To: Hans Aberg; +Cc: bug-guile

Neil Jerram <neil@ossau.uklinux.net> writes:

> Hans Aberg <haberg-1@telia.com> writes:
>
>> On 16 Jan 2011, at 00:11, Hans Aberg wrote:
>>
>>> ... when I try to install guile-1.9.14, I get the error below (Mac
>>> OS X 10.5.8 PPC G4).
>>>
>>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>>> and .libs/libguile_2.0_la-alist.o
>>
>> And I get the same error when using GIT.
>
> Well, I guess the next steps are to
>
> - look under /usr/include to find out which header file defines
>   ___gmpz_abs (probably one of GMP's)
>
> - understand why it is being _defined_ twice, as opposed to just
>   declared
>
> - see if there is some incantation we can add to the Guile source to
>   prevent the double definition.
>
> Would you be able to have a look at that?

Actually, forget that.  I see from Google that this is a longstanding
problem caused by MacOS compiler bugs, and nothing to do with header
files.  It looks like the information needed to address this is out
there, for someone who wants to pull it together; unfortunately I don't
have time to do that right now.

       Neil



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 10:18       ` Neil Jerram
  2011-01-16 10:27         ` Neil Jerram
@ 2011-01-16 10:38         ` Hans Aberg
  2011-01-16 12:04         ` Hans Aberg
  2011-01-16 14:32         ` Hans Aberg
  3 siblings, 0 replies; 9+ messages in thread
From: Hans Aberg @ 2011-01-16 10:38 UTC (permalink / raw)
  To: Neil Jerram; +Cc: bug-guile

On 16 Jan 2011, at 11:18, Neil Jerram wrote:

>>> ... when I try to install guile-1.9.14, I get the error below (Mac
>>> OS X 10.5.8 PPC G4).
>>>
>>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>>> and .libs/libguile_2.0_la-alist.o
>>
>> And I get the same error when using GIT.
>
> Well, I guess the next steps are to
>
> - look under /usr/include to find out which header file defines
>  ___gmpz_abs (probably one of GMP's)

There is only one match, in /usr/local/include/gmp.h:
   gmp.h:#define mpz_abs __gmpz_abs

> - understand why it is being _defined_ twice, as opposed to just
>  declared

There are both dynamic (.dylib) and static (.a) versions of gmplib. So  
perhaps the static is linked more than once.

It might happen if say you expect the dynamic library ending with .so  
instead of .dylib, or if using the wrong dynamic linking flag.

> - see if there is some incantation we can add to the Guile source to
>  prevent the double definition.


There is no problem with the stable branch, 1.8.8. So perhaps you  
might check what you do differently.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 10:18       ` Neil Jerram
  2011-01-16 10:27         ` Neil Jerram
  2011-01-16 10:38         ` Hans Aberg
@ 2011-01-16 12:04         ` Hans Aberg
  2011-01-16 14:32         ` Hans Aberg
  3 siblings, 0 replies; 9+ messages in thread
From: Hans Aberg @ 2011-01-16 12:04 UTC (permalink / raw)
  To: Neil Jerram; +Cc: bug-guile

On 16 Jan 2011, at 11:18, Neil Jerram wrote:

>>> ... when I try to install guile-1.9.14, I get the error below (Mac
>>> OS X 10.5.8 PPC G4).
>>>
>>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>>> and .libs/libguile_2.0_la-alist.o
>>
>> And I get the same error when using GIT.

> - understand why it is being _defined_ twice, as opposed to just
>  declared

There might be a problem with GMP inlining. A lot of binary files  
match by 'grep -r mpz_abs *', but no source files. The header /usr/ 
local/include/gmp.h has a section inlining (below). The macro  
__GMP_EXTERN_INLINE is turned on by another section:

  /* gcc has __inline__ in all modes, including strict ansi.  Give a  
prototype
     for an inline too, so as to correctly specify "dllimport" on  
windows, in
     case the function is called rather than inlined.
     GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
     inline semantics, unless -fgnu89-inline is used.  */
#ifdef __GNUC__
#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__  
== 2)
#define __GMP_EXTERN_INLINE extern __inline__ __attribute__  
((__gnu_inline__))
#else
#define __GMP_EXTERN_INLINE      extern __inline__
#endif
#define __GMP_INLINE_PROTOTYPES  1
#endif

...

/* The following are provided as inlines where possible, but always  
exist as
    library functions too, for binary compatibility.

    Within gmp itself this inlining generally isn't relied on, since it
    doesn't get done for all compilers, whereas if something is worth
    inlining then it's worth arranging always.

    There are two styles of inlining here.  When the same bit of code is
    wanted for the inline as for the library version, then  
__GMP_FORCE_foo
    arranges for that code to be emitted and the __GMP_EXTERN_INLINE
    directive suppressed, eg. mpz_fits_uint_p.  When a different bit  
of code
    is wanted for the inline than for the library version, then
    __GMP_FORCE_foo arranges the inline to be suppressed, eg.  
mpz_abs.  */

#if defined (__GMP_EXTERN_INLINE) && ! defined (__GMP_FORCE_mpz_abs)
__GMP_EXTERN_INLINE void
mpz_abs (mpz_ptr __gmp_w, mpz_srcptr __gmp_u)
{
   if (__gmp_w != __gmp_u)
     mpz_set (__gmp_w, __gmp_u);
   __gmp_w->_mp_size = __GMP_ABS (__gmp_w->_mp_size);
}
#endif





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 10:18       ` Neil Jerram
                           ` (2 preceding siblings ...)
  2011-01-16 12:04         ` Hans Aberg
@ 2011-01-16 14:32         ` Hans Aberg
  2011-01-17 22:31           ` Ludovic Courtès
  3 siblings, 1 reply; 9+ messages in thread
From: Hans Aberg @ 2011-01-16 14:32 UTC (permalink / raw)
  To: Neil Jerram; +Cc: bug-guile

On 16 Jan 2011, at 11:18, Neil Jerram wrote:

>>> ... when I try to install guile-1.9.14, I get the error below (Mac
>>> OS X 10.5.8 PPC G4).
>>>
>>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>>> and .libs/libguile_2.0_la-alist.o
>>
>> And I get the same error when using GIT.
...
> - understand why it is being _defined_ twice, as opposed to just
>  declared

You have added the flag gcc -std=gnu99, which according to the gmp.h  
header in GCC 4.3 later implements ISO C99 inline semantics, unless - 
fgnu89-inline is used. When I took away that flag from the five  
occurrences in the Makefile in libguile/, then it compiled and  
installed.

I have GCC 4.0.1. So for some reason, on this compiler, the flag seems  
causing the GMP inline functions to be added as ordinary functions,  
causing the linking problem between the copies.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-16 14:32         ` Hans Aberg
@ 2011-01-17 22:31           ` Ludovic Courtès
  2011-01-26 19:30             ` Andy Wingo
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2011-01-17 22:31 UTC (permalink / raw)
  To: bug-guile

Hi!

Hans Aberg <haberg-1@telia.com> writes:

> On 16 Jan 2011, at 11:18, Neil Jerram wrote:
>
>>>> ... when I try to install guile-1.9.14, I get the error below (Mac
>>>> OS X 10.5.8 PPC G4).
>>>>
>>>> ld: duplicate symbol ___gmpz_abs in .libs/libguile_2.0_la-arbiters.o
>>>> and .libs/libguile_2.0_la-alist.o
>>>
>>> And I get the same error when using GIT.
> ...
>> - understand why it is being _defined_ twice, as opposed to just
>>  declared
>
> You have added the flag gcc -std=gnu99, which according to the gmp.h
> header in GCC 4.3 later implements ISO C99 inline semantics, unless - 
> fgnu89-inline is used. When I took away that flag from the five
> occurrences in the Makefile in libguile/, then it compiled and
> installed.

That’s probably the problem that’s documented in libguile/inline.h (see
below).

> I have GCC 4.0.1.

No you don’t.  This is Apple’s compiler, based on GCC, but with its own
inline semantics, and a behavior different from that of GCC.

Anyway you found a workaround, which is what matters.  :-)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Guile 1.9.14 & GIT version linking errror
  2011-01-17 22:31           ` Ludovic Courtès
@ 2011-01-26 19:30             ` Andy Wingo
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Wingo @ 2011-01-26 19:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guile

On Mon 17 Jan 2011 23:31, ludo@gnu.org (Ludovic Courtès) writes:

> Hans Aberg <haberg-1@telia.com> writes:
>
>> I have GCC 4.0.1.
>
> No you don’t.  This is Apple’s compiler, based on GCC, but with its own
> inline semantics, and a behavior different from that of GCC.
>
> Anyway you found a workaround, which is what matters.  :-)

When I compile on a Mac 10.5 system, I have to export CC=gcc-4.2.  Both
the Apple 4.0.1 and whatever their 4.2 compiler are installed, but `gcc'
is the old one.

How these compilers do inlining is one of the salient differences
between the two.  I made sure to compile a new gmp, using gcc-4.2, and
compile Guile with that compiler as well.

Happy hacking,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-01-26 19:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <13B7D376-7BFD-4236-B6EF-5BF70FE248B7@telia.com>
     [not found] ` <87lj2lgavf.fsf@ossau.uklinux.net>
2011-01-15 23:11   ` Macro expansion Hans Aberg
2011-01-16 10:00     ` Guile 1.9.14 & GIT version linking errror Hans Aberg
2011-01-16 10:18       ` Neil Jerram
2011-01-16 10:27         ` Neil Jerram
2011-01-16 10:38         ` Hans Aberg
2011-01-16 12:04         ` Hans Aberg
2011-01-16 14:32         ` Hans Aberg
2011-01-17 22:31           ` Ludovic Courtès
2011-01-26 19:30             ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).