Summary:ASTERISK-18651: Compile failure Debian/sparc64
Reporter:Jeremy Kister (jkister)Labels:
Date Opened:2011-10-03 01:48:37Date Closed:2012-07-10 03:50:21
Status:Closed/CompleteComponents:Core/BuildSystem Core/Portability
Versions: Frequency of
is related toASTERISK-17022 compiling error in ubuntu 9.04 sparc
Environment:Debian 6.0.2Attachments:( 0) bug18651.diff.txt
Description:possibly related to ASTERISK-17022
Comments:By: Jeremy Kister (jkister) 2011-10-03 01:49:12.036-0500

   [CC] recno/rec_utils.c -> recno/rec_utils.o
  [AR] hash/hash.o hash/hash_bigkey.o hash/hash_buf.o hash/hash_func.o hash/hash_log2.o hash/hash_page.o hash/ndbm.o btree/bt_close.o btree/bt_conv.o btree/bt_debug.o btree/bt_delete.o btree/bt_get.o btree/bt_open.o btree/bt_overflow.o btree/bt_page.o btree/bt_put.o btree/bt_search.o btree/bt_seq.o btree/bt_split.o btree/bt_utils.o db/db.o mpool/mpool.o recno/rec_close.o recno/rec_delete.o recno/rec_get.o recno/rec_open.o recno/rec_put.o recno/rec_search.o recno/rec_seq.o recno/rec_utils.o -> libdb1.a
  [LD] abstract_jb.o acl.o alaw.o aoc.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autochan.o autoservice.o bridging.o callerid.o ccss.o cdr.o cel.o channel.o chanvars.o cli.o config.o data.o datastore.o db.o devicestate.o dial.o dns.o dnsmgr.o dsp.o enum.o event.o features.o file.o fixedjitterbuf.o frame.o framehook.o fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o jitterbuf.o loader.o lock.o logger.o manager.o md5.o netsock.o netsock2.o pbx.o plc.o poll.o privacy.o rtp_engine.o say.o sched.o security_events.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o strings.o stun.o syslog.o taskprocessor.o tcptls.o tdd.o term.o test.o threadstorage.o timing.o translate.o udptl.o ulaw.o utils.o version.o xml.o xmldoc.o editline/libedit.a db1-ast/libdb1.a  -> asterisk
astobj2.o: In function `ast_atomic_fetchadd_int':
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
astobj2.o:/usr/local/src/asterisk- more undefined references to `__sync_fetch_and_add_4' follow
utils.o: In function `ast_atomic_dec_and_test':
/usr/local/src/asterisk- undefined reference to `__sync_sub_and_fetch_4'
utils.o: In function `ast_atomic_fetchadd_int':
/usr/local/src/asterisk- undefined reference to `__sync_fetch_and_add_4'
collect2: ld returned 1 exit status
make[1]: *** [asterisk] Error 1
make: *** [main] Error 2

By: Jeremy Kister (jkister) 2011-10-03 01:50:28.393-0500

# ./config.guess

# uname -a
Linux pbx2 2.6.32-5-sparc64 #1 Fri Sep 9 21:02:11 UTC 2011 sparc64 GNU/Linux

# gcc -v
Using built-in specs.
Target: sparc-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-8' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --with-long-double-128 --enable-checking=release --build=sparc-linux-gnu --host=sparc-linux-gnu --target=sparc-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

# make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

This program built for sparc-unknown-linux-gnu

By: Alec Davis (alecdavis) 2011-10-05 17:24:30.358-0500

Jeremy: You may be able to get it to compile by changing the -mcpu=v8 to -mcpu=v9 in /usr/src/asterisk/Makefile
note: After the above change, 'make clean' then 'make'

By: Alec Davis (alecdavis) 2011-10-05 19:38:11.504-0500

Set OPTIONS -mcpu
if compiler supports -mcpu=v9, then tries -mcpu=v8 else defaults

Also added OPTIONS= output to screen

By: Jeremy Kister (jkister) 2011-10-06 03:02:52.149-0500

Yep, thanks Alec!

I applied your patch to asterisk and it now happily compiles on debian/sparc.

By: Paul Belanger (pabelanger) 2011-10-12 11:18:53.546-0500

If you want to get this up on reviewboard we can see about merging it for

By: Jeremy Kister (jkister) 2012-06-21 21:43:34.205-0500

Seems as if the behavior is the same in asterisk 10.5.1

Alec, is your patch meant for distribution?  or was it just a quick hack to help me out of a jam ?

By: Alec Davis (alecdavis) 2012-06-22 03:26:32.122-0500

please see https://reviewboard.asterisk.org/r/1852/ which I understood to completly remove the need for my patch.

By: Jeremy Kister (jkister) 2012-07-10 03:50:21.633-0500

seems as though this is fixed as of 10.5.2