Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Sep 2007 15:12:48 +0200
From:      Alexander Leidinger <Alexander@Leidinger.net>
To:        Ian FREISLICH <ianf@clue.co.za>
Cc:        Luigi Rizzo <rizzo@icir.org>, current@freebsd.org
Subject:   Re: Building asterisk - undefined reference to `__sync_fetch_and_add_4'
Message-ID:  <20070910151248.2ayzbtrdww40kkso@webmail.leidinger.net>
In-Reply-To: <E1IUiUE-000NkE-7B@clue.co.za>
References:  <E1IUiUE-000NkE-7B@clue.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
Quoting Ian FREISLICH <ianf@clue.co.za> (from Mon, 10 Sep 2007 =20
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
>> > =3D=3D=3D>  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=3Di386
> and -mcpu=3Di386 or -mtune=3Di386 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 =20
supported. Values are i386, i486, i586, ... and maybe some not so =20
generic ones like pentium4 (maybe all values which gcc supports for =20
-march).

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

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

Bye,
Alexander.

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

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID =3D B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID =3D 72077137



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070910151248.2ayzbtrdww40kkso>