[Home]

Summary:ASTERISK-02289: [request] Makefiles do not correctly recognize existence of UTRASPARC Family of CPU's.
Reporter:belgarath (belgarath)Labels:
Date Opened:2004-08-29 15:39:57Date Closed:2008-01-15 15:06:11.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk.txt
Description:The ultrasparc (sparc v9 ELF64) family of CPU's is unsupported by the current Makefile's for zaptel, asterisk or libpri in any way.

In addition The only 64 bit support described in them is for the AMD cpu's.

SPARC 64bit support is sadly ignored and thus unavailable for this very stable and reliable platform commonly used by the telecommunications industry.

This support is needed for compilation, especially zaptel as card drivers will not work with kernels compiled for this arch.

Without this support Asterisk refused to fully compile without heavy changes to the assorted individual Makefile's

Without this support zaptel drivers will fail to be loaded by the kernel sighting 'Invalid architecture' as the source of the error.


****** STEPS TO REPRODUCE ******

Follow the build instructions in the asterisk readme or at http://www.asterisk.org/index.php?menu=download

****** ADDITIONAL INFORMATION ******

This also couses all asterisk codecs that take values passed from the original top root asterisk Makefile to fail to compile due to invalid options.

The following is the 'make' output for the first codec to fail:

make[2]: Entering directory `/usr/src/asterisk/codecs/gsm'
gcc -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g  -Iinclude -I../include -D_REENTRANT -D_GNU_SOURCE  -O6    -DZAPTEL_OPTIMIZATIONS  -DASTERISK_VERSION=\"CVS-HEAD-08/29/04-13:58:02\" -DINSTALL_PREFIX=\"\" -DASTETCDIR=\"/etc/asterisk\" -DASTLIBDIR=\"/usr/lib/asterisk\" -DASTVARLIBDIR=\"/var/lib/asterisk\" -DASTVARRUNDIR=\"/var/run\" -DASTSPOOLDIR=\"/var/spool/asterisk\" -DASTLOGDIR=\"/var/log/asterisk\" -DASTCONFPATH=\"/etc/asterisk/asterisk.conf\" -DASTMODDIR=\"/usr/lib/asterisk/modules\" -DASTAGIDIR=\"/var/lib/asterisk/agi-bin\"     -DBUSYDETECT_MARTIN      -fPIC   -c -DNeedFunctionPrototypes=1 -funroll-loops -fPIC -O6 -march=sparc64 -fomit-frame-pointer -DSASR -DNDEBUG    -DWAV49   -I./inc src/add.c
cc1: Invalid option `arch=sparc64'
make[2]: *** [src/add.o] Error 1
make[2]: Leaving directory `/usr/src/asterisk/codecs/gsm'
make[1]: *** [gsm/lib/libgsm.a] Error 2
make[1]: Leaving directory `/usr/src/asterisk/codecs'
make: *** [subdirs] Error 1
Comments:By: Tilghman Lesher (tilghman) 2004-08-29 16:53:00

This is a feature request, not a bug.

By: belgarath (belgarath) 2004-08-30 14:24:45

Asterisk will not compile therefor it's a bug. Anytime code will not compile due to a broken build system it is a large, severe, bug.

By: Olle Johansson (oej) 2004-08-30 15:02:02

Check http://www.voip-info.org/wiki-Asterisk+Solaris+Support for more information.
You can also use the asterisk-bsd mailing list, where you'll reach a lot of portability experts.

By: Olle Johansson (oej) 2004-08-30 15:02:41

Will re-open when we have patches. Until then, this report stays in archive.

By: belgarath (belgarath) 2004-08-30 15:30:51

I don't really see why people are being so hostile over this. All you need to do for now is the following:

In the main asterisk Makefile:

replace this:

ifeq (${OSARCH},Linux)
PROC=$(shell uname -m)
ifeq ($(PROC),x86_64)
# You must have GCC 3.4 to use k8, otherwise use athlon
PROC=k8
#PROC=athlon
OPTIONS+=-m64
endif
endif

With this:
ifeq (${OSARCH},Linux)
PROC=$(shell uname -m)
ifeq ($(PROC),x86_64)
# You must have GCC 3.4 to use k8, otherwise use athlon
PROC=k8
#PROC=athlon
OPTIONS+=-m64
endif
ifeq ($(PROC),sparc64)
PROC=ultrasparc
CFLAGS+=$(shell if $(CC) -mcpu=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mcpu=$(PROC)"; fi)
endif

endif



Then in the same file down a page or two replace:

CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)


