Summary:ASTERISK-07196: [patch] Asterisk build errors and fixes for gcc 4.0.2 and Solaris 2.8 64bit
Reporter:Bob Atkins (bob)Labels:
Date Opened:2006-06-17 16:03:20Date Closed:2006-06-29 17:02:19
Versions:Frequency of
Environment:Attachments:( 0) 20060629__7388_trunk.diff.txt
( 1) 20060629__bug7388.diff.txt
( 2) Makefile_res.diff
( 3) Makefile.diff
Description:Makefile errors due to compatibility with Solaris prevents successful build.

I have successfully built v1.2.7.1 and now v1.2.9.1 by applying a series of fixes to the main Makefile and the res Makefile. The result is a smooth automatic build of Asterisk using gcc 4.0.2 and ginstall with automatic detection of 32 or 64 bit sparc platforms. To build 64 bit gcc v3 or later must be used.

I have also adjusted the paths to some of the Solaris install locations because they just don't follow the typical Solaris path standards.

BTW, we are running Asterisk on a Sun Enterprise 4500 system with the following specs in commercial service:

Solaris 2.8
8x 400MHz processors
8GBytes ram

Asterisk has shown good performance with load levels approaching 150 with 100% CPU saturation.


I am new to this development and I haven't been able to figure out how code changes can be submitted so I am including the patch differences here for review and possible incorporation.

Changes to the main Makefile follow:

-- Paste snipped by vechers -- See patch files attached.
Comments:By: Tilghman Lesher (tilghman) 2006-06-18 12:00:32

Please UPLOAD your patch, in UNIFIED format, to the file upload area.  Do not paste your patch into a bugnote.

By: Serge Vecher (serge-v) 2006-06-19 09:55:29

bob: here is how-to of patchmaking http://www.asterisk.org/developers/Patch_Howto

Also, you will need to get a disclaimer on file in order for this patch to be considered. See the bottom of this page: http://bugs.digium.com/main_page.php

By: Bob Atkins (bob) 2006-06-20 04:16:31

Sorry for placing the patch in the bugnote.

I faxed in my disclaimer as requested.

Please reference the attached files for the corrections to the main Makefile (Makefile.diff) and the res/Makefile (Makefile_res.diff)

By: Tilghman Lesher (tilghman) 2006-06-20 10:20:49

These are the changes I'm prepared to make.  Please note that the path changes are an incompatible change in the release branch and can only go into trunk.

Please check that this patch still allows Solaris to compile.

By: Serge Vecher (serge-v) 2006-06-28 11:51:21

Bob: need your feedback on bug7388.patch by Corydon.

By: Bob Atkins (bob) 2006-06-29 04:31:06

The test compile is not successful using the changes in attached patch file (bug7388.patch).

The compile fails at:

gcc -g3  -o asterisk  io.o sched.o logger.o frame.o loader.o config.o channel.o translate.o file.o say.o pbx.o cli.o md5.o term.o ulaw.o alaw.o callerid.o fskmodem.o image.o app.o cdr.o tdd.o acl.o rtp.o manager.o asterisk.o dsp.o chanvars.o indications.o autoservice.o db.o privacy.o astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o netsock.o slinfactory.o ast_expr2.o ast_expr2f.o cryptostub.o strcompat.o buildinfo.o editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a -lncurses -lm -lpthread -ldl -lnsl -lsocket -lresolv -L/opt/ssl/lib -L/usr/local/ssl/lib -lssl
ld: fatal: library -lncurses: not found
ld: fatal: File processing errors. No output written to asterisk
collect2: ld returned 1 exit status
make: *** [asterisk] Error 1

The problem is that the LIBS variable is incorrect for a Solaris build and needs to be set to exactly the following:

LIBS=-lm -lcurses -lpthread -ldl -lnsl -lsocket -lresolv

This is a change shown in my original Makefile.diff attached to this bug report. Making this change to the Makefile manually after bug7388.patch has been applied allows the compilation to complete successfully.

The optimization and debug setting changes were also not included in the bug7388.patch file.

I do not understand why OPTIMIZE+=-O6 is defined as -O6 is not a valid gcc optimization. -O3 is a valid optimize option.

Lastly, and this is a pet issue of mine with regards to most open source software. DEBUG=-g3 should not be set by default in the Makefile. The vast majority of open source software is built for production use and not for a developer to debug. There is no reason for any -g options to be set in the Makefile by default for a standard compilation. I regularly find myself going through substantial efforts on all open source compiles to remove all traces of -g options and add -O3 optimizations so that the resulting executables are lean and fast for production use.

I'm sure that developers will like to have -g options by default in the Makefile but the other 99% prefer not to have it in order to keep the executable down to a sensible size.

By: Tilghman Lesher (tilghman) 2006-06-29 09:11:22

The LIBS problem has been taken care of in the latest patch.  Please test.

As far as the optimize and debug flags, they will not change in the middle of a release.  You're welcome to make the same arguments for the development version, as it is about to be branched into a release.

By: Bob Atkins (bob) 2006-06-29 13:48:44

I am happy to report that the latest patch file (20060629__bug7388.diff.txt) resulted in a clean and error free compile.

By: Tilghman Lesher (tilghman) 2006-06-29 17:02:19

Committed to 1.2; merged to trunk.