[Top][All Lists]

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

Re: AC_F77_DUMMY_MAIN failure with Oracle Solaris Studio 12.2 compilers

From: Daily, Jeff A
Subject: Re: AC_F77_DUMMY_MAIN failure with Oracle Solaris Studio 12.2 compilers
Date: Wed, 4 May 2011 06:25:09 -0700

On 5/4/11 5:34 AM, "Christian Rössel" <address@hidden> wrote:

> Hi all,
> the macro AC_F77_DUMMY_MAIN (and AC_FC_DUMMY_MAIN as well) causes
> configure to abort when using Oracle Solaris Studio 12.2 compilers.
> This is the relevant configure output:
> ...
> checking for Fortran 77 libraries of f77...  -lfai -lfui -lfsu -lsunquad
> -lmtsk -lpthread -lm /opt/packages/studio/12.2/prod/lib/libc_supp.a
> checking for gcc... cc
> checking whether we are using the GNU C compiler... no
> checking whether cc accepts -g... yes
> checking for cc option to accept ISO C89... none needed
> checking for dummy main to link with Fortran 77 libraries... unknown
> configure: error: in `/home/roessel/studio_ac_dummy_main/_build_studio':
> configure: error: linking to Fortran libraries from C fails
> See `config.log' for more details
> config.log (attached) reveals a linking error:
> configure:3203: cc -o conftest -g   conftest.c   -lfai -lfui -lfsu
> -lsunquad -lmtsk -lpthread -lm
> /opt/packages/studio/12.2/prod/lib/libc_supp.a >&5
> /usr/bin/ld: cannot find -lmtsk
> All libraries are available on my system but the compile command lacks
> "-L<path>" LDFLAGS. It is interesting that the result of "checking for
> Fortran 77 libraries of f77" does not have any LDFLAGS at all.
> I also checked with gcc, intel, pgi and (bg)xl compilers. They all pass
> the AC_F77_DUMMY_MAIN macro. But in contrast to the studio compiler they
> return -L LDFLAGS for the Fortran library check, e.g.
> checking for Fortran 77 libraries of ifort...
> -L/opt/packages/intel/11.1.072/lib/ia32
> -L/usr/lib/gcc/i486-linux-gnu/4.4.5/
> -L/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../../lib/ -L/lib/../lib/
> -L/usr/lib/../lib/ -L/usr/lib/gcc/i486-linux-gnu/4.4.5/../../../ -L/lib/
> -L/usr/lib/ -lifport -lifcore -limf -lsvml -lm -lipgo -lirc -lirc_s -ldl
> So, why are the -L flags missing when compiling with the studio
> compiler? By looking at config.log I actually found the relevant paths
> (line 166 of config.log):
> /usr/bin/ld -m elf_i386 -dynamic-linker /lib/
> --enable-new-dtags /opt/packages/studio/12.2/prod/lib/crti.o
> /opt/packages/studio/12.2/prod/lib/crt1.o
> /opt/packages/studio/12.2/prod/lib/values-xi.o conftest.o -o conftest -Y
> "/opt/packages/studio/12.2/prod/lib/compilers/rtlibs/usr/lib:/opt/packages/stu
> dio/12.2/lib:/opt/packages/studio/12.2/prod/lib:/lib:/usr/lib"
> -Qy
> "-R/opt/packages/studio/12.2/lib:/opt/packages/studio/12.2/prod/lib/compilers/
> rtlibs/usr/lib:/opt/packages/studio/12.2/lib"
> -lfai -lfui -lfsu -lsunquad -lmtsk -lpthread -lm -lc
> /opt/packages/studio/12.2/prod/lib/libc_supp.a
> /opt/packages/studio/12.2/prod/lib/crtn.o
> It's either the -Y or the -Qy option given to ld:
> -Y
> "/opt/packages/studio/12.2/prod/lib/compilers/rtlibs/usr/lib:/opt/packages/stu
> dio/12.2/lib:/opt/packages/studio/12.2/prod/lib:/lib:/usr/lib"
> -Qy
> "-R/opt/packages/studio/12.2/lib:/opt/packages/studio/12.2/prod/lib/compilers/
> rtlibs/usr/lib:/opt/packages/studio/12.2/lib"
> To have a successful outcome of AC_F77_DUMMY_MAIN it is in my case
> sufficient to additionally pass
> LDFLAGS=-L/opt/packages/studio/12.2/prod/lib/compilers/rtlibs/usr/lib to
> configure, so it can be either of the two options. But according to "man
> ld" I assume it is -Y.
> I identified _AC_FC_LIBRARY_LDFLAGS (lib/autoconf/fortran.m4) as the
> macro where the actual parsing of the ld output is performed in order to
> deteremine the linker flags. There we already look for a "-YP" option.
> Is it sufficient to just add a -Y case there? If yes, how can this be done?

This is exactly the approach I took.  I was asked to support the Sun Studio
compilers for my project and ran into this exact same issue. I did just as
you suggest -- I added a "-Y" case.  Hopefully my attached file gets
through.  The relevant portion of the case statement is as follows:

      for ac_j in `AS_ECHO(["$ac_arg"]) | sed -e 's/-Y/-L/;s/"//g;s/:/
-L/g'`; do
        _AC_LIST_MEMBER_IF($ac_j, $ac_cv_[]_AC_LANG_ABBREV[]_libs, ,
                   [ac_arg="$ac_arg $ac_j"
ac_cv_[]_AC_LANG_ABBREV[]_libs="$ac_cv_[]_AC_LANG_ABBREV[]_libs $ac_j"])

I made sure to put my case *after* the "-YP,*" case because -Y* would have
prematurely matched.

My complete solution isn't quite as quick as the above.  Before calling my
replacement to AC_F77_LIBRARY_LDFALGS (which is a carbon-copy of the AC_*
version, with the additional case) I end up testing whether the value of
FLIBS after calling AC_F77_LIBRARY_LDFLAGS works by using AC_LINK_IFELSE on
a dummy C program (after appending FLIBS to LIBS="$LIBS $FLIBS".)  But I
make sure to AS_UNSET([ac_cv_f77_libs]) first.  It's a hack for sure.
Hopefully my file attached to this email okay.

> The above observations were made using following minimal
> AC_INIT([ac_f77_dummy_main_test],[1],[])
> Any help appreciated.
> Best regards,
> Christian
> --
> Christian Rössel
> Jülich Supercomputing Centre
> Telefon +49 2461 61-1773
> ------------------------------------------------------------------------------
> ------------------
> ------------------------------------------------------------------------------
> ------------------
> Forschungszentrum Juelich GmbH
> 52425 Juelich
> Sitz der Gesellschaft: Juelich
> Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
> Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher
> Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
> Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
> Prof. Dr. Sebastian M. Schmidt
> ------------------------------------------------------------------------------
> ------------------
> ------------------------------------------------------------------------------
> ------------------
> Besuchen Sie uns auf unserem neuen Webauftritt unter

Attachment: ga_f77_library_ldflags.m4
Description: ga_f77_library_ldflags.m4

reply via email to

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