with this:
ifneq ($(PROC),ultrasparc)
CFLAGS+=$(shell if $(CC) -march=$(PROC) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=$(PROC)"; fi)
endif


Then For the asterisk/codecs/gsm/Makefile:

Replace this:

ifneq (${OSARCH},Darwin)
ifneq (${PROC},x86_64)
ifneq ($(shell uname -m),ppc)
ifneq ($(shell uname -m),alpha)
OPTIMIZE+=-march=$(PROC)
endif
endif
endif
endif


With this:
ifneq (${OSARCH},Darwin)
ifneq (${PROC},x86_64)
ifneq (${PROC},ultrasparc)
ifneq ($(shell uname -m),ppc)
ifneq ($(shell uname -m),alpha)
OPTIMIZE+=-march=$(PROC)
endif
endif
endif
endif
endif

And this:

ifeq (${OSARCH},Linux)
ifneq ($(shell uname -m),x86_64)
ifneq ($(shell uname -m),ppc)
ifneq ($(shell uname -m),alpha)
GSM_SOURCES+=   $(SRC)/k6opt.s
endif
endif
endif
endif

With this:

ifeq (${OSARCH},Linux)
ifneq ($(shell uname -m),x86_64)
ifneq ($(shell uname -m),ppc)
ifneq ($(shell uname -m),alpha)
ifneq ($(shell uname -m),sparc64)
GSM_SOURCES+=   $(SRC)/k6opt.s
endif
endif
endif
endif
endif

And this:

ifeq (${OSARCH},Linux)
ifneq ($(shell uname -m), x86_64)
ifneq ($(shell uname -m), ppc)
ifneq ($(shell uname -m), alpha)
GSM_OBJECTS+=   $(SRC)/k6opt.o
endif
endif
endif
endif

With this:

ifeq (${OSARCH},Linux)
ifneq ($(shell uname -m), x86_64)
ifneq ($(shell uname -m), ppc)
ifneq ($(shell uname -m), alpha)
ifneq ($(shell uname -m), sparc64)
GSM_OBJECTS+=   $(SRC)/k6opt.o
endif
endif
endif
endif
endif

In the asterisk/codecs/lpc10/Makefile:

Replace this:
#fix for PPC processors and ALPHA too
ifneq ($(OSARCH),Darwin)
ifneq ($(findstring BSD,${OSARCH}),BSD)
ifneq ($(PROC),ppc)
ifneq ($(PROC),x86_64)
ifneq ($(PROC),alpha)
       CFLAGS+= -march=$(PROC)
endif
endif
endif
endif
endif

With this:
#fix for PPC processors and ALPHA, And UltraSparc too
ifneq ($(OSARCH),Darwin)
ifneq ($(findstring BSD,${OSARCH}),BSD)
ifneq ($(PROC),ppc)
ifneq ($(PROC),x86_64)
ifneq ($(PROC),alpha)
ifeq ($(PROC),ultrasparc)
       CFLAGS+= -mtune=$(PROC)
else
       CFLAGS+= -march=$(PROC)
endif
endif
endif
endif
endif
endif

With these changes to the asterisk Makefiles the asterisk CVS branch will now compile under a ultrasparc system. They still need optimizations included but at least now it compiles. I know I could have given you a patch file set but I was told not to.

By: belgarath (belgarath) 2004-08-30 15:33:01

See above instructions on how to fix Makesfiles so Asterisk at least compiles.

By: belgarath (belgarath) 2004-08-30 15:46:43

And for the record as the bug report states, This is under Linux. Not BSD or Solaris.

I would edit the makefiles in the cvs myself if I had the ability. If you want a patch set commands you want used to make it and ask.

By: Tilghman Lesher (tilghman) 2004-08-30 16:03:55

Please upload your patch in the file section.  Patch should be the output of:
cvs diff -u

By: Mark Spencer (markster) 2004-08-30 16:04:38

Linux/sparc64 is not one of Asterisk's presumed targets, thus the consideration that this is a feature request vs. a bug.

In any case can you supply a cvs diff -u so we can get the patch in CVS?  Thanks!

By: belgarath (belgarath) 2004-08-30 16:23:09

Here is the file I got as output from the following system command:

cvs diff -u > changed.txt

By: belgarath (belgarath) 2004-08-30 16:42:46

To get a idea on how slow the default compile of something in a SPARC based system can be I present to you the following link:

http://marc.theaimsgroup.com/?l=linux-sparc&m=101663078400634&w=2

As you can see compiling for the CPU in question would greatly improve performance for asterisk and its assorted bedfellows.

If you need anything else just ask.

By: Mark Spencer (markster) 2004-08-30 17:46:12

This patch did not apply to latest CVS, can you please update to latest CVS and provide an updated patch?  Thanks!

By: belgarath (belgarath) 2004-08-30 19:25:51

I have no idea why it would not patch; I used the cvs current as of today to do it.

cvs diff -u > changed.txt added.

By: belgarath (belgarath) 2004-08-30 19:31:20

Crap. I added the wrong line to the second added file to the bugtracker. Just wait a sec as I do it right this time.

By: belgarath (belgarath) 2004-08-30 19:39:53

Ok trhat should work perfectly.

By: Mark Spencer (markster) 2004-08-30 20:07:19

I still can't seem to get it to apply:

[root@dhcp-34 asterisk]# patch -p0 < /tmp/asterisk.txt
(Stripping trailing CRs from patch.)
patching file Makefile
(Stripping trailing CRs from patch.)
patching file codecs/gsm/Makefile
Hunk #3 FAILED at 205.
Hunk #4 FAILED at 256.
2 out of 4 hunks FAILED -- saving rejects to file codecs/gsm/Makefile.rej
(Stripping trailing CRs from patch.)
patching file codecs/lpc10/Makefile
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 25.
1 out of 1 hunk FAILED -- saving rejects to file codecs/lpc10/Makefile.rej
[root@dhcp-34 asterisk]#

By: belgarath (belgarath) 2004-08-30 21:27:15

Try this next one. Number 4.

By: belgarath (belgarath) 2004-08-30 21:35:02

A copy of the file in question is also available at http://www.hakt.tk/asterisk-sparc.patch

Every copy so far has been transferred from 3 separate hosts to wind up as a upload create by cutting and pasting from a putty terminal. Maybe the format is begin munged in transit. If so this file still on the server used to port should work perfectly.

edited on: 08-30-04 21:54

By: Mark Spencer (markster) 2004-08-30 23:28:42

Great, fixed in CVS.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:06:11.000-0600

Repository: asterisk
Revision: 3684

U   trunk/Makefile
U   trunk/codecs/gsm/Makefile
U   trunk/codecs/lpc10/Makefile

------------------------------------------------------------------------
r3684 | markster | 2008-01-15 15:06:10 -0600 (Tue, 15 Jan 2008) | 2 lines

Adjust Makefiles to support Ultrasparc architecture (thanks Belgarath) (bug ASTERISK-2289)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3684