You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jan Engelhardt <je...@medozas.de> on 2008/06/07 13:29:26 UTC

apxs is missing -fPIC and ignores it

Hi,


I was compiling an authnz module and noticed that apxs2 does not pass 
-fPIC to the compiler by default when compiling .c files into .slo. 
Also, when passing -fPIC manually as part of the CFLAGS (command line is
`apxs2 "-Wc,-Wall -fPIC" -c foobar.c`), the -fPIC gets stripped.
libtool normally adds PIC for shared libraries, but apxs2's copy of 
libtool even removes an explicitly specified -fPIC flag?

Opensuse 10.3 i586 and x86_64, Linux 2.6.23.17, apache2 2.2.4.


$ touch foo.c
$ apxs2 -c foo.c -fPIC
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic   
-DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apache2  
-I/usr/include/apr-1   -I/usr/include/apr-1   -c -o foo.lo foo.c && 
touch foo.slo
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o foo.la  
-rpath /usr/lib64/apache2 -module -avoid-version    foo.lo -fPIC


As can be seen, -fPIC is not passed to the compiler, but only to the 
link stage. Any ideas?


Thanks,
Jan

Re: apxs is missing -fPIC and ignores it

Posted by Jan Engelhardt <je...@medozas.de>.
On Sunday 2008-06-08 20:59, Sander Temme wrote:
> On Jun 8, 2008, at 11:47 AM, Jan Engelhardt wrote:
>
>> Sometimes you miss the wood for the trees :-)
>> But still, should not apxs's libtool add -fPIC on its own,
>> like the normal (GNU) libtool does?
>
> It should behave like GNU libtool, because it *is* GNU libtool.  apxs uses the
> same libtool that was used to build APR and Apache, and is installed by apr in
> build-1 under normal configuration circumstances.
>
> [sctemme@Legadema] trunk $ /UserData/asf/apr-r664276/build-1/libtool --version
> ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)

Well it seems like Ubuntu's 8.04 axps is at total fail; I do get -fPIC
from apxs on SUSE. Case closed.

linux@ub-desktop:~$ /usr/share/apr-1.0/build/libtool --version
ltmain.sh (GNU libtool) 1.5.20 (1.1220.2.287 2005/08/31 18:54:15)

Re: apxs is missing -fPIC and ignores it

Posted by Sander Temme <sc...@apache.org>.
On Jun 8, 2008, at 11:47 AM, Jan Engelhardt wrote:

> Sometimes you miss the wood for the trees :-)
> But still, should not apxs's libtool add -fPIC on its own,
> like the normal (GNU) libtool does?


It should behave like GNU libtool, because it *is* GNU libtool.  apxs  
uses the same libtool that was used to build APR and Apache, and is  
installed by apr in build-1 under normal configuration circumstances.

[sctemme@Legadema] trunk $ /UserData/asf/apr-r664276/build-1/libtool -- 
version
ltmain.sh (GNU libtool) 1.5.26 (1.1220.2.492 2008/01/30 06:40:56)

Copyright (C) 2008  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There  
is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  
PURPOSE.

S.


-- 
Sander Temme
sctemme@apache.org
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF




Re: apxs is missing -fPIC and ignores it

Posted by Jan Engelhardt <je...@medozas.de>.
On Sunday 2008-06-08 19:31, Arfrever Frehtes Taifersar Arahesis wrote:

>2008-06-07 13:29:26 Jan Engelhardt napisał(a):
>> 
>> $ touch foo.c
>> $ apxs2 -c foo.c -fPIC
>> /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic   
>> -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apache2  
>> -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o foo.lo foo.c && 
>> touch foo.slo
>> /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o foo.la  
>> -rpath /usr/lib64/apache2 -module -avoid-version    foo.lo -fPIC
>> 
>> As can be seen, -fPIC is not passed to the compiler, but only to the 
>> link stage. Any ideas?
>
>apxs2 -Wc,-fPIC -c foo.c

Sometimes you miss the wood for the trees :-)
But still, should not apxs's libtool add -fPIC on its own,
like the normal (GNU) libtool does?

Re: apxs is missing -fPIC and ignores it

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2008-06-07 13:29:26 Jan Engelhardt napisał(a):
> I was compiling an authnz module and noticed that apxs2 does not pass 
> -fPIC to the compiler by default when compiling .c files into .slo. 
> Also, when passing -fPIC manually as part of the CFLAGS (command line is
> `apxs2 "-Wc,-Wall -fPIC" -c foobar.c`), the -fPIC gets stripped.
> libtool normally adds PIC for shared libraries, but apxs2's copy of 
> libtool even removes an explicitly specified -fPIC flag?
> 
> Opensuse 10.3 i586 and x86_64, Linux 2.6.23.17, apache2 2.2.4.
> 
> 
> $ touch foo.c
> $ apxs2 -c foo.c -fPIC
> /usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic   
> -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/apache2  
> -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o foo.lo foo.c && 
> touch foo.slo
> /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o foo.la  
> -rpath /usr/lib64/apache2 -module -avoid-version    foo.lo -fPIC
> 
> 
> As can be seen, -fPIC is not passed to the compiler, but only to the 
> link stage. Any ideas?

apxs2 -Wc,-fPIC -c foo.c

-- 
Arfrever Frehtes Taifersar Arahesis