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

tititou christophe.jaillet at wanadoo.fr
Thu Dec 20 22:20:20 UTC 2012


Hi,

I was having the same kind of problem with Ubuntu 12.04 LTS.

After 3 evenings searching for a solution, I reached the online help of
gcc about link option (http://gcc.gnu.org/onlinedocs/gcc/Link-
Options.html)

There you can read:
>>>>>>>
-l library
It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, `foo.o -lz bar.o' searches library `z' after file foo.o but before bar.o. If bar.o refers to functions in `z', those functions may not be loaded. 
>>>>>>>

So, try to do:
     gcc -Wall test2.c $(apr-1-config --cflags --cppflags --includes --link-ld)  -o test
That is to say, your C file before the APR stuff.
Doing so, -lapr-1 will be at the end of the command line and the linker will find the reference, as per gcc's comment above.

It worked for me.
Hope this can help.

-- 
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