Aquil H. Abdullah | 5 Aug 2008 21:34
Picon
Gravatar

-KPIC has been deprecated in new Intel FORTRAN Compilers (ifort)

I use a myriad of FORTRAN compilers, and libtool (to alleviate the myriad of headaches that come along with using a myriad of FORTRAN compilers).  Libtool was generating lovely compilations until I moved to ifort 10.X.  Intel has deprecated the -KPIC option and now only supports -fPIC option.  This causes a problem when I run configure to build libtools, becuase when I compile code using libtool and ifort the -fPIC option is not specified, and at link time I get a symbol rellocation error.  I know that the 9.X series of the intel compiler supports -fPIC as well as -KPIC.  Would it be possible to have future versions of libtool check for the -fPIC option rather than the -KPIC option.  Or better yet, have libtool check for the version of the intel compiler and then select the proper option?  The first change is easy, as I did this my self.  The second change requires some more thought and may be overkill. Below, is a diff on what I did to get the correct behaviour (Change 1):

[aha <at> megaro libtool]$ diff -Naur libtool-2.2.4/configure ~/libtool-2.2.4/configure
--- libtool-2.2.4/configure     2008-05-04 15:07:24.000000000 -0400
+++ /home/aha/libtool-2.2.4/configure   2008-08-05 15:08:57.000000000 -0400
<at> <at> -8069,7 +8069,7 <at> <at>
       case $cc_basename in
       icc* | ecc* | ifort*)
        lt_prog_compiler_wl='-Wl,'
-       lt_prog_compiler_pic='-KPIC'
+       lt_prog_compiler_pic='-fPIC'
        lt_prog_compiler_static='-static'
         ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
<at> <at> -17363,7 +17363,7 <at> <at>
       case $cc_basename in
       icc* | ecc* | ifort*)
        lt_prog_compiler_wl_F77='-Wl,'
-       lt_prog_compiler_pic_F77='-KPIC'
+       lt_prog_compiler_pic_F77='-fPIC'
        lt_prog_compiler_static_F77='-static'
         ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
<at> <at> -20291,7 +20291,7 <at> <at>
       case $cc_basename in
       icc* | ecc* | ifort*)
        lt_prog_compiler_wl_FC='-Wl,'
-       lt_prog_compiler_pic_FC='-KPIC'
+       lt_prog_compiler_pic_FC='-fPIC'
        lt_prog_compiler_static_FC='-static'
         ;;
       pgcc* | pgf77* | pgf90* | pgf95*)
<at> <at> -22909,7 +22909,7 <at> <at>
       case $cc_basename in
       icc* | ecc* | ifort*)
        lt_prog_compiler_wl_GCJ='-Wl,'
-       lt_prog_compiler_pic_GCJ='-KPIC'
+       lt_prog_compiler_pic_GCJ='-fPIC'
        lt_prog_compiler_static_GCJ='-static'
         ;;
       pgcc* | pgf77* | pgf90* | pgf95*)

Your humble libtool servant.

--
Aquil H. Abdullah
aquil.abdullah <at> gmail.com
_______________________________________________
Bug-libtool mailing list
Bug-libtool <at> gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool
Ralf Wildenhues | 6 Aug 2008 07:21
Picon
Picon

Re: -KPIC has been deprecated in new Intel FORTRAN Compilers (ifort)

Hello Aquil,

Thanks for the bug report.

* Aquil H. Abdullah wrote on Tue, Aug 05, 2008 at 09:34:15PM CEST:
> I use a myriad of FORTRAN compilers, and libtool (to alleviate the myriad of
> headaches that come along with using a myriad of FORTRAN compilers).
> Libtool was generating lovely compilations until I moved to ifort 10.X.
> Intel has deprecated the -KPIC option and now only supports -fPIC option.

The git version of Libtool has already seen a couple of patches to this
end.  It would be nice if you could test it.  They will be part of
2.2.6.

Cheers,
Ralf
Trudeau, John F | 8 Aug 2008 20:02

[libtool 2.2.4] testsuite: 28 45 62 70 72 failed

Attachment (testsuite.log): application/octet-stream, 133 KiB
_______________________________________________
Bug-libtool mailing list
Bug-libtool <at> gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool
Marc Glisse | 13 Aug 2008 18:50
Favicon

improve stlport4 check in libtool.m4

Hello,

libtool.m4 contains a test that may set solaris_use_stlport4 and disable 
the addition of "-library=Cstd,Crun" (which is a useful addition when 
creating shared objects with the default standard library).

I would just like to replace the test:

