[Home]

Summary:ASTERISK-15142: Symbol referencing errors (MIN/MAX in channel.o/udptl.o)
Reporter:Bruce McAlister (asgaroth)Labels:
Date Opened:2009-11-16 05:01:37.000-0600Date Closed:2010-01-08 09:21:35.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When building asterisk 1.6.0.18-rc3 I am faced with the following build error:

  [LD] abstract_jb.o acl.o adsistub.o aescrypt.o aeskey.o aestab.o alaw.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autoservice.o callerid.o cdr.o channel.o chanvars.o cli.o config.o cryptostub.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 fskmodem.o global_datastores.o hashtab.o http.o image.o indications.o io.o jitterbuf.o loader.o logger.o manager.o md5.o netsock.o pbx.o plc.o poll.o privacy.o rtp.o say.o sched.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o tcptls.o tdd.o term.o threadstorage.o translate.o udptl.o ulaw.o utils.o version.o editline/libedit.a db1-ast/libdb1.a -> asterisk
Undefined                       first referenced
symbol                             in file
MAX                                 channel.o
MIN                                 udptl.o
ld: fatal: Symbol referencing errors. No output written to asterisk
collect2: ld returned 1 exit status
make[1]: *** [asterisk] Error 1
make: *** [main] Error 2
Comments:By: Bruce McAlister (asgaroth) 2009-11-16 05:04:33.000-0600

I mentioned this issues in bug id 0014517, but it does not seemed to be fixed yet so I thought I would create a new bug id for it.

By: Leif Madsen (lmadsen) 2009-11-16 10:29:59.000-0600

This is being dropped to minor as Asterisk is most supported on Linux. For OpenSolaris issues, they'll either be dealt with as time and resources permit, or someone from the community is welcome to submit a patch.

By: Bruce McAlister (asgaroth) 2009-11-17 00:28:16.000-0600

Just an FYI, I'm running on Solaris, not OpenSolaris. Hope that helps anyone who is trying to track down bugs.

By: Bruce McAlister (asgaroth) 2009-11-19 15:49:05.000-0600

Just an update, I tried building with Asterisk release 1.6.0.18 release today and this issue is still present, here is the output of the build:

