[Home]

Summary:ASTERISK-04316: [patch] Problem Compiling Add-ons On Mac OS X 10.4.1
Reporter:Michael Stearne (mstearne)Labels:
Date Opened:2005-06-01 23:09:58Date Closed:2005-06-21 11:29:03
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) patch-rev1.diff
Description:Asterisk compiles fine after upgrading the bison installation on 10.4.1 (I used DarwinPorts to upgrade to bison 2.0).  

But when I try to compile add-ons the I get a complaint from the compiler about the use of the -shared option.  Is there a work around for this?

root# make
make -C format_mp3 all
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6  -shared -Xlinker -x -o format_mp3.so common.o dct64_i386.o decode_ntom.o layer3.o tabinit.o interface.o format_mp3.o
powerpc-apple-darwin8-gcc-4.0.0: unrecognized option `-shared'
/usr/bin/ld: Undefined symbols:
_main
_ast_log
_ast_format_register
_ast_format_unregister
_ast_update_use_count
collect2: ld returned 1 exit status
make[1]: *** [format_mp3.so] Error 1
make: *** [format_mp3/format_mp3.so] Error 2      
Comments:By: Olle Johansson (oej) 2005-06-02 01:58:29

Please report portability issues in the "Portability" category. Thanks! /O

By: Olle Johansson (oej) 2005-06-02 01:59:08

Which version of GCC?

By: Michael Stearne (mstearne) 2005-06-02 03:38:33

Sorry, I wasn't sure about the category.  The issue happens using either gcc 4.0 or gcc 3.3.

By: Olle Johansson (oej) 2005-06-02 04:27:02

I wasn't awake either - it says gcc-4 above... ;-(

By: Michael Stearne (mstearne) 2005-06-02 10:09:39

Maybe something like the following which is used in the Makefile for Asterisk can be used:

ifeq (${OSARCH},Darwin)
OBJS+=poll.o dlfcn.o
ASTLINK=-Wl,-dynamic
SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
else
ASTLINK=-Wl,-E
SOLINK=-shared -Xlinker -x
endif
ifeq (${OSARCH},SunOS)
OBJS+=strcompat.o
ASTLINK=
SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
endif

By: Brian West (bkw918) 2005-06-02 12:06:02

Close... The attached patch compiles, runs on my G5 with 10.4.1

/b

By: Mark Spencer (markster) 2005-06-02 13:26:22

Fixed in CVS head.

By: Michael Stearne (mstearne) 2005-06-02 14:19:13

Still seems to not work when you pull it from CVS.  The changes were gotten successfully but the Makefiles in all the parts of add-ons have to be changed. You can make it when you are in the format_mp3 directory but mot when you do the make from asterisk-addons directory.


/usr/src/asterisk-addons root# make
./mkdep -fPIC -I../asterisk -D_GNU_SOURCE -I/usr/local/mysql/include    `ls *.c`
make -C format_mp3 all
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o common.o common.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o dct64_i386.o dct64_i386.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o decode_ntom.o decode_ntom.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o layer3.o layer3.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o tabinit.o tabinit.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o interface.o interface.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6    -c -o format_mp3.o format_mp3.c
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6  -dynamic -bundle -undefined suppress -force_flat_namespace -o format_mp3.so common.o dct64_i386.o decode_ntom.o layer3.o tabinit.o interface.o format_mp3.o
cc -fPIC -I../asterisk -D_GNU_SOURCE -I/usr/local/mysql/include      -c -o app_saycountpl.o app_saycountpl.c
cc -shared -Xlinker -x -o app_saycountpl.so app_saycountpl.o
powerpc-apple-darwin8-gcc-4.0.0: unrecognized option `-shared'
/usr/bin/ld: Undefined symbols:
_main
_ast_log
_ast_register_application
_ast_softhangup
_ast_streamfile
_ast_unregister_application
_ast_update_use_count
_ast_waitstream
collect2: ld returned 1 exit status
make: *** [app_saycountpl.so] Error 1
rm app_saycountpl.o

By: Michael Jerris (mikej) 2005-06-05 21:57:28

bkw can you confirm this is still an issue for you in the main addons makefile?

By: Russell Bryant (russell) 2005-06-14 15:13:09

re-opening since it appears that cvs head still requires some more modifications to work properly

By: Kevin P. Fleming (kpfleming) 2005-06-20 21:33:50

Fixed in CVS HEAD (again), thanks!

By: Michael Stearne (mstearne) 2005-06-20 23:25:25

I am not sure this is fixed. I just checked out:

cvs checkout asterisk-addons

and ran 'make' and got:

...
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations   -D_REENTRANT -D_GNU_SOURCE  -O6  -dynamic -bundle -undefined suppress -force_flat_namespace -o format_mp3.so common.o dct64_i386.o decode_ntom.o layer3.o tabinit.o interface.o format_mp3.o
cc -fPIC -I../asterisk -D_GNU_SOURCE -I/usr/local/mysql/include      -c -o app_saycountpl.o app_saycountpl.c
cc -shared -Xlinker -x -o app_saycountpl.so app_saycountpl.o
powerpc-apple-darwin8-gcc-4.0.0: unrecognized option '-shared'
/usr/bin/ld: Undefined symbols:
_main
_ast_log
_ast_register_application
_ast_softhangup
_ast_streamfile
_ast_unregister_application
_ast_update_use_count
_ast_waitstream
collect2: ld returned 1 exit status
make: *** [app_saycountpl.so] Error 1
rm app_saycountpl.o

By: Kevin P. Fleming (kpfleming) 2005-06-21 11:28:47

Yeah, my fix was clearly incomplete... It's fixed properly in CVS HEAD now, tested by one of our techs here.