All of lore.kernel.org
 help / color / mirror / Atom feed
* how to install xtables extension to arbitrary path?
@ 2010-10-14 14:25 Xing Qianqian
  2010-10-14 15:40 ` Jan Engelhardt
  2011-02-14 14:25 ` Fabrice
  0 siblings, 2 replies; 13+ messages in thread
From: Xing Qianqian @ 2010-10-14 14:25 UTC (permalink / raw)
  To: netfilter

Hi,

When building iptables, we can use "configure" to specify the xtables
extension install path by "prefix" or "withxtlibdir". And when we
running the iptables, iptables seems to search for the xtables extension
libraries only in the path that was specified by "configure". If we move
the xtables extension libraries to some other place, iptables will
report failing to load the "so" files.

Because I'm doing cross compiling, and I will place the xtables
extension libraries in the target board, and the final path might be
different than the "configure" path. Do you know how to make iptables to
load the correct xtables extensions?

Thanks.

-- 
Xing Qianqian



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2010-10-14 14:25 how to install xtables extension to arbitrary path? Xing Qianqian
@ 2010-10-14 15:40 ` Jan Engelhardt
  2011-02-14 14:25 ` Fabrice
  1 sibling, 0 replies; 13+ messages in thread
From: Jan Engelhardt @ 2010-10-14 15:40 UTC (permalink / raw)
  To: Xing Qianqian; +Cc: netfilter

On Thursday 2010-10-14 16:25, Xing Qianqian wrote:
>
>When building iptables, we can use "configure" to specify the xtables
>extension install path by "prefix" or "withxtlibdir". And when we
>running the iptables, iptables seems to search for the xtables extension
>libraries only in the path that was specified by "configure". If we move
>the xtables extension libraries to some other place, iptables will
>report failing to load the "so" files.

So don't move them ;-)

>Because I'm doing cross compiling, and I will place the xtables
>extension libraries in the target board, and the final path might be
>different than the "configure" path.

You always have to specify final target-local paths to configure (in 
other words, as usual). This has never been different.

>Do you know how to make iptables to
>load the correct xtables extensions?

make install DESTDIR=/cross-chroot

Is what you need. This is used in about all the installation scripts in 
.spec files and similar in linux distributions' packages. Every 
automake-powered project has DESTDIR offered, it is not exactly a new 
thing.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2010-10-14 14:25 how to install xtables extension to arbitrary path? Xing Qianqian
  2010-10-14 15:40 ` Jan Engelhardt
@ 2011-02-14 14:25 ` Fabrice
  2011-02-14 14:43   ` Mr Dash Four
  1 sibling, 1 reply; 13+ messages in thread
From: Fabrice @ 2011-02-14 14:25 UTC (permalink / raw)
  To: netfilter

Xing Qianqian <xingqq <at> 21com.com> writes:

> 
> Hi,
> 
> When building iptables, we can use "configure" to specify the xtables
> extension install path by "prefix" or "withxtlibdir". And when we
> running the iptables, iptables seems to search for the xtables extension
> libraries only in the path that was specified by "configure". If we move
> the xtables extension libraries to some other place, iptables will
> report failing to load the "so" files.
> 
> Because I'm doing cross compiling, and I will place the xtables
> extension libraries in the target board, and the final path might be
> different than the "configure" path. Do you know how to make iptables to
> load the correct xtables extensions?
> 
> Thanks.
> 

Hi Xing,
I'm having the same issue. I'm able to cross compile but when I install 
to another file system the libraries always look at the absolute path which 
is not valid anymore. How did you get around the issue?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 14:25 ` Fabrice
@ 2011-02-14 14:43   ` Mr Dash Four
  2011-02-14 14:50     ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Mr Dash Four @ 2011-02-14 14:43 UTC (permalink / raw)
  To: Fabrice; +Cc: netfilter


>> When building iptables, we can use "configure" to specify the xtables
>> extension install path by "prefix" or "withxtlibdir". And when we
>> running the iptables, iptables seems to search for the xtables extension
>> libraries only in the path that was specified by "configure". If we move
>> the xtables extension libraries to some other place, iptables will
>> report failing to load the "so" files.
>>
>> Because I'm doing cross compiling, and I will place the xtables
>> extension libraries in the target board, and the final path might be
>> different than the "configure" path. Do you know how to make iptables to
>> load the correct xtables extensions?
>>
>> Thanks.
>>
>>     
>
> Hi Xing,
> I'm having the same issue. I'm able to cross compile but when I install 
> to another file system the libraries always look at the absolute path which 
> is not valid anymore. How did you get around the issue?
>   
One possible solution to this (though not ideal by any means!) is to use 
modprobe and force the .so files to be loaded in advance as soon as the 
system is initialised (possibly through rc.sysinit). This is how I've 
got around the above problem as I also have a group of machines which 
use non-standard directories for xtables and ipset.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 14:43   ` Mr Dash Four
@ 2011-02-14 14:50     ` Jan Engelhardt
  2011-02-14 14:55       ` Mr Dash Four
  2011-02-14 15:03       ` Fabrice
  0 siblings, 2 replies; 13+ messages in thread
From: Jan Engelhardt @ 2011-02-14 14:50 UTC (permalink / raw)
  To: Mr Dash Four; +Cc: Fabrice, netfilter


On Monday 2011-02-14 15:43, Mr Dash Four wrote:
>
>>> When building iptables, we can use "configure" to specify the xtables
>>> extension install path by "prefix" or "withxtlibdir". And when we
>>> running the iptables, iptables seems to search for the xtables extension
>>> libraries only in the path that was specified by "configure". If we move
>>> the xtables extension libraries to some other place, iptables will
>>> report failing to load the "so" files.
>>>
>>> Because I'm doing cross compiling, and I will place the xtables
>>> extension libraries in the target board, and the final path might be
>>> different than the "configure" path. Do you know how to make iptables to
>>> load the correct xtables extensions?
>> Hi Xing,
>> I'm having the same issue. I'm able to cross compile but when I install to
>> another file system the libraries always look at the absolute path which is
>> not valid anymore. How did you get around the issue?

 --prefix/--with-xtlibdir is only meant to specify the directory
relative to the root of the final running system. To stage files
elsewhere, use the DESTDIR variable on make install.
See autoconf info, section 16.4 "Installation names".

>One possible solution to this (though not ideal by any means!) is to use
>modprobe and force the .so files to be loaded in advance as soon as the system
>is initialised (possibly through rc.sysinit).

Finding the .so files has nothing to do with modprobe however.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 14:50     ` Jan Engelhardt
@ 2011-02-14 14:55       ` Mr Dash Four
  2011-02-14 15:03       ` Fabrice
  1 sibling, 0 replies; 13+ messages in thread