creating cache ./config.cache
checking for gcc... /usr/sfw/bin/gcc
checking whether the C compiler (/usr/sfw/bin/gcc -D_REENTRANT -pthreads -I../..//include   -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -march=i386 -Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__  -O6  ) works... yes
checking whether the C compiler (/usr/sfw/bin/gcc -D_REENTRANT -pthreads -I../..//include   -pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3 -march=i386 -Wcast-align -DSOLARIS -I../include/solaris-compat -I/opt/ssl/include -I/usr/local/ssl/include -D_XPG4_2 -D__EXTENSIONS__  -O6  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether /usr/sfw/bin/gcc accepts -g... yes
checking how to run the C preprocessor... /usr/sfw/bin/gcc -E
checking for mawk... nawk
checking host system type... i386-pc-solaris2.10
checking for a BSD compatible install... /opt/jdsbld/bin/ginstall -c
checking for ranlib... ranlib
checking for ar... /usr/xpg4/bin/ar
checking for tgetent in -ltermcap... yes
checking for termcap.h... no
checking for term.h... yes
checking for curses.h... yes
checking for sys/cdefs.h... no
checking for vis.h... no
checking for issetugid... yes
checking for fgetln... no
checking for strvis... no
checking for strunvis... no
checking for strlcpy... yes
checking for strlcat... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating makelist
creating config.h
  [CC] hash/hash.c -> hash/hash.o
  [CC] hash/hash_bigkey.c -> hash/hash_bigkey.o
  [CC] hash/hash_buf.c -> hash/hash_buf.o
  [CC] hash/hash_func.c -> hash/hash_func.o
  [CC] hash/hash_log2.c -> hash/hash_log2.o
  [CC] hash/hash_page.c -> hash/hash_page.o
  [CC] hash/ndbm.c -> hash/ndbm.o
  [CC] btree/bt_close.c -> btree/bt_close.o
  [CC] btree/bt_conv.c -> btree/bt_conv.o
  [CC] btree/bt_debug.c -> btree/bt_debug.o
  [CC] btree/bt_delete.c -> btree/bt_delete.o
  [CC] btree/bt_get.c -> btree/bt_get.o
  [CC] btree/bt_open.c -> btree/bt_open.o
  [CC] btree/bt_overflow.c -> btree/bt_overflow.o
  [CC] btree/bt_page.c -> btree/bt_page.o
  [CC] btree/bt_put.c -> btree/bt_put.o
  [CC] btree/bt_search.c -> btree/bt_search.o
  [CC] btree/bt_seq.c -> btree/bt_seq.o
  [CC] btree/bt_split.c -> btree/bt_split.o
  [CC] btree/bt_utils.c -> btree/bt_utils.o
  [CC] db/db.c -> db/db.o
  [CC] mpool/mpool.c -> mpool/mpool.o
  [CC] recno/rec_close.c -> recno/rec_close.o
  [CC] recno/rec_delete.c -> recno/rec_delete.o
  [CC] recno/rec_get.c -> recno/rec_get.o
  [CC] recno/rec_open.c -> recno/rec_open.o
  [CC] recno/rec_put.c -> recno/rec_put.o
  [CC] recno/rec_search.c -> recno/rec_search.o
  [CC] recno/rec_seq.c -> recno/rec_seq.o
  [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 adsistub.o aescrypt.o aeskey.o aestab.o alaw.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autoservice.o callerid.o cdr.o channel.o chanvars.o cli.o config.o cryptostub.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 fskmodem.o global_datastores.o hashtab.o http.o image.o indications.o io.o jitterbuf.o loader.o logger.o manager.o md5.o netsock.o pbx.o plc.o poll.o privacy.o rtp.o say.o sched.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o tcptls.o tdd.o term.o threadstorage.o translate.o udptl.o ulaw.o utils.o version.o editline/libedit.a db1-ast/libdb1.a -> asterisk
Undefined                       first referenced
symbol                             in file
MAX                                 channel.o
MIN                                 udptl.o
ld: fatal: Symbol referencing errors. No output written to asterisk
collect2: ld returned 1 exit status
make[1]: *** [asterisk] Error 1
make: *** [main] Error 2

By: snuffy (snuffy) 2009-11-20 14:54:54.000-0600

I would suggest if you want a quick fix, take from trunk the 'MIN/MAX' define in the include/asterisk/utils.h and put it in the top of main/udptl.c

Really.. the MIN/MAX fix should have been done over all 1.4/1.6.x branches

By: Bruce McAlister (asgaroth) 2009-11-21 18:34:32.000-0600

snuffy, I just checked-out the 1.6.0 branch and I cant find any MIN or MAX defines in include/asterisk/utils.h:

I ran

egrep ' MIN | MAX ' *.h

in include/asterisk but nothing is returned. Am I looking in the wrong place?

By: snuffy (snuffy) 2009-11-22 01:38:43.000-0600

asagroth, I meant from trunk.. /include/asterisk/utils.h
Here are the below definitions.

#define MIN(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a > __b) ? __b : __a);})

#define MAX(a, b) ({ typeof(a) __a = (a); typeof(b) __b = (b); ((__a < __b) ? __b : __a);})

By: Bruce McAlister (asgaroth) 2009-11-22 07:19:46.000-0600

Thanks snuffy, I had a look and put it in the place that is in trunk as you mentioned above. I saw that udptl.c included utils.h so I just added the MIN/MAX defines to include/asterisk/utils.h and everything compiles properly now. I have not actually tested asterisk yet, but the build is ok.

The only warning I get now, is probably because the MIN/MAX defines are redefined in mpool.c or some file mpool.c includes. I assume this is also fixed in trunk. Here is the warnings I get when I add the MIN/MAX defines in include/asterisk/utils.h

creating ./config.status
creating Makefile
creating makelist
creating config.h
  [CC] hash/hash.c -> hash/hash.o
  [CC] hash/hash_bigkey.c -> hash/hash_bigkey.o
  [CC] hash/hash_buf.c -> hash/hash_buf.o
  [CC] hash/hash_func.c -> hash/hash_func.o
  [CC] hash/hash_log2.c -> hash/hash_log2.o
  [CC] hash/hash_page.c -> hash/hash_page.o
  [CC] hash/ndbm.c -> hash/ndbm.o
  [CC] btree/bt_close.c -> btree/bt_close.o
  [CC] btree/bt_conv.c -> btree/bt_conv.o
  [CC] btree/bt_debug.c -> btree/bt_debug.o
  [CC] btree/bt_delete.c -> btree/bt_delete.o
  [CC] btree/bt_get.c -> btree/bt_get.o
  [CC] btree/bt_open.c -> btree/bt_open.o
  [CC] btree/bt_overflow.c -> btree/bt_overflow.o
  [CC] btree/bt_page.c -> btree/bt_page.o
  [CC] btree/bt_put.c -> btree/bt_put.o
  [CC] btree/bt_search.c -> btree/bt_search.o
  [CC] btree/bt_seq.c -> btree/bt_seq.o
  [CC] btree/bt_split.c -> btree/bt_split.o
  [CC] btree/bt_utils.c -> btree/bt_utils.o
  [CC] db/db.c -> db/db.o
  [CC] mpool/mpool.c -> mpool/mpool.o
In file included from mpool/mpool.c:52:
/export/home/user/packages/BUILD/asterisk-1.6.0.18/include/asterisk/utils.h:25:1: warning: "MIN" redefined
In file included from mpool/../include/db.h:45,
                from mpool/mpool.c:50:
include/compat.h:45:1: warning: this is the location of the previous definition
In file included from mpool/mpool.c:52:
/export/home/user/packages/BUILD/asterisk-1.6.0.18/include/asterisk/utils.h:26:1: warning: "MAX" redefined
In file included from mpool/../include/db.h:45,
                from mpool/mpool.c:50:
include/compat.h:42:1: warning: this is the location of the previous definition
  [CC] recno/rec_close.c -> recno/rec_close.o
  [CC] recno/rec_delete.c -> recno/rec_delete.o
  [CC] recno/rec_get.c -> recno/rec_get.o
  [CC] recno/rec_open.c -> recno/rec_open.o
  [CC] recno/rec_put.c -> recno/rec_put.o
  [CC] recno/rec_search.c -> recno/rec_search.o
  [CC] recno/rec_seq.c -> recno/rec_seq.o
  [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 adsistub.o aescrypt.o aeskey.o aestab.o alaw.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autoservice.o callerid.o cdr.o channel.o chanvars.o cli.o config.o cryptostub.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 fskmodem.o global_datastores.o hashtab.o http.o image.o indications.o io.o jitterbuf.o loader.o logger.o manager.o md5.o netsock.o pbx.o plc.o poll.o privacy.o rtp.o say.o sched.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o tcptls.o tdd.o term.o threadstorage.o translate.o udptl.o ulaw.o utils.o version.o editline/libedit.a db1-ast/libdb1.a -> asterisk
+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running:              +
+                                           +
+                make install               +
+-------------------------------------------+



By: snuffy (snuffy) 2009-11-22 13:19:45.000-0600

yes.. that is true..
You may be able to fix the warning by adding the below around those defines I gave you.

#ifndef MIN
#endif

#ifndef MAX
#endif

By: Bruce McAlister (asgaroth) 2009-11-22 16:58:17.000-0600

Thanks snuffy, this works for both asterisk 1.6.0.18 and 1.6.1.10.

By: Bruce McAlister (asgaroth) 2010-01-05 08:51:14.000-0600

I can confirm that this issue is also/still present in asterisk version 1.6.2.0

  [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 adsistub.o aescrypt.o aeskey.o aestab.o alaw.o app.o ast_expr2.o ast_expr2f.o asterisk.o astfd.o astmm.o astobj2.o audiohook.o autoservice.o bridging.o callerid.o cdr.o channel.o chanvars.o cli.o config.o cryptostub.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 fskmodem.o global_datastores.o hashtab.o heap.o http.o image.o indications.o io.o jitterbuf.o loader.o logger.o manager.o md5.o netsock.o pbx.o plc.o poll.o privacy.o rtp.o say.o sched.o sha1.o slinfactory.o srv.o ssl.o stdtime/localtime.o strcompat.o strings.o taskprocessor.o tcptls.o tdd.o term.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
Undefined                       first referenced
symbol                             in file
MAX                                 channel.o
MIN                                 udptl.o
ld: fatal: Symbol referencing errors. No output written to asterisk
collect2: ld returned 1 exit status

By: Digium Subversion (svnbot) 2010-01-07 15:17:04.000-0600

Repository: asterisk
Revision: 238494

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_alsa.c
U   branches/1.6.0/channels/chan_console.c
U   branches/1.6.0/channels/chan_oss.c
U   branches/1.6.0/channels/chan_sip.c
U   branches/1.6.0/channels/chan_usbradio.c
U   branches/1.6.0/include/asterisk/utils.h
U   branches/1.6.0/main/poll.c

------------------------------------------------------------------------
r238494 | tilghman | 2010-01-07 15:17:04 -0600 (Thu, 07 Jan 2010) | 11 lines

Merged revisions 209400 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r209400 | kpfleming | 2009-07-28 08:49:46 -0500 (Tue, 28 Jul 2009) | 3 lines
 
 Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
 (closes issue ASTERISK-15142)
 Reported by: asgaroth
........

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

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

By: Digium Subversion (svnbot) 2010-01-07 15:17:34.000-0600

Repository: asterisk
Revision: 238497

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_alsa.c
U   branches/1.6.1/channels/chan_console.c
U   branches/1.6.1/channels/chan_oss.c
U   branches/1.6.1/channels/chan_sip.c
U   branches/1.6.1/channels/chan_usbradio.c
U   branches/1.6.1/include/asterisk/utils.h
U   branches/1.6.1/main/poll.c

------------------------------------------------------------------------
r238497 | tilghman | 2010-01-07 15:17:34 -0600 (Thu, 07 Jan 2010) | 11 lines

Merged revisions 209400 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r209400 | kpfleming | 2009-07-28 08:49:46 -0500 (Tue, 28 Jul 2009) | 3 lines
 
 Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
 (closes issue ASTERISK-15142)
 Reported by: asgaroth
........

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

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

By: Digium Subversion (svnbot) 2010-01-07 15:17:44.000-0600

Repository: asterisk
Revision: 238499

_U  branches/1.6.2/
U   branches/1.6.2/channels/chan_alsa.c
U   branches/1.6.2/channels/chan_console.c
U   branches/1.6.2/channels/chan_oss.c
U   branches/1.6.2/channels/chan_sip.c
U   branches/1.6.2/channels/chan_usbradio.c
U   branches/1.6.2/include/asterisk/utils.h
U   branches/1.6.2/main/poll.c

------------------------------------------------------------------------
r238499 | tilghman | 2010-01-07 15:17:44 -0600 (Thu, 07 Jan 2010) | 11 lines

Merged revisions 209400 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r209400 | kpfleming | 2009-07-28 08:49:46 -0500 (Tue, 28 Jul 2009) | 3 lines
 
 Define side-effect-safe MIN and MAX macros and remove duplicate definitions from various files.
 (closes issue ASTERISK-15142)
 Reported by: asgaroth
........

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

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