undefined reference to 'assert'

undefined reference to 'assert'

Post by John Baile » Tue, 20 May 2003 07:51:21



Hi everyone,

When trying to compile some libs and programs today I got a very rude
awakening:

gcc -g -O2 -Wall -fomit-frame-pointer -funroll-loops -g -O2 -Wall
-fomit-frame-pointer -funroll-loops -march=i586 -mcpu=pentiumpro -o
.libs/ogle_audio audio_out.o parse_config.o audio_config.o conversion.o
audio_play.o decode.o decode_a52.o decode_lpcm.o decode_mpeg.o
../common/libcommon.a ../ogle/.libs/libmsgevents.so
../libogleao/.libs/libogleao.al /usr/lib/libasound.so -ldl -lpthread
-L/usr/local/lib /usr/local/lib/liba52.a /usr/lib/libmad.so -L/usr/lib
/usr/lib/libxml2.so -L/usr/X11R6/lib -lz -lm -lrt -Wl,--rpath
-Wl,/usr/local/lib/ogle -Wl,--rpath -Wl,/usr/local/lib
../libogleao/.libs/libogleao.al(alsa_audio.lo): In function `alsa_init':
/home/jbailey/src/ogle-0.8.5/libogleao/alsa_audio.c:145: undefined
reference to `assert'
/home/jbailey/src/ogle-0.8.5/libogleao/alsa_audio.c:146: undefined
reference to `assert'
collect2: ld returned 1 exit status
make[1]: *** [ogle_audio] Error 1
make[1]: Leaving directory `/home/jbailey/src/ogle-0.8.5/ac3'
make: *** [all-recursive] Error 1

Yes, I realize this version of ogle I'm trying to compile is quite old;
however, it works, and I am happy with that.  I just want it to compile!
  Is there a specific -L or -l flag I should add to my $CFLAGS when I
run the configure script (or when editing makefiles if necessary)?

In case this makes a difference:


gcc (GCC) 3.2
Copyright (C) 2002 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 PARTICULAR
PURPOSE.


glibc-html-2.2.5-151
glibc-info-2.2.5-151
glibc-2.2.5-152
glibc-locale-2.2.5-151
glibc-profile-2.2.5-151
glibc-devel-2.2.5-151

The box is running SuSE 8.1 Professional.

Any help is greatly appreciated!  Also, I apologize if I've posted to
the wrong group.  If I have, please inform me which groups I should post
this kind of problem to and I will post to those groups in the future.

John

 
 
 

undefined reference to 'assert'

Post by Homer Welc » Wed, 21 May 2003 06:51:19



> Hi everyone,

> When trying to compile some libs and programs today I got a very rude
> awakening:

> gcc -g -O2 -Wall -fomit-frame-pointer -funroll-loops -g -O2 -Wall
> -fomit-frame-pointer -funroll-loops -march=i586 -mcpu=pentiumpro -o
> .libs/ogle_audio audio_out.o parse_config.o audio_config.o conversion.o
> audio_play.o decode.o decode_a52.o decode_lpcm.o decode_mpeg.o
> ../common/libcommon.a ../ogle/.libs/libmsgevents.so
> ../libogleao/.libs/libogleao.al /usr/lib/libasound.so -ldl -lpthread
> -L/usr/local/lib /usr/local/lib/liba52.a /usr/lib/libmad.so -L/usr/lib
> /usr/lib/libxml2.so -L/usr/X11R6/lib -lz -lm -lrt -Wl,--rpath
> -Wl,/usr/local/lib/ogle -Wl,--rpath -Wl,/usr/local/lib
> ../libogleao/.libs/libogleao.al(alsa_audio.lo): In function `alsa_init':
> /home/jbailey/src/ogle-0.8.5/libogleao/alsa_audio.c:145: undefined
> reference to `assert'
> /home/jbailey/src/ogle-0.8.5/libogleao/alsa_audio.c:146: undefined
> reference to `assert'
> collect2: ld returned 1 exit status
> make[1]: *** [ogle_audio] Error 1
> make[1]: Leaving directory `/home/jbailey/src/ogle-0.8.5/ac3'
> make: *** [all-recursive] Error 1

> Yes, I realize this version of ogle I'm trying to compile is quite old;
> however, it works, and I am happy with that.  I just want it to compile!
>  Is there a specific -L or -l flag I should add to my $CFLAGS when I run
> the configure script (or when editing makefiles if necessary)?

> In case this makes a difference:


> gcc (GCC) 3.2
> Copyright (C) 2002 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 PARTICULAR
> PURPOSE.


> glibc-html-2.2.5-151
> glibc-info-2.2.5-151
> glibc-2.2.5-152
> glibc-locale-2.2.5-151
> glibc-profile-2.2.5-151
> glibc-devel-2.2.5-151

> The box is running SuSE 8.1 Professional.

According to my documentation, assert is a macro.  You might
check alsa_audio.c to see if it includes 'assert.h'

 
 
 

undefined reference to 'assert'

Post by John Bail » Thu, 22 May 2003 01:03:11



> According to my documentation, assert is a macro.  You might
> check alsa_audio.c to see if it includes 'assert.h'

Thanks for the tip.  I checked (it was not included), and even went to
the extreme of including 'assert.h' in all 16 source files for the
application, it still will not compile.  For good measure, I even did
'make clean' and ran './configure' again.  Oddly enough, however, I
successfully compiled this same version of ogle on Mandrake 8.1 at
least twice.  That was a long time ago, though.

John

 
 
 

undefined reference to 'assert'

Post by Homer Welc » Thu, 22 May 2003 11:19:29




>>According to my documentation, assert is a macro.  You might
>>check alsa_audio.c to see if it includes 'assert.h'

> Thanks for the tip.  I checked (it was not included), and even went to
> the extreme of including 'assert.h' in all 16 source files for the
> application, it still will not compile.  For good measure, I even did
> 'make clean' and ran './configure' again.  Oddly enough, however, I
> successfully compiled this same version of ogle on Mandrake 8.1 at
> least twice.  That was a long time ago, though.

> John

I seem to remember that gcc-3.2 had trouble with one of
their flags, maybe -Wall, that would prevent proper
compilation in some cases.  I still use 2.95, so I didn't
pay attention, and I may be in error, but as a last resort,
try eliminating the -Wall from the makefiles.  If that
fails, try upgrading to the latest gcc release.  If you were
successful before, I suspect some type of obscure error in
the compiler that prevents proper macro expansion.
 
 
 

undefined reference to 'assert'

Post by John Bail » Tue, 03 Jun 2003 08:10:56



> I seem to remember that gcc-3.2 had trouble with one of
> their flags, maybe -Wall, that would prevent proper
> compilation in some cases.  I still use 2.95, so I didn't
> pay attention, and I may be in error, but as a last resort,
> try eliminating the -Wall from the makefiles.  If that
> fails, try upgrading to the latest gcc release.  If you were
> successful before, I suspect some type of obscure error in
> the compiler that prevents proper macro expansion.

When trying to get gcc-3.3 to compile I ran into the exact same
problem, "undefined reference to 'assert'" and decided to do some
investigating that hadn't occurred to me before:


/usr/include/assert.h
/usr/lib/bcc/include/assert.h
/usr/local/include/assert.h

snippet of /usr/local/include/assert.h:

/* libFLAC - Free Lossless Audio Codec library
 * Copyright (C) 2001,2002  Josh Coalson
 *

Since I knew that /usr/local/include gets checked for headers before
/usr/include, I renamed /usr/local/include/assert.h to something else
and then tried compiling ogle again.  It compiled and linked
flawlessly.

Thanks for the help!

John