[Bug 873042] [NEW] unable to build against apr -- undefined reference to `apr_initialize'

Steve Halasz 873042 at bugs.launchpad.net
Wed Oct 12 19:42:26 UTC 2011


Public bug reported:

I'm trying to compile the following program in oneiric:

#include <apr.h>
#include <apr_general.h>
#include <apr_pools.h>
#include <apr_file_info.h>
#include <apr_file_io.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    apr_pool_t *pool;
    apr_file_t *out;

    apr_initialize();
    //atexit(apr_terminate());

    apr_pool_create(&pool, NULL);
    apr_file_open_stdout(&out, pool);
    apr_file_printf(out, "Hello World\n");
    apr_pool_destroy(pool);

    return EXIT_SUCCESS;
}

$ gcc -Wall $(apr-1-config --cflags --cppflags --includes --link-ld) test2.c -o test
/tmp/ccmjrPSw.o: In function `main':
test2.c:(.text+0x10): undefined reference to `apr_initialize'
test2.c:(.text+0x2b): undefined reference to `apr_pool_create_ex'
test2.c:(.text+0x3e): undefined reference to `apr_file_open_stdout'
test2.c:(.text+0x54): undefined reference to `apr_file_printf'
test2.c:(.text+0x60): undefined reference to `apr_pool_destroy'
collect2: ld returned 1 exit status

This works fine in maverick.

$ apr-1-config --cflags --cppflags --includes --link-ld
  -pthread -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-1.0  -L/usr/lib -lapr-1

$ lsb_release -rd
Description:    Ubuntu 11.10
Release:        11.10

$ apt-cache policy apache2-prefork-dev
apache2-prefork-dev:
  Installed: 2.2.20-1ubuntu1
  Candidate: 2.2.20-1ubuntu1
  Version table:
 *** 2.2.20-1ubuntu1 0
        500 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
        100 /var/lib/dpkg/status

** Affects: apache2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to apache2 in Ubuntu.
https://bugs.launchpad.net/bugs/873042

Title:
  unable to build against apr -- undefined reference to `apr_initialize'

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/873042/+subscriptions



More information about the Ubuntu-server-bugs mailing list