From: Mr Dash Four @ 2011-02-14 14:55 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Fabrice, netfilter


> Finding the .so files has nothing to do with modprobe however.
>   
Though it has everything to do with iptables finding and loading 
ipset/xtables .so libraries placed in non-standard directory however.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 14:50     ` Jan Engelhardt
  2011-02-14 14:55       ` Mr Dash Four
@ 2011-02-14 15:03       ` Fabrice
  2011-02-14 15:20         ` Jan Engelhardt
  1 sibling, 1 reply; 13+ messages in thread
From: Fabrice @ 2011-02-14 15:03 UTC (permalink / raw)
  To: netfilter

I'm using DESTDIR but it requires an absolute path which is only valid on the 
platform I compile. Suppose the DESTDIR is my NFS which is what my embedded 
platform uses, it will try to load the xtables libraries by using the absolute 
path from the install. This path is unknown from the embedded platform 
point of view.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 15:03       ` Fabrice
@ 2011-02-14 15:20         ` Jan Engelhardt
  2011-02-14 15:25           ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2011-02-14 15:20 UTC (permalink / raw)
  To: Fabrice; +Cc: netfilter

On Monday 2011-02-14 16:03, Fabrice wrote:

>I'm using DESTDIR but it requires an absolute path which is only valid 
>on the platform I compile. Suppose the DESTDIR is my NFS which is what 
>my embedded platform uses, it will try to load the xtables libraries by 
>using the absolute path from the install. This path is unknown from the 
>embedded platform point of view.

	./configure --prefix=/usr
	make install DESTDIR=/srv/nfsroot

It can't be so hard to use that.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 15:20         ` Jan Engelhardt
@ 2011-02-14 15:25           ` Fabrice
  2011-02-14 15:43             ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice @ 2011-02-14 15:25 UTC (permalink / raw)
  To: netfilter

Jan Engelhardt <jengelh <at> medozas.de> writes:

> 
> On Monday 2011-02-14 16:03, Fabrice wrote:
> 
> >I'm using DESTDIR but it requires an absolute path which is only valid 
> >on the platform I compile. Suppose the DESTDIR is my NFS which is what 
> >my embedded platform uses, it will try to load the xtables libraries by 
> >using the absolute path from the install. This path is unknown from the 
> >embedded platform point of view.
> 
> 	./configure --prefix=/usr
> 	make install DESTDIR=/srv/nfsroot
> 
> It can't be so hard to use that.

That is what I do and you are right it's not hard. The problem is on the 
embedded platform it will try to load the libs from /srv/nfsroot/ 
which is not valid. The absolute path is only valid on the platform where the 
install was done. I'm not sure if I explain the problem properly...I hope so...




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 15:25           ` Fabrice
@ 2011-02-14 15:43             ` Jan Engelhardt
  2011-02-14 16:19               ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: Jan Engelhardt @ 2011-02-14 15:43 UTC (permalink / raw)
  To: Fabrice; +Cc: netfilter


On Monday 2011-02-14 16:25, Fabrice wrote:
>> 
>> On Monday 2011-02-14 16:03, Fabrice wrote:
>> 
>> >I'm using DESTDIR but it requires an absolute path which is only valid 
>> >on the platform I compile. Suppose the DESTDIR is my NFS which is what 
>> >my embedded platform uses, it will try to load the xtables libraries by 
>> >using the absolute path from the install. This path is unknown from the 
>> >embedded platform point of view.
>> 
>> 	./configure --prefix=/usr
>> 	make install DESTDIR=/srv/nfsroot
>> 
>> It can't be so hard to use that.
>
>That is what I do and you are right it's not hard. The problem is on the 
>embedded platform it will try to load the libs from /srv/nfsroot/ 

It won't. It will load then from the prefix. Otherwise, a helluva lot
Linux distros would have run into the problem already, because they
use DESTDIR when making their packages.

>which is not valid. The absolute path is only valid on the platform where the 
>install was done. I'm not sure if I explain the problem properly...I hope so...

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 15:43             ` Jan Engelhardt
@ 2011-02-14 16:19               ` Fabrice
  2011-02-14 17:43                 ` Fabrice
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice @ 2011-02-14 16:19 UTC (permalink / raw)
  To: netfilter