*" -library=stlport4 "*)

by:

*" -library=stlport4 "* | *" -library=no%Cstd "*)

(note that this code occurs in 2 places in the file, both of which could 
be changed)

The point is that it is possible to use yet an other standard library than 
stlport4 (indeed the kde on solaris effort is using the apache stdcxx), in 
which case we also want to avoid "-library=Cstd". The compiler flag that 
disables Cstd is -library=no%Cstd (-library=stlport4 is actually an alias 
for -library=no%Cstd,stlport4).

Note that the variable could be renamed since it is also used on linux, 
not only solaris, and with this patch would also be used with other 
alternate C++ standard libraries, but that does not really matter.

--

-- 
Marc Glisse
Ralf Wildenhues | 14 Aug 2008 20:58
Picon
Picon

Re: improve stlport4 check in libtool.m4

Hello Marc,

* Marc Glisse wrote on Wed, Aug 13, 2008 at 06:50:42PM CEST:
>
> libtool.m4 contains a test that may set solaris_use_stlport4 and disable  
> the addition of "-library=Cstd,Crun" (which is a useful addition when  
> creating shared objects with the default standard library).

Yes.

> I would just like to replace the test:
>
> *" -library=stlport4 "*)
>
> by:
>
> *" -library=stlport4 "* | *" -library=no%Cstd "*)
>
> (note that this code occurs in 2 places in the file, both of which could  
> be changed)

One for Linux, one for Solaris.

> The point is that it is possible to use yet an other standard library 
> than stlport4 (indeed the kde on solaris effort is using the apache 
> stdcxx), in which case we also want to avoid "-library=Cstd". The 
> compiler flag that disables Cstd is -library=no%Cstd (-library=stlport4 
> is actually an alias for -library=no%Cstd,stlport4).

What about -library=Crun?  Should it also be disabled upon encounter of
-library=no%Cstd?

> Note that the variable could be renamed since it is also used on linux,  
> not only solaris, and with this patch would also be used with other  
> alternate C++ standard libraries, but that does not really matter.

Oh, for maintainability this matters, though.  The variable should be
renamed to lt_(cv_)suncxx_use_Cstd (with negated values), as far as I
understand.  (The cv_ infix should be used if AC_CACHE_CHECK is used.)

Care to provide a patch?  Bonus points for providing a testsuite
addition also (which is fine to be SKIPped non non-Solaris, non-Sun
compilers).

Thanks,
Ralf
Marc Glisse | 15 Aug 2008 03:41
Favicon

Re: improve stlport4 check in libtool.m4

On Thu, 14 Aug 2008, Ralf Wildenhues wrote:

>> The point is that it is possible to use yet an other standard library
>> than stlport4 (indeed the kde on solaris effort is using the apache
>> stdcxx), in which case we also want to avoid "-library=Cstd". The
>> compiler flag that disables Cstd is -library=no%Cstd (-library=stlport4
>> is actually an alias for -library=no%Cstd,stlport4).
>
> What about -library=Crun?  Should it also be disabled upon encounter of
> -library=no%Cstd?

I think there is never any reason to disable -library=Crun. Well there is 
the prehistoric mode -compat=4 but we can ignore that. And the compiler 
provides an option -library=no%Crun to disable it, but even -library=%none 
disables everything but Crun. On the other hand, when people are not using 
Cstd, it is their responsability to link with the appropriate libraries. 
So I guess it does not really matter. When we create a shared object with 
-library=stlport4, it links with libstlport4 which is linked with Crun but 
it does not link directly with Crun, so I guess -library=Crun is still a 
useful addition there.

Proposition:
add -library=Crun unless there is -library=no%Crun
add -library=Cstd unless there is -library=stlport4 or -library=stlport4_dbg or -library=no%Cstd or -library=%none

This means ignoring the mode -compat=4 (most packages wouldn't compile 
anyway, so it does not matter) and ignoring that -library= can 
take several values separated by commas (it should be taken into account, 
but it makes the code a bit more complicated and I am not a shell expert).

I am not sure there is any point to the no%Crun case, but it shouldn't 
hurt.

>> Note that the variable could be renamed since it is also used on linux,
>> not only solaris, and with this patch would also be used with other
>> alternate C++ standard libraries, but that does not really matter.
>
> Oh, for maintainability this matters, though.  The variable should be
> renamed to lt_(cv_)suncxx_use_Cstd (with negated values), as far as I
> understand.  (The cv_ infix should be used if AC_CACHE_CHECK is used.)
>
> Care to provide a patch?  Bonus points for providing a testsuite
> addition also (which is fine to be SKIPped non non-Solaris, non-Sun
> compilers).

I have to admit that I am far from familiar with the code. I found the 
relevant piece of code after several calls to grep and guessed what it was 
doing. The following is completely untested, I modified only one of the 
occurences, I have no idea what to do with the cv_ infix you are 
mentionning. Handling the case where -library= has several comma-separated 
values is more complicated, it seems like libtool uses sed for this kind 
of thing.

--- old/libtool.m4	2008-08-15 02:59:15.270398067 +0200
+++ new/libtool.m4	2008-08-15 03:08:28.573045596 +0200
 <at>  <at>  -4031,12 +4031,20  <at>  <at> 
      # it if it's in CXXFLAGS. Ignore libCrun as
      # -library=stlport4 depends on it.
      case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
+    *" -library=stlport4 "*|*" -library=stlport4_dbg "*|*" -library=no%Cstd "*|*" -library=%none "*)
+      lt_sunCC_use_Cstd=no
        ;;
      esac
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    case " $CXX $CXXFLAGS " in
+    *" -library=no%Crun "*)
+      lt_sunCC_use_Crun=no
+      ;;
+    esac
+    if test "$lt_sunCC_use_Cstd" != no; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd'
+    fi
+    if test "$lt_sunCC_use_Crun" != no; then
+      _LT_AC_TAGVAR(postdeps,$1)='-library=Crun'
      fi
      ;;
    esac

--

-- 
Marc Glisse
Roger While | 15 Aug 2008 19:34
Picon

allow/no_undefined_flag


Problem applies from 1.x upto current stable 2.2.4.
allow_undefined_flag and no_undefined_flag are not being
expanded correctly at least under AIX (5.3). Probably other
architectures are affected as well.
This is the last part of a library link line from a make -
  -lc -Wl,-bnoentry  -qmaxmem=20000 -qarch=ppc -Wl,-bE:.libs/libgmp.exp 
${wl}-berok
Another example (last part of link line) -
-lc -Wl,-bnoentry  -Wl,-bexpfull -Wl,-bE:.libs/libcob.exp ${wl}-bernotok

Roger While
Peter O'Gorman | 16 Aug 2008 05:09
Favicon
Gravatar

Re: allow/no_undefined_flag

Roger While wrote:
> 
> Problem applies from 1.x upto current stable 2.2.4.
> allow_undefined_flag and no_undefined_flag are not being
> expanded correctly at least under AIX (5.3). Probably other
> architectures are affected as well.
> This is the last part of a library link line from a make -
>  -lc -Wl,-bnoentry  -qmaxmem=20000 -qarch=ppc -Wl,-bE:.libs/libgmp.exp
> ${wl}-berok
> Another example (last part of link line) -
> -lc -Wl,-bnoentry  -Wl,-bexpfull -Wl,-bE:.libs/libcob.exp ${wl}-bernotok

Does the link fail?

Peter
--

-- 
Peter O'Gorman
http://pogma.com
Roger While | 16 Aug 2008 06:29
Picon

Re: allow/no_undefined_flag

In the first case yes, in the second case no but that is another story.
You get away with it because, after the shell has replaced ${wl} with nothing,
cc/xlc pass the resultant -berok/-bernotok to the linker.

Roger While

>Roger While wrote:
> >
> > Problem applies from 1.x upto current stable 2.2.4.
> > allow_undefined_flag and no_undefined_flag are not being
> > expanded correctly at least under AIX (5.3). Probably other
> > architectures are affected as well.
> > This is the last part of a library link line from a make -
> >  -lc -Wl,-bnoentry  -qmaxmem=20000 -qarch=ppc -Wl,-bE:.libs/libgmp.exp
> > ${wl}-berok
> > Another example (last part of link line) -
> > -lc -Wl,-bnoentry  -Wl,-bexpfull -Wl,-bE:.libs/libcob.exp ${wl}-bernotok
>
>Does the link fail?
>
>Peter
>--
>Peter O'Gorman
>http://pogma.com
Ralf Wildenhues | 16 Aug 2008 12:40
Picon
Picon

Re: allow/no_undefined_flag

Hello Roger,

* Roger While wrote on Sat, Aug 16, 2008 at 06:29:07AM CEST:
> In the first case yes, in the second case no but that is another story.
> You get away with it because, after the shell has replaced ${wl} with nothing,
> cc/xlc pass the resultant -berok/-bernotok to the linker.

Thanks.  Please post a full link command line, preferably also how you
invoked configure.

Cheers,
Ralf

Gmane