Hi all, I've got two problems compiling the current CVS FLAC sources on OSX. Firstly, the configure script can't find the OGG libraries which were installed from MacPorts. I have tried: ./configure --with-ogg-includes=/opt/local/include \ --with-ogg-lib=/opt/local/lib but they are still not found. I notice that in configure.in, you use a macro called XIPH_PATH_OGG. Is there any reason you don't use the PKG_CHECK_MODULES mcaro which uses pkg-config underneath? For my system pkg-config does the right thing: > pkg-config --cflags --libs ogg -I/opt/local/include -L/opt/local/lib -logg I will put together a patch for this is you are interested. Second problem is that I get a compile error when FLAC__HAS_OGG is 0 in src/flac/decode.c: decode.c:393: error: 'options' undeclared (first use in this function) The code in question is this: #if FLAC__HAS_OGG if(decoder_session->is_ogg) { /* Some code here. */ } else #else (void)decode_options; #endif { /* More code. */ } The problem here is that conditional compiles can hide bugs. The code above re-written to turn a conditional compile into an always compiled if statement which will trigger the error regardless of the value of FLAC__HAS_OGG: if(FLAC__HAS_OGG && decoder_session->is_ogg) { /* Some code here. */ } else { (void)decode_options; /* More code. */ } Cheers, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- 'Unix beats Windows' - says Microsoft! http://blogs.zdnet.com/Murphy/index.php?p=459
--- Erik de Castro Lopo <erikd-flac@mega-nerd.com> wrote:> Hi all, > > I've got two problems compiling the current CVS FLAC sources on OSX. > > Firstly, the configure script can't find the OGG libraries which were > installed from MacPorts. I have tried: > > ./configure --with-ogg-includes=/opt/local/include \ > --with-ogg-lib=/opt/local/lib > > but they are still not found. I notice that in configure.in, you use > a macro called XIPH_PATH_OGG. Is there any reason you don't use the > PKG_CHECK_MODULES mcaro which uses pkg-config underneath? For my > system pkg-config does the right thing: > > > pkg-config --cflags --libs ogg > -I/opt/local/include -L/opt/local/lib -logg > > I will put together a patch for this is you are interested.the main reason I haven't swtiched is I'm not up on pkgconfig and XIPTH_PATH_OGG has been working pretty well... can you tell why it's not working for you? I'm always hesitant to mess with things in configure.in because is such whack-a-mole problem (fixes things for some people and breaks for others).> Second problem is that I get a compile error when FLAC__HAS_OGG is 0 > in src/flac/decode.c: > > decode.c:393: error: 'options' undeclared (first use in this > function) > > The code in question is this: > > #if FLAC__HAS_OGG > if(decoder_session->is_ogg) { > /* Some code here. */ > } > else > #else > (void)decode_options; > #endif > { > /* More code. */ > }yes, this is fixed in cvs. actually I'll probably be doing a release soon and I'd be interested to know if the latest stuff works for you.> The problem here is that conditional compiles can hide bugs. The code > above > re-written to turn a conditional compile into an always compiled if > statement > which will trigger the error regardless of the value of > FLAC__HAS_OGG: > > if(FLAC__HAS_OGG && decoder_session->is_ogg) { > /* Some code here. */ > } > else > { > (void)decode_options; > /* More code. */ > }interesting idea, hadn't thought of that. ____________________________________________________________________________________ Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz
Josh Coalson wrote:> the main reason I haven't swtiched is I'm not up on pkgconfig > and XIPTH_PATH_OGG has been working pretty well... can you tell > why it's not working for you? > > I'm always hesitant to mess with things in configure.in because > is such whack-a-mole problem (fixes things for some people and > breaks for others).I'll look into that over the next day or so. The pkg-config method has the advantage of being highly robust, but is a pain for MinGW because you need pkg-config.> > Second problem is that I get a compile error when FLAC__HAS_OGG is 0 > > in src/flac/decode.c: > > > > decode.c:393: error: 'options' undeclared (first use in this > > function) > > > > The code in question is this: > > > > #if FLAC__HAS_OGG > > if(decoder_session->is_ogg) { > > /* Some code here. */ > > } > > else > > #else > > (void)decode_options; > > #endif > > { > > /* More code. */ > > } > > yes, this is fixed in cvs. actually I'll probably be doing a > release soon and I'd be interested to know if the latest stuff > works for you.Sorry, I just updated from CVS and its still broken. If FLAC__HAS_OGG is false it tries to compile this: (void)decode_options; and there is no "decode_options" identifier. Maybe this is the delay between your CVS commit and the public CVS being updated.> interesting idea, hadn't thought of that.Please take a look at this. Doing it this way means that both code paths are checked by the semantic analysis stage of the compiler regardless of value of FLAC__HAS_OGG. It prevents conditional compile constructs from hiding really blatantly obvious errors like this one. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Whenever the C++ language designers had two competing ideas as to how they should solve some problem, they said, "OK, we'll do them both". So the language is too baroque for my taste." -- Donald E Knuth