> It won't. It will load then from the prefix. Otherwise, a helluva lot
> Linux distros would have run into the problem already, because they
> use DESTDIR when making their packages.

> 
./configure --host=arm-linux --prefix=/usr
make
make DESTDIR=/home/workdir/filesys

ok here what I get when I install to the NFS:

# iptables -t nat -A POSTROUTING -o ppp0 -j SNAT -s 10.1.1.25
iptables v1.4.10: Couldn't load target 
`SNAT':/home/test/workdir/filesys/libexec/xtable
s/libipt_SNAT.so: cannot open shared object file: No such file or directory

Try `iptables -h' or 'iptables --help' for more information.

It stills tries to load using the absolute path...
I also noticed it did not add /usr to the path either...


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 16:19               ` Fabrice
@ 2011-02-14 17:43                 ` Fabrice
  2011-02-14 22:53                   ` Jan Engelhardt
  0 siblings, 1 reply; 13+ messages in thread
From: Fabrice @ 2011-02-14 17:43 UTC (permalink / raw)
  To: netfilter

I think I found the issue. It has to do with libtool when I make install.
I saw this in the trace:
libtool: install: warning: relinking `libiptc/libiptc.la'
/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../
arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/lib" 
is unsafe for cross-compilation
/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../
arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libc.so when 
searching for -lc/opt/arm-2009q1/bin/../lib/gcc/
arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: 
skipping incompatible /usr/lib/libc.a when searching for -lc
libtool: install: warning: remember to run `libtool --finish /usr/lib'
libtool: install: warning: `libiptc/libip4tc.la' has not been installed in 
`/usr/lib'
libtool: install: warning: `libiptc/libip6tc.la' has not been installed in 
`/usr/lib'

So I did a make clean, configure and make. The I copied manually those libraries 
before the install to my NFS. It seems to work now :-)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: how to install xtables extension to arbitrary path?
  2011-02-14 17:43                 ` Fabrice
@ 2011-02-14 22:53                   ` Jan Engelhardt
  0 siblings, 0 replies; 13+ messages in thread
From: Jan Engelhardt @ 2011-02-14 22:53 UTC (permalink / raw)
  To: Fabrice; +Cc: netfilter

On Monday 2011-02-14 18:43, Fabrice wrote:

>I think I found the issue. It has to do with libtool when I make install.
>I saw this in the trace:
>libtool: install: warning: relinking `libiptc/libiptc.la'
>/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../
>arm-none-linux-gnueabi/bin/ld: warning: library search path "/usr/lib" 
>is unsafe for cross-compilation
>/opt/arm-2009q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../
>arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/lib/libc.so when 
>searching for -lc/opt/arm-2009q1/bin/../lib/gcc/

Please rerun with `make V=1` so that I may see the libtool and ld 
command line that was used.

My guess is that something added -L/usr/lib to LDFLAGS, which of course 
is wrong since you would need -L/opt/arm-2009q1/lib .

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-02-14 22:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 14:25 how to install xtables extension to arbitrary path? Xing Qianqian
2010-10-14 15:40 ` Jan Engelhardt
2011-02-14 14:25 ` Fabrice
2011-02-14 14:43   ` Mr Dash Four
2011-02-14 14:50     ` Jan Engelhardt
2011-02-14 14:55       ` Mr Dash Four
2011-02-14 15:03       ` Fabrice
2011-02-14 15:20         ` Jan Engelhardt
2011-02-14 15:25           ` Fabrice
2011-02-14 15:43             ` Jan Engelhardt
2011-02-14 16:19               ` Fabrice
2011-02-14 17:43                 ` Fabrice
2011-02-14 22:53                   ` Jan Engelhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.