[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] avoid using wrong shared libraries when cross-compiling (was: Su

From: Dan Kegel
Subject: [patch] avoid using wrong shared libraries when cross-compiling (was: Success cross-compiling ncurses-5.3-20030719 -- but can't install)
Date: Thu, 28 Aug 2003 21:07:53 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Dan Kegel wrote:
In the meantime, I'll probably try some horrible kludge like
using my workstation's copy of tic

Hang on -- I just read the Makefile more closely, and
that's what it's already trying to do if it detects that

Hmm.  Looks like the problem is using $srcdir/shlib unconditionally.
Here's a log after setting -x in run_tic.sh.
It totally notices that CC != HOSTCC, but then it
goes and tries to use the shared libraries we just compiled

+ test gcc = 
+ ../../ncurses-5.3/misc/shlib tic -s -o /tmp/ncurses/usr/share/terminfo 
tic: error while loading shared libraries: ../lib/libncurses.so.5: ELF file 
data encoding not little-endian

I verified that this still happens even after applying
all the latest incremental patches.

Here's a patch that seems to fix the problem for me:

--- ncurses-5.3/misc/run_tic.in.old     Thu Aug 28 20:20:43 2003
+++ ncurses-5.3/misc/run_tic.in Thu Aug 28 20:22:37 2003
@@ -66,6 +67,10 @@
 *) PATH=../progs:../lib:${DESTDIR}$bindir:$PATH ;;
 export PATH
+# Cross-compiling, so don't set PATH or run shlib.

@@ -111,7 +116,7 @@
        problems for older ncurses applications.

-if ( $srcdir/shlib tic$suffix -s -o $TERMINFO $source )
+if ( $SHLIB tic$suffix -s -o $TERMINFO $source )
        echo '** built new '$TERMINFO

and here's a full-on script that demonstrates how to download,
cross-compile, and install the latest ncurses (it assumes
the above patch is saved as run_tic.patch):

set -x
set -e



# If you uncomment the following, you don't need to override CC, CXX, AR, LD, 
RANLIB below
# because autoconf will look for each tool with a ${TARGET}- prefix
#export PATH

# Fetch ncurses and rollup patch (patch needed to cross-compile!)
wget -c ftp://invisible-island.net/ncurses/ncurses-5.3.tar.gz
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030719-patch.sh.bz2
# Fetch incremental patches in case they have anything important
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030726.patch.gz
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030802.patch.gz
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030809.patch.gz
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030816.patch.gz
wget -c ftp://invisible-island.net/ncurses/5.3/ncurses-5.3-20030823.patch.gz

# Patch
rm -rf ncurses-5.3
tar -xzvf ncurses-5.3.tar.gz
cd ncurses-5.3
bzcat ../ncurses-5.3-20030719-patch.sh.bz2 | patch -p1
for p in ../ncurses-5.3-2003*.patch.gz; do
  zcat $p | patch -p1
patch -p1 < ../run_tic.patch
cd ..

# Configure and build
rm -rf ncurses-demo
mkdir ncurses-demo
cd ncurses-demo
# Note: in previous releases, had to specify --target.  Now it's --host for 
some reason.
../ncurses-5.3/configure BUILD_CC=gcc CC=${CROSS}gcc CXX=${CROSS}g++ 
AR=${CROSS}ar LD=${CROSS}ld RANLIB=${CROSS}ranlib --host=$TARGET --with-shared

# Install, as if /tmp/ncurses was the root directory of our target system image
rm -rf /tmp/ncurses
mkdir /tmp/ncurses
make DESTDIR=/tmp/ncurses install

- Dan

Dan Kegel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]