Nmap Development mailing list archives

Re: Patch to fix autoconf/strip for cross-compiling


From: Vlatko Kosturjak <kost () linux hr>
Date: Sun, 22 Feb 2015 11:58:47 +0100

On Thu, Feb 19, 2015 at 04:04:28PM -0600, Daniel Miller wrote:
kost,

I understand the benefit to checking for arch-specific tools, but that link
(and my own test below) seem to indicate that both AC_CHECK_TOOL and
AC_PATH_TOOL first check for host-specific tools, the difference being that
CHECK does not use the full path to the tool.
Can you show some examples of the current configure script treating these
differently? I did check for instances of AC_*_PROG, since those are the
more-problematic calls, but I don't know if these need to be replaced:

Daniel,

Let me elaborate a bit. It's bit confusing, so, I see it needs some 
explanation. Anyway, now I see I made mistake by not providing complete
info and alternatives in my first post.

Actual problem is that building with --host=arm-linux-androideabi fails 
because of libcap config.{guess|sub} are too old (they don't recognize 
androideabi host just arm-linux):

=== configuring in libpcap (/data/code/svn/nmap-error/libpcap)
configure: running /bin/bash ./configure --disable-option-checking '--prefix=/sdcard/opt/nmap-6.47'  
'--host=arm-linux-androideabi' '--without-zenmap' '--with-liblua=included' '--with-libpcap=internal' 
'--with-pcap=linux' '--enable-static' '--with-openssl=/sdcard/opt/openssl' 'host_alias=arm-linux-androideabi' 
'CC=arm-linux-androideabi-gcc' 'CFLAGS=-fvisibility=default -fPIE' 'LDFLAGS=-rdynamic -pie' 
'CXX=arm-linux-androideabi-g++' 'CXXFLAGS=-fvisibility=default -fPIE' --cache-file=/dev/null --srcdir=.
checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/bash ./config.sub arm-linux-androideabi failed
configure: error: ./configure failed for libpcap
make: *** [configure] Error 1

Therefore, I'm building it with --host=arm-linux and then prefix each utility 
with environment (i.e. CC=arm-linux-androideabi-gcc). Current configure scripts
cannot pick up STRIP env or do extended search.

By looking at the problem, I've found two solutions:

1) patch libpcap with newer versions of config.sub and config.guess

2) use AC_*_TOOL patch I sent, since newer configure is able to search for androideabi as well by default

Since, I had experience that you don't want to patch external libraries (I remember liblua), I
have chosen to go with path 2). 

I'm sending alternative which is IMHO better solution since we're fixing it at
the source of the problem. But we're touching libpcap which is kind of external.

I've basically updated those two files according to instructions here:
https://stackoverflow.com/questions/4594736/configure-does-not-recognize-androideabi

From the source here:
http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree

Diff is basically replacing those files with these newer versions (in libcap directory).

Choose your path wisely! :)
-- 
Vlatko Kosturjak - KoSt

Attachment: fix-libpcap-config.diff
Description:

_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

Current thread: