[theora-dev] Compiling on FreeBSD

volsung at mailsnare.net volsung at mailsnare.net
Wed Oct 2 06:46:54 PDT 2002

Quoting Arc <arc at indymedia.org>:

> Second, and more scary, is having to copy the getopt.h from
> /usr/src/gnu/usr.bin/grep/ to the build directory since this is a
> Linux-centric thing apparently - FreeBSD ports lists recommend that
> files include one for themselves "just in case" the OS its being
> installed on doesn't have one.  I don't know if the two are compatable,
> I'm assuming so for now.

Yes.  In vorbis-tools we include a copy of getopt.h and getopt.c to avoid this
problem.  Presumably we'll have to do the same thing for the theora examples.

> At this point I'm scratching my head:
> gcc -O2 -D_REENTRANT -static -o encoder_example encoder_example.o
> ../lib/.libs/l
> ibtheora.a -L /usr/local/lib -logg -lvorbis -lm -lvorbisenc
> encoder_example.o: In function `main':
> encoder_example.o(.text+0xd5f): undefined reference to `getopt_long'
> encoder_example.o(.text+0x1236): undefined reference to
> `vorbis_granule_time'
> gmake: *** [encoder_example] Error 1

Two problems:

1) You need to update your libvorbis to the latest CVS.  vorbis_granule_time()
was added after 1.0.
2) By copying the getopt.h header, you've given the compiler the getopt_*
function prototypes, but the linker doesn't have any function bodies to link to.
 To fix:

        * Copy the getopt.c file from vorbis-tools/share/ to the
        theora/examples directory.
        * Edit Makefile.am to include getopt.c as one of the source files for
        the encoder_example.
        * Rerun autogen.sh and recompile.

This should fix the problem.

Stan Seibert

<p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'theora-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.

More information about the Theora-dev mailing list