automake
[Top][All Lists]
Advanced

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

Compiling 32-bit code on 64-bit HP-UX


From: Martin Frydl
Subject: Compiling 32-bit code on 64-bit HP-UX
Date: Thu, 11 Sep 2003 22:14:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703

Hello,

I'm trying to create 32-bit shared libraries on 64-bit PA-RISC 2.0 (HP-UX 11) with aCC compiler. I have several libraries and executables in my project. When I run them from build directory, everything works fine. However, when I run make install and delete build directory, the executables and libraries stop working. I've looked into them via chatr utility and it shows that they reference build directory as search path, not install one.

I've investigated the problem and it looks like it lies in config.guess. config.guess checks host type according to uname and getconf utility which results in "hppa2.0w" (64-bit PA-RISC 2.0). Then there is a check for __LP64__ define, which fails. Here the failure is caused by wrong use of compiler options - it runs:

  $CC_FOR_BUILD -E -

which is not understood by aCC. It should be rewritten to use temporary file instead of "-" (stdin). Moreover, the check does not use compiler flags so the result is not affected by switches determining the "bitness" of resulting code - +DA2.0W (64-bit), +DA2.0N (32-bit), +DA1.1 (32-bit PA-RISC 1.1). However, this can be workarounded by putting these directly into CC when running configure.

The host type set after the check is not clear enough since it does not correspond to aCC options. When __LP64__ is defined, host type is hppa64, which seems correct if it stands for 64-bit. When the check fails, host type is set to hppa2.0w. However, I think this host type should mean 64-bit since option +DA2.0W to aCC generates 64-bit code.

Unfortunatelly, libtool determines 32/64-bit hppa in a way "hppa64 is 64-bit and anything else is 32-bit". There is also problem in libtool.m4 regarding options supplied via CC variable. When they are supplied, libtool checks for compiler do not work since cc_basename contains also those options. I've attached simple patch which removes all characters after the first space.

Also I don't understand the way config.guess should be copied to project. Currently it is copied by libtoolize from share/libtool, but this one is outdated and current one is in share/automake-1.7. Should I copy it manually from automake?

  Now here are my conclusions:

- config.guess does not use CFLAGS when making compilation checks but this can be "fixed" by providing necessary flags directly in CC variable - config.guess should be fixed so __LP64__ check works corretly (patch attached) - config.guess "generates" host types which do not correspond to aCC (HP native) namings but this cannot be changed - there are two config.guess versions when both libtool and automake are installed. libtoolize takes one from libtool, not automake - libtool needs to be patched to support options supplied in CC or CXX variables

  Martin
--- share/libtool/config.guess  Thu Sep 11 20:42:41 2003
+++ config.guess        Thu Sep 11 20:48:01 2003
@@ -622,7 +622,8 @@
        then
            # avoid double evaluation of $set_cc_for_build
            test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ 
>/dev/null
+           echo __LP64__ > $dummy.c
+           if (CCOPTS= $CC_FOR_BUILD -E $dummy.c) | grep __LP64__ >/dev/null
            then
                HP_ARCH="hppa2.0w"
            else
--- share/aclocal/libtool.m4    Thu Sep 11 20:42:41 2003
+++ libtool.m4  Thu Sep 11 21:55:40 2003
@@ -2655,7 +2655,7 @@
 CC=${CXX-"c++"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%' | $Xsed -e 's% .*$%%'`
 
 # We don't want -fno-exception wen compiling C++ code, so set the
 # no_builtin_flag separately
@@ -3648,7 +3648,7 @@
 CC=${F77-"f77"}
 compiler=$CC
 _LT_AC_TAGVAR(compiler, $1)=$CC
-cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'`
+cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%' | $Xsed -e 's% .*$%%'`
 
 AC_MSG_CHECKING([if libtool supports shared libraries])
 AC_MSG_RESULT([$can_build_shared])

reply via email to

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