bug-ncurses
[Top][All Lists]
Advanced

[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
CC != HOSTCC.

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
(d'oh!):

+ test gcc = 
/opt/cegl-2.0/powerpc-750-linux-gnu/gcc-3.3.1-glibc-2.3.2/bin/powerpc-750-linux-gnu-gcc
...
+ ../../ncurses-5.3/misc/shlib tic -s -o /tmp/ncurses/usr/share/terminfo 
../../ncurses-5.3/misc/terminfo.src
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 ;;
 esac
 export PATH
+SHLIB=$srcdir/shlib
+else
+# Cross-compiling, so don't set PATH or run shlib.
+SHLIB=
 fi

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

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


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

#!/bin/sh
set -x
set -e

TARGET=powerpc-750-linux-gnu
CROSSBIN=/opt/cegl-2.0/${TARGET}/gcc-3.3.1-glibc-2.3.2/bin

CROSS=$CROSSBIN/${TARGET}-

# 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
#PATH="$PATH":$CROSSBIN
#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
done
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
make

# 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
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045





reply via email to

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