Monday, February 14, 2011

How to fix undefined symbol: apr_strtoff +mod_flvx under apache

Add this code to the mod_flvx.c file:


#if APR_HAS_LARGE_FILES
#define APR_OFF_T_STRFN       strtoll
#else
#define APR_OFF_T_STRFN       strtol
#endif
/* A "safe" maximum bucket size, 1Gb */
#define MAX_BUCKET_SIZE (0x40000000)
APU_DECLARE(apr_bucket *) apr_brigade_insert_file(apr_bucket_brigade *bb,
                                                  apr_file_t *f,
                                                  apr_off_t start,
                                                  apr_off_t length,
                                                  apr_pool_t *p)
{
    apr_bucket *e;
    if (sizeof(apr_off_t) == sizeof(apr_size_t) || length < MAX_BUCKET_SIZE) {
        e = apr_bucket_file_create(f, start, (apr_size_t)length, p,
                                   bb->bucket_alloc);
    }
    else {
        /* Several buckets are needed. */
        e = apr_bucket_file_create(f, start, MAX_BUCKET_SIZE, p,
                                   bb->bucket_alloc);
        while (length > MAX_BUCKET_SIZE) {
            apr_bucket *ce;
            apr_bucket_copy(e, &ce);
            APR_BRIGADE_INSERT_TAIL(bb, ce);
            e->start += MAX_BUCKET_SIZE;
            length -= MAX_BUCKET_SIZE;
        }
        e->length = (apr_size_t)length; /* Resize just the last bucket */
    }
    APR_BRIGADE_INSERT_TAIL(bb, e);
    return e;

}
APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *nptr, char **endptr, int base)
{
 errno = 0;
 *offset = APR_OFF_T_STRFN(nptr, endptr, base);
 return APR_FROM_OS_ERROR(errno);
}

2 comments:

  1. Hi, and thanks for this fix. Though it didn't fix my weird issue with mod_flvx.

    I have installed it in Apache 2.2.3 over CentOS 5.5 in two servers. Pseudostreaming works in one of them, while in the other the flv video starts to load from the seek point but the cursor stays in the beggining of the player's bar and it's not possible to forward it.

    You can see an example here (with stripped "<" in object and param tags):

    object id="flashvideo" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="450" height="337" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">param name="movie" value="http://upnatv.unavarra.es/files/Player.swf" />param name="wmode" value="window" />param name="allowfullscreen" value="true" />param name="FlashVars" value="file=http://upnatv.unavarra.es/files/videosConvertidosPublico/8460_energia_nuclear.flv&logo.file=http://upnatv.unavarra.es/files/PoweredByUPNA.png&logo.link=http://upnatv.unavarra.es&logo.position=top-left&logo.timeout=7&autostart=true&provider=http" />param name="quality" value="high" />/object>

    I know that it's difficult, but have you found by chance this behaviour before?

    Thanks in advance.
    Daniel Merino - daniel.merino@unavarra.es

    ReplyDelete
  2. Did you restart apache ?
    can you send a copy of your httpd.conf (apache2.conf)?

    ReplyDelete