Re: Building asterisk - undefined reference to `__sync_fetch_and_add_4'

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Mon, 10 Sep 2007 15:12:48 +0200
Quoting Ian FREISLICH <ianf_at_clue.co.za> (from Mon, 10 Sep 2007  
14:35:30 +0200):

> Luigi Rizzo wrote:
>> On Mon, Sep 10, 2007 at 12:04:10PM +0200, Ian FREISLICH wrote:
>> > Hi
>> >
>> > I was wondering if anyone else is having this problem building
>> > asterisk on -CURRENT.  The problem may not be with FreeBSD - it
>> > looks like gnu configure is incorrectly detecting the CPU as "i386"
>> > when it's actually a pentium3:
>> >
>> > configure: Package configured for:
>> > configure: OS type  : freebsd7.0
>> > configure: Host CPU : i386
>> > ===>  Building for asterisk-1.4.11
>> >
>> > The i386 doesn't have any atomic primatives or something like that
>> > (maybe just according to gcc-4.2).  If I frob the configured sources
>> > and change the i386 to pentium3, then the build works, but I don't
>> > have enough asterisk foo at this point to verify that it actually
>> > works.
>>
>> i don't completely understand what is happening here - i386 presumably
>> refers to the architecture, not to the very-low-level details of
>> the architecture, so there should not be anything specific to
>> one processor of the family in the flags passed to the compiler.
>
> The trouble is that the asterisk build translates this into -march=i386
> and -mcpu=i386 or -mtune=i386 which has that low level effect.  At
> least the old asterisk port did this, I haven't yet figured out
> what the new 1.4.11 asterisk is doing.
>
> I'm inclined to believe that i386 in the FreeBSD context means
> something fundamentally different to the same in the Linux context.

On Linux this is set to the target architecture which shall be  
supported. Values are i386, i486, i586, ... and maybe some not so  
generic ones like pentium4 (maybe all values which gcc supports for  
-march).

We just put the architecture of the system (${ARCH}) into it. On  
FreeBSD-amd64 this is amd64 (linux uses x86_64), for FreeBSD-i386 this  
is i386, ...

I think we don't set it to something else, because nobody cared to do  
it so far. Now... when you have a look at  
http://www.Leidinger.net/FreeBSD/port-patches/Mk:bsd.port.mk.diff you  
will see (if you search for it, the diff contains more than just this  
patch) how we could do this based upon the value of CPUTYPE (the  
packages are tailored to the same CPU as the world).

Bye,
Alexander.

-- 
Men of peace usually are [brave].
		-- Spock, "The Savage Curtain", stardate 5906.5

http://www.Leidinger.net    Alexander _at_ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild _at_ FreeBSD.org  : PGP ID = 72077137
Received on Mon Sep 10 2007 - 11:13:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:17 UTC