libtool
[Top][All Lists]
Advanced

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

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


From: Martin Frydl
Subject: Re: Compiling 32-bit code on 64-bit HP-UX
Date: Mon, 15 Sep 2003 18:10:54 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030703

Boehne, Robert wrote:
Martin,

Even on a 64-bit capable machine, aCC defaults to 32-bit libraries.
Having config.guess return hppa2.0w does not change the output that
is produced, aCC will produce whatever you tell it to (32-bit by default).
When you're running a configure script you want to set both (for C)
CPPFLAGS and CFLAGS, for C++ CXXCPPFLAGS and CXXFLAGS when you need to
pass an option that changes the preprocessing like +DA.  This is generally
a better option than setting CXX="aCC -DA2.0".  Try this and read
the Libtool web site regarding contributing if you want to send another patch.
http://www.gnu.org/software/libtool/contribute.html

Unfortunatelly, this solution does not work. libtool determines its operation (whether compiling 32 or 64-bit code) according to host type set by config.guess. This seems ok. config.guess makes test to check whether the compiler generates 32 or 64-bit code. However, the problem is that it uses just CC and ignores all flags (including your suggested). The only solution is to pass them via CC (I've seen this trick some time ago in libtool mailing list). When this trick is used, host type is hppa64 and libtool works correctly. The problem is that it does not recognize the compiler now - that's fixed by the patch.

I think this patch also fixes problem discussed some time ago on mailing list - about Intel icc compiler. It was solved by adding extra "*" to branches in "case $cc_basename". Now it should work without them. See http://mail.gnu.org/archive/html/libtool/2003-04/msg00016.html (I haven't tried this, it's just my assumption).

BTW, +DA2.0 is not preprocessor option, but the compiler one. It determines architecture where the generated code will run - note the plus "+" before D instead of minus "-".

  Martin


HTH,

Robert

-----Original Message-----
From: Martin Frydl [mailto:address@hidden
Sent: Thursday, September 11, 2003 3:14 PM
To: address@hidden; address@hidden
Subject: Compiling 32-bit code on 64-bit HP-UX


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


_______________________________________________
Libtool mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/libtool
Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1260
diff -u -r1.1260 ChangeLog
--- ChangeLog   11 Sep 2003 12:43:30 -0000      1.1260
+++ ChangeLog   15 Sep 2003 16:06:07 -0000
@@ -1,3 +1,7 @@
+2003-09-15  Martin Frydl  <address@hidden>
+
+       * libtool.m4: Compiler options ignored when setting cc_basename.
+
 2003-09-11  Peter O'Gorman  <address@hidden>
 
        * AUTHORS, THANKS: Added myself to AUTHORS, removed from THANKS.
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.335
diff -u -r1.335 libtool.m4
--- libtool.m4  10 Sep 2003 07:48:02 -0000      1.335
+++ libtool.m4  15 Sep 2003 16:06:11 -0000
@@ -2670,7 +2670,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
@@ -3676,7 +3676